IMAP: Fixed THREAD .. INTHREAD crashing. Also cleaned up the code a bit.
IMAP: Fixed THREAD .. INTHREAD crashing. Also cleaned up the code a bit.

--HG--
branch : HEAD

jkerihuel/dovecot,jkerihuel/dovecot,jwm/dovecot-notmuch,jwm/dovecot-notmuch,jkerihuel/dovecot,jkerihuel/dovecot,jkerihuel/dovecot,jwm/dovecot-notmuch,jwm/dovecot-notmuch,jwm/dovecot-notmuch