imap: group messages by X-GM-THRID

The key of the map has to be a string for json.Marshal() to work on it.