andris9/inbox — pull request #62 by felixhammerl (2014-01-27 15:15:20+00:00)
Title: end stream in command callback

this one was sneaky:

problem: when you stream a message and invoke a command like listMessages in the 'end' event of the stream, you are being called back with whatever the lineparser has ready for you from the previous command.

solution: you may not invoke the next command before the lineparser has determined that the message before was finished. the simplest solution is to close the message in the callback that is invoked when the lineparser has determined that the current command is now done.