[PATCH 1/5] Remove custom Gmail/folder/processmessagesflags()

Sebastian Spaeth Sebastian at SSpaeth.de
Sun Aug 14 09:42:17 BST 2011


This function was overridden as the IMAP version apparently had been
using imapobj.myrights() at some point in time, which was not
implemented in the Gmail version. However, IMAP is not using myrights()
anymore, and as that is an extension that needs to be advertised in
CAPABILITIES we should not unconditionally use it anyway.

So remove the function that is identical to it's ancestor's
function.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 offlineimap/folder/Gmail.py |   54 -------------------------------------------
 1 files changed, 0 insertions(+), 54 deletions(-)

diff --git a/offlineimap/folder/Gmail.py b/offlineimap/folder/Gmail.py
index 2a82833..7cbff4f 100644
--- a/offlineimap/folder/Gmail.py
+++ b/offlineimap/folder/Gmail.py
@@ -65,57 +65,3 @@ class GmailFolder(IMAPFolder):
                 del self.messagelist[uid]
         else:
             IMAPFolder.deletemessages_noconvert(self, uidlist)
-            
-    def processmessagesflags(self, operation, uidlist, flags):
-        # XXX: the imapobj.myrights(...) calls dies with an error
-        # report from Gmail server stating that IMAP command
-        # 'MYRIGHTS' is not implemented.  So, this
-        # `processmessagesflags` is just a copy from `IMAPFolder`,
-        # with the references to `imapobj.myrights()` deleted This
-        # shouldn't hurt, however, Gmail users always have full
-        # control over all their mailboxes (apparently).
-        if len(uidlist) > 101:
-            # Hack for those IMAP ervers with a limited line length
-            self.processmessagesflags(operation, uidlist[:100], flags)
-            self.processmessagesflags(operation, uidlist[100:], flags)
-            return
-        
-        imapobj = self.imapserver.acquireconnection()
-        try:
-            imapobj.select(self.getfullname())
-            r = imapobj.uid('store',
-                            imaputil.listjoin(uidlist),
-                            operation + 'FLAGS',
-                            imaputil.flagsmaildir2imap(flags))
-            assert r[0] == 'OK', 'Error with store: ' + '. '.join(r[1])
-            r = r[1]
-        finally:
-            self.imapserver.releaseconnection(imapobj)
-
-        needupdate = copy(uidlist)
-        for result in r:
-            if result == None:
-                # Compensate for servers that don't return anything from
-                # STORE.
-                continue
-            attributehash = imaputil.flags2hash(imaputil.imapsplit(result)[1])
-            if not ('UID' in attributehash and 'FLAGS' in attributehash):
-                # Compensate for servers that don't return a UID attribute.
-                continue
-            flags = attributehash['FLAGS']
-            uid = long(attributehash['UID'])
-            self.messagelist[uid]['flags'] = imaputil.flagsimap2maildir(flags)
-            try:
-                needupdate.remove(uid)
-            except ValueError:          # Let it slide if it's not in the list
-                pass
-        for uid in needupdate:
-            if operation == '+':
-                for flag in flags:
-                    if not flag in self.messagelist[uid]['flags']:
-                        self.messagelist[uid]['flags'].append(flag)
-                    self.messagelist[uid]['flags'].sort()
-            elif operation == '-':
-                for flag in flags:
-                    if flag in self.messagelist[uid]['flags']:
-                        self.messagelist[uid]['flags'].remove(flag)
-- 
1.7.4.1





More information about the OfflineIMAP-project mailing list