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

Andy Gayton andy at thecablelounge.com
Fri Jul 8 07:51:19 EDT 2005

> Quoting Andy Gayton <andy at thecablelounge.com>:
>> proto.fetchSpecific('1:*',
>>     headerType='HEADER.FIELDS',
>>     headerArgs=['SUBJECT']

Thomas HERVE wrote:
> The problem I see is here : why does the server had this line ? It 
> doesn't seem
> to be an answer, but more the consequence of the fetch (which mark 
> messages as
> seen). This message should appeared *after* fetch called... Maybe 
> Bincimap is
> too fast :).
> You could try this instead (which don't mark message seen) :
> proto.fetchSpecific('1:*',
>     headerType='HEADER.FIELDS',
>     headerArgs=['SUBJECT'],
>        peek=True
> )

Thanks Thomas, this workaround does work.  I'm sure there's going to be 
trouble down the track when I need my actions to change the state of the 
messages, but it at least confirms what you and Anders observed.

Anders wrote:
> 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.

I agree with Anders.  But man, what a bitch to handle :)

Actually this reminds me of a reply to an excellent intro to twisted 
clients thread which featured an imap client:


Ideally I guess the message's subject should be passed to the callback, 
as expected, and a method call should be triggered for the change in the 
messages status.

I've raised a bug for it: http://twistedmatrix.com/bugs/issue1105

Hope this is ok ..


More information about the Twisted-Python mailing list