]> code.delx.au - offlineimap/blobdiff - offlineimap/folder/IMAP.py
Revert "completed: * fixes behaviour when changing flags, without corresp. rights...
[offlineimap] / offlineimap / folder / IMAP.py
index df1b3297cb2afb9b125a3af827ceabc483ee6936..efba10c47fe8852ed7601cd3b411f19975007810 100644 (file)
@@ -368,6 +368,7 @@ class IMAPFolder(BaseFolder):
             try:
                 imapobj.select(self.getfullname())
             except imapobj.readonly:
+               # unsure, whether this can be reached
                 UIBase.getglobalui().flagstoreadonly(self, uidlist, flags)
                 return
             r = imapobj.uid('store',
@@ -391,9 +392,9 @@ class IMAPFolder(BaseFolder):
             if not ('UID' in attributehash and 'FLAGS' in attributehash):
                 # Compensate for servers that don't return a UID attribute.
                 continue
-            flags = attributehash['FLAGS']
+            lflags = attributehash['FLAGS']
             uid = long(attributehash['UID'])
-            self.messagelist[uid]['flags'] = imaputil.flagsimap2maildir(flags)
+            self.messagelist[uid]['flags'] = imaputil.flagsimap2maildir(lflags)
             try:
                 needupdate.remove(uid)
             except ValueError:          # Let it slide if it's not in the list
@@ -424,17 +425,12 @@ class IMAPFolder(BaseFolder):
         self.addmessagesflags_noconvert(uidlist, ['T'])
         imapobj = self.imapserver.acquireconnection()
         try:
-            # Making sure, that we have the necessary rights
-            # ensuring that we access readonly: python's braindead imaplib.py
-            # otherwise might raise an exception during the myrights() call
-            imapobj.select(self.getfullname(),readonly=1)
-            if not 'd' in imapobj.myrights(self.getfullname())[1][0].split()[1]:
-                # no delete/expunge rights
+            try:
+                imapobj.select(self.getfullname())
+            except imapobj.readonly:
                 UIBase.getglobalui().deletereadonly(self, uidlist)
                 return
-
             if self.expunge:
-                imapobj.select(self.getfullname())
                 assert(imapobj.expunge()[0] == 'OK')
         finally:
             self.imapserver.releaseconnection(imapobj)