From: Krzysztof Oblucki email@example.com To: "firstname.lastname@example.org" <twisted- email@example.com> Sent: Monday, November 25, 2013 11:27 AM Subject: IMAP4 Proxy to add headers and modify body of an incoming message
Hello, I am trying to write an IMAP proxy to modify headers and the body of an incoming message using twisted. I am new to python and twisted so maybe this is why I either picked the wrong route or don't have the skills to get through some issues and I'm hoping that some you fine list members can point me in the right direction.
I started by using the IMAP4Client and IMAP4Server to do the proxying. However, I realized that in certain cases, the IMAP4Server requires synchronous results but since I need to do an async call using the client the handling is not working properly. I ran into this when implementing getFlags() in the IMessage and I am not sure how I can get out of this short of changing the IMAP4Server code to handle Deferreds.
Am I on the right track? Is imap4 lib the right tool for this job? If so, is modifying IMAP4Server to handle Deferreds the right thing to do? If not, what would you recommend?
Sounds like you diagnosed the problem correctly. IMAP4Server needs to handle Deferreds here and doesn't currently.