I’ve begun the redesign of the HelpSpot IMAP integration code and I’m flat out scared! The code actually works great for the most part, but there’s one customer who’s having a hard time with it. They’re doing a few odd things with forwarding that are not working as intended. Beyond that though, it currently relies in the pear Mail_IMAP abstraction code which is practically impossible to work with. Lots of hugely nested arrays, a new version which is incompatible with the old, and so on. Also that code is officially the oldest code in HelpSpot, being the very first thing I wrote (that’s how core it is to HS).
The new version is lean and mean. It should be alot faster than the old code and hopefully will address some of the odd nested mime issues the current version has trouble with.
As a side rant, whoever developed the message format of email is a sick dude. The format is insane and decoding multipart messages is a complete mess. You’d think someone would have been able to introduce an XMLified version of the spec and make it stick by now.