[Twisted-Python] Trouble with example imap client on unread messages

Anders Hammarquist iko at cd.chalmers.se
Fri Jul 8 05:08:57 EDT 2005

In a message of Fri, 08 Jul 2005 10:36:32 +0200, Thomas HERVE writes:
>Quoting Andy Gayton <andy at thecablelounge.com>:
>>  * 244 FETCH (FLAGS (\Seen))
>The problem I see is here : why does the server had this line ?

The flags changed, and the server is telling you about it, as it

>> The callback for the above fetchSpecific call is receiving:
>> { 243 : [['BODY', ['HEADER.FIELDS', ['SUBJECT']], 'Subject: DELIVERY 
>> REPORTS ABOUT YOUR E-MAIL\r\n\r\n']], 244 : [['FLAGS', ['\\Seen']]] }
>> ie, I'm not getting the subject for unread messages.
>Well actually it's logical, because Twisted parses result in a dictionnary so
>you have :
>res[243] = < subject >, then res[244] = < subject >, but res[244] = < flags >
>which overrides previous value.

This is bad, RFC-3501 says:
   A client MUST be prepared to accept any server response at all times.
   This includes server data that was not requested.  Server data SHOULD
   be recorded, so that the client can reference its recorded copy
   rather than sending a command to the server to request the data.  In
   the case of certain server data, the data MUST be recorded.

so I'd say twisted's IMAP-client is broken.


 -- Of course I'm crazy, but that doesn't mean I'm wrong.
Anders Hammarquist                                  | iko at cd.chalmers.se
Physics student, Chalmers University of Technology, | Hem: +46 31 88 48 50
G|teborg, Sweden.           RADIO: SM6XMM and N2JGL | Mob: +46 707 27 86 87

More information about the Twisted-Python mailing list