[PATCH v3] Don't pass a list to ui.copyingmessage()

Sebastian Spaeth Sebastian at SSpaeth.de
Tue Aug 16 11:26:55 BST 2011


We only copy to a single folder anyway, so clean up the code to only
pass in a single folder.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
This fixes the error that Nicolas was seeing (I was using 
Folder().getnicename() rather than UI().getnicename()). Sorry no 
interpatch diff available for this small change. I had the old patch 
already discarded. This fixes also the Machine UI which was left out
in the latest patch.

 offlineimap/folder/Base.py      |    2 +-
 offlineimap/ui/Blinkenlights.py |    4 ++--
 offlineimap/ui/Machine.py       |    8 ++++----
 offlineimap/ui/UIBase.py        |   11 ++++++-----
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py
index 3da0de1..48feaf5 100644
--- a/offlineimap/folder/Base.py
+++ b/offlineimap/folder/Base.py
@@ -244,7 +244,7 @@ class BaseFolder(object):
                 statusfolder.savemessage(uid, None, flags, rtime)
                 return
 
-            self.ui.copyingmessage(uid, self, [dstfolder])
+            self.ui.copyingmessage(uid, self, dstfolder)
             # If any of the destinations actually stores the message body,
             # load it up.
             if dstfolder.storesmessages():
diff --git a/offlineimap/ui/Blinkenlights.py b/offlineimap/ui/Blinkenlights.py
index 2160100..f0dfec1 100644
--- a/offlineimap/ui/Blinkenlights.py
+++ b/offlineimap/ui/Blinkenlights.py
@@ -54,9 +54,9 @@ class BlinkenBase:
         s.gettf().setcolor('blue')
         s.__class__.__bases__[-1].syncingmessages(s, sr, sf, dr, df)
 
-    def copyingmessage(s, uid, src, destlist):
+    def copyingmessage(s, uid, src, destfolder):
         s.gettf().setcolor('orange')
-        s.__class__.__bases__[-1].copyingmessage(s, uid, src, destlist)
+        s.__class__.__bases__[-1].copyingmessage(s, uid, src, destfolder)
 
     def deletingmessages(s, uidlist, destlist):
         s.gettf().setcolor('red')
diff --git a/offlineimap/ui/Machine.py b/offlineimap/ui/Machine.py
index 37b5e9b..708da55 100644
--- a/offlineimap/ui/Machine.py
+++ b/offlineimap/ui/Machine.py
@@ -108,10 +108,10 @@ class MachineUI(UIBase):
                 (s.getnicename(sr), sf.getname(), s.getnicename(dr),
                  df.getname()))
 
-    def copyingmessage(s, uid, src, destlist):
-        ds = s.folderlist(destlist)
-        s._printData('copyingmessage', "%d\n%s\n%s\n%s"  % \
-                (uid, s.getnicename(src), src.getname(), ds))
+    def copyingmessage(self, uid, src, destfolder):
+        self._printData('copyingmessage', "%d\n%s\n%s\n%s[%s]"  % \
+                (uid, self.getnicename(src), src.getname(),
+                 self.getnicename(destfolder), destfolder))
         
     def folderlist(s, list):
         return ("\f".join(["%s\t%s" % (s.getnicename(x), x.getname()) for x in list]))
diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py
index c08d34c..16e10bc 100644
--- a/offlineimap/ui/UIBase.py
+++ b/offlineimap/ui/UIBase.py
@@ -285,11 +285,12 @@ class UIBase:
                                                           s.getnicename(dr),
                                                           df.getname()))
 
-    def copyingmessage(s, uid, src, destlist):
-        if s.verbose >= 0:
-            ds = s.folderlist(destlist)
-            s._msg("Copy message %d %s[%s] -> %s" % (uid, s.getnicename(src),
-                                                     src.getname(), ds))
+    def copyingmessage(self, uid, src, destfolder):
+        """Output a log line stating which message we copy"""
+        if self.verbose >= 0:
+            self._msg("Copy message %d %s[%s] -> %s[%s]" % \
+                       (uid, self.getnicename(src), src, 
+                        self.getnicename(destfolder), destfolder))
 
     def deletingmessage(s, uid, destlist):
         if s.verbose >= 0:
-- 
1.7.4.1





More information about the OfflineIMAP-project mailing list