[sork] Patch for vacation forwards-driver (.forward-parser)

Espen Jürgensen espen at hhkol.dk
Tue Apr 13 14:32:27 PDT 2004


Here is an update to the dot forward parser for the Vacation module.

It uses PEAR/ParseAddressList instead of imap_rfc822_parse_adrlist to
stay consistent with makeEmailAddress (though I still think imap_rfc
would be better for both, as previously argued).

Since PEAR/ParseAddressList does not filter backslashes (and thus allows
the user to save an address preceded with a backslash), the parser
doesn't need to treat backslashes in any special way.

The parser returns false if it cannot recognize the contents of the
.forward file, along with an error message. 

However, there are some problems related to the way _getUserDetails
exits, and these problems affect the parser. Currently, it seems like it
is difficult to trigger an error. Even ftp errors do not get shown. I
believe the problem is related to the structure of the driver, where
_getUserDetails gets called twice. But I haven't examined these issues
thoroughly, since they are outside the scope of this patch.

I wouldn't mind a bit of advice on how to exit from _getUserDetails,
however. Particularly, I would like to know how to exit, when parsing
fails, but contents of .vacation.msg can be read. Returning false, and
saving the contents in $this->_details seems like the obvious solution,
but it doesn't work (because the second time getUserDetails gets called,
the return value is only determined by $this->_details). I see two easy
solutions:

1) Just ignore .vacation.msg and set $this->_details = false
2) Add something like $this->_details['unparsable'] = true, and make
_getUserDetails return false when it is set.

-- 
Espen Jürgensen <espen at hhkol.dk>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: forwards.php.patch
Type: text/x-patch
Size: 3446 bytes
Desc: not available
Url : http://lists.horde.org/archives/sork/attachments/20040413/3f274fbd/forwards.php.bin


More information about the sork mailing list