New TIdIMAP4 methods to add more support for GMail IMAP extensions

Some additional support for Gmail IMAP extensions has been added to TIdIMAP4.

Previously, the TIdIMAP4FetchDataItem enum was updated in preparation for allowing Gmail’s X-GM-MSGID, X-GM-THRID, and X-GM-LABELS values to be retreived from emails using FETCH commands, however no methods of TIdIMAP4 had been implemented yet to support those extended commands.

The TIdIMAP4.ParseLastCmdResult() method has now been updated to parse those Gmail values from FETCH responses and store them in the TIdIMAP4.FLineStruct member. New (UID)RetrieveValue() methods have been added to actually retreive those values. For example:

var
  GmailMsgID,
  GmailThreadID,
  GmailLabels: String;

IdIMAP4.RetrieveValue(MsgNum, 'X-GM-MSGID', GmailMsgID);
IdIMAP4.UIDRetrieveValue(UID, 'X-GM-MSGID', GmailMsgID);

IdIMAP4.RetrieveValue(MsgNum, 'X-GM-THRID', GmailThreadID);
IdIMAP4.UIDRetrieveValue(UID, 'X-GM-THRID', GmailThreadID);

IdIMAP4.RetrieveValue(MsgNum, 'X-GM-LABELS', GmailLabel);
IdIMAP4.UIDRetrieveValue(UID, 'X-GM-LABELS', GmailLabel);

In addition, new (UID)StoreValue() methods have been added which can be used to add/remove Gmail X-GM-LABELS values to/from emails:

IdIMAP4.StoreValue([MsgNum], sdAdd, 'X-GM-LABELS', 'value');
IdIMAP4.UIDStoreValue(UID, sdAdd, 'X-GM-LABELS', 'value');
IdIMAP4.UIDStoreValue([UID], sdAdd, 'X-GM-LABELS', 'value);

At this time, there are no methods implemented to retrieve these Gmail values while downloading emails, as there is nowhere available to store them. They have to be retreived separately.