[PATCHv2 3/3] Don't pass list to ui.adding/deletingflags

Sebastian Spaeth Sebastian at SSpaeth.de
Sun Mar 6 08:52:03 GMT 2011


We only have one "dstfolder" at a time when deleting/adding flags, so no need to pass in a list of those to the ui functions that output the log info.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 offlineimap/folder/Base.py      |    4 ++--
 offlineimap/ui/Blinkenlights.py |    8 ++++----
 offlineimap/ui/Machine.py       |   10 ++++------
 offlineimap/ui/UIBase.py        |   13 ++++++-------
 4 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py
index 8e73868..27ad1aa 100644
--- a/offlineimap/folder/Base.py
+++ b/offlineimap/folder/Base.py
@@ -417,12 +417,12 @@ class BaseFolder:
                 delflaglist[flag].append(uid)
 
         for flag in addflaglist.keys():
-            self.ui.addingflags(addflaglist[flag], flag, [dstfolder])
+            self.ui.addingflags(addflaglist[flag], flag, dstfolder)
             dstfolder.addmessagesflags(addflaglist[flag], [flag])
             statusfolder.addmessagesflags(addflaglist[flag], [flag])
 
         for flag in delflaglist.keys():
-            self.ui.deletingflags(delflaglist[flag], flag, [dstfolder])
+            self.ui.deletingflags(delflaglist[flag], flag, dstfolder)
             dstfolder.deletemessagesflags(delflaglist[flag], [flag])
             statusfolder.deletemessagesflags(delflaglist[flag], [flag])
                 
diff --git a/offlineimap/ui/Blinkenlights.py b/offlineimap/ui/Blinkenlights.py
index 08303a4..2f11aa4 100644
--- a/offlineimap/ui/Blinkenlights.py
+++ b/offlineimap/ui/Blinkenlights.py
@@ -66,13 +66,13 @@ class BlinkenBase:
         s.gettf().setcolor('red')
         s.__class__.__bases__[-1].deletingmessage(s, uid, destlist)
 
-    def addingflags(s, uidlist, flags, destlist):
+    def addingflags(s, uidlist, flags, dest):
         s.gettf().setcolor('yellow')
-        s.__class__.__bases__[-1].addingflags(s, uidlist, flags, destlist)
+        s.__class__.__bases__[-1].addingflags(s, uidlist, flags, dest)
 
-    def deletingflags(s, uidlist, flags, destlist):
+    def deletingflags(s, uidlist, flags, dest):
         s.gettf().setcolor('pink')
-        s.__class__.__bases__[-1].deletingflags(s, uidlist, flags, destlist)
+        s.__class__.__bases__[-1].deletingflags(s, uidlist, flags, dest)
 
     def warn(s, msg, minor = 0):
         if minor:
diff --git a/offlineimap/ui/Machine.py b/offlineimap/ui/Machine.py
index e5988e5..192c77b 100644
--- a/offlineimap/ui/Machine.py
+++ b/offlineimap/ui/Machine.py
@@ -124,17 +124,15 @@ class MachineUI(UIBase):
         ds = s.folderlist(destlist)
         s._printData('deletingmessages', "%s\n%s" % (s.uidlist(uidlist), ds))
 
-    def addingflags(s, uidlist, flags, destlist):
-        ds = s.folderlist(destlist)
+    def addingflags(s, uidlist, flags, dest):
         s._printData("addingflags", "%s\n%s\n%s" % (s.uidlist(uidlist),
                                                     "\f".join(flags),
-                                                    ds))
+                                                    dest))
 
-    def deletingflags(s, uidlist, flags, destlist):
-        ds = s.folderlist(destlist)
+    def deletingflags(s, uidlist, flags, dest):
         s._printData('deletingflags', "%s\n%s\n%s" % (s.uidlist(uidlist),
                                                       "\f".join(flags),
-                                                      ds))
+                                                      dest))
 
     def threadException(s, thread):
         print s.getThreadExceptionString(thread)
diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py
index 6621a62..6c3953c 100644
--- a/offlineimap/ui/UIBase.py
+++ b/offlineimap/ui/UIBase.py
@@ -257,17 +257,16 @@ class UIBase:
                     ", ".join([str(u) for u in uidlist]),
                     ds))
 
-    def addingflags(s, uidlist, flags, destlist):
+    def addingflags(s, uidlist, flags, dest):
         if s.verbose >= 0:
-            ds = s.folderlist(destlist)
-            s._msg("Adding flags %s to %d messages  on %s" % \
-                   (", ".join(flags), len(uidlist), ds))
+            s._msg("Adding flag %s to %d messages on %s" % \
+                   (", ".join(flags), len(uidlist), dest))
 
-    def deletingflags(s, uidlist, flags, destlist):
+    def deletingflags(s, uidlist, flags, dest):
         if s.verbose >= 0:
             ds = s.folderlist(destlist)
-            s._msg("Deleting flags %s to %d messages on %s" % \
-                   (", ".join(flags), len(uidlist), ds))
+            s._msg("Deleting flag %s from %d messages on %s" % \
+                   (", ".join(flags), len(uidlist), dest))
 
     ################################################## Threads
 
-- 
1.7.1





More information about the OfflineIMAP-project mailing list