IMAP fetchSpecific should allow returning FLAGS

[email protected] Tue, 20 Oct 2009 10:27:45 -0000
Newsgroups gmane.comp.python.twisted.bugs
Message-ID <[email protected]>
New submission from colin <[email protected]>:

I envisage no situation on earth where someone would not want FLAGS returned, and fetchSpecific looks like the most handy way to do listings. The inability here to request FLAGS makes serious complications. 

{{{
+++ imap4.py    2009-10-20 15:42:26.000000000 +0200
@@ -3377,7 +3377,7 @@

     def fetchSpecific(self, messages, uid=0, headerType=None,
                       headerNumber=None, headerArgs=None, peek=None,
-                      offset=None, length=None):
+                      offset=None, length=None, flags=0):
         """Retrieve a specific section of one or more messages

         @type messages: C{MessageSet} or C{str}
@@ -3417,12 +3417,19 @@
         @type length: C{int}
         @param length: The number of octets to retrieve.

+        @type flags: C{bool}
+        @param flags: Return FLAGS with the result
+
         @rtype: C{Deferred}
         @return: A deferred whose callback is invoked with a mapping of
         message numbers to retrieved data, or whose errback is invoked
         if there is an error.
         """
-        fmt = '%s BODY%s[%s%s%s]%s'
+        if flags:
+            fmt = '%s (FLAGS BODY%s[%s%s%s]%s)'
+        else:
+            fmt = '%s BODY%s[%s%s%s]%s'
+
         if headerNumber is None:
             number = ''
         elif isinstance(headerNumber, types.IntType):
}}}

----------
Type     : enhancement
Component: mail
Keywords : pleasefortheloveofgodmergethis
Priority : normal
Nosy     : 
----------
http://twistedmatrix.com/trac/ticket/4062