<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hello,</div><div>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.</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">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.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">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?</div></div></body></html>