06-29-2022, 03:26 PM
(06-29-2022, 02:36 AM)Boba TC Wrote: Now I'd like to know how to get values of those flags returned by the server; the following compiles and executes:
after it returns, s2=="OK"; what is the TIdIMAP4 method() for that?Code:s2 = IdIMAP4->SendCmd(IdIMAP4->NewCmdCounter, "FETCH 10:20 (FLAGS)", OPENARRAY(String, ("FETCH")));
The downloaded data is in the IdIMAP4->LastCmdResult->Text property.
Internally, TIdIMAP4 uses a ParseLastCmdResult() method to parse out various fields from FETCH responses into the FLineStruct member, including FLAGS.
ParseLastCmdResult() parses 1 reply item at a time, so for commands that download a range of replies (ie, (UID)RetrieveAllEnvelopes(), (UID)RetrieveMailBoxSize(), etc), TIdIMAP4 loops through the LastCmdResult->Text parsing each string individually.
The ParseLastCmdResult() and FLineStruct members are protected, so either use an accessor class to reach them, or just parse the LastCmdResult->Text yourself as needed.