On 05 Sep 2014, at 04:35, Stefan Arentz stefan@arentz.ca wrote:
I’ve been hacking on a personal side project to support native iOS Push Email in Dovecot. This is specifically for people who are migrating their mail away from OS X Server while keeping their existing Push Email functionality.
Nice. I had been planning to look into this as well, but never had much time. Some comments from a quick look:
xaps_str_append_quoted() doesn't quote CR/LF/TABs. Of course those shouldn't normally exist in any of the fields, but older Dovecot versions would have allowed creating folder names with them. Using the str_append_tabescaped() would escape them as well, although then you'd have to implement the unescaping also with Python.
ideally the communication between Dovecot and xaps-daemon would be done asynchronously, but as a quick change you could also use i_stream_create_fd() + i_stream_read_next_line() instead of the strtok_r call. Oh and in internal Dovecot protocols it has always used LF, not CRLF, which would also make it a bit easier to handle.
in xaps_notify() especially async IO would be much better to avoid latency. It's also easier to do than in init, since it wouldn't really even need to wait for the response. Even without async IO does it really even need to read the answer from the server?
also to avoid bursts of notifications in some situations, you could use timeout_add(NOTIFY_DELAY_MSECS, ...) and have the timeout function send the notification. The delay being for example 0,5 seconds or maybe configurable.
BTW. We could have some other Dovecot plugins that need to be developed if you want more (paid) work. :) We need to hire more developers to reduce my work load..