> On Sep 15, 2014, at 8:58 AM, Timo Sirainen <t...@iki.fi> wrote: > > On 05 Sep 2014, at 04:35, Stefan Arentz <ste...@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.
Hi Timo, Thank you for these hints. I appreciate your input. This all sounds pretty good and I will try to make these changes soon and push out a new release. For people who are interested in trying our this project, I have made considerable improvements to the daemon side of things. It is now a proper Twisted application that you can start using twistd, so that it goes in the background, writes a pid file, etc. See https://github.com/st3fan/dovecot-xaps-daemon/blob/master/README.md#installing-and-running-the-daemon S.