On 04/24/2009 04:42 PM, Juha Heinanen wrote:
Miklos Tirpak writes:
I vote fore keeping the support for "if (@to.tag)" like expressions, and adding the extra functions for more precise checks if necessary. So a string value could evaluate to true if it exists and not "".
what if there is no to tag at all or if there is one, but its value is ""?
Both of them would return false. Btw, I do not think that empty value is allowed for to tag, it's a very rare case, and could be covered with some explicit check.
I think it is easier to read and understand "if (@to.tag)" then "if (!strempty(@to.tag))"
why don't you write 'if (@to.tag != "") ...'? that would be easy to understand.
We used to write this, but had lots of issues. The problem happens for example with @contact.uri.user, when there is no contact header. Unfortunately the select function can return and error instead of success with "" value in this case. (The can be also revisited) And 'if (@contact.uri.user == "")' would evaluate to false because the left had side value does not exist, which is wrong.
Miklos
-- juha