Hello community,

here is the log from the commit of package archivemail for openSUSE:Factory
checked in at Thu Apr 21 13:22:24 CEST 2011.



--------
--- archivemail/archivemail.changes     2010-08-20 17:02:10.000000000 +0200
+++ /mounts/work_src_done/STABLE/archivemail/archivemail.changes        
2011-04-01 19:18:58.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Apr  1 17:17:56 UTC 2011 - [email protected]
+
+- update to version 0.8.2
+  * bugfixes
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


Old:
----
  archivemail-0.8.0.tar.gz

New:
----
  archivemail-0.8.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ archivemail.spec ++++++
--- /var/tmp/diff_new_pack.yziFGN/_old  2011-04-21 13:21:14.000000000 +0200
+++ /var/tmp/diff_new_pack.yziFGN/_new  2011-04-21 13:21:14.000000000 +0200
@@ -1,7 +1,7 @@
 #
-# spec file for package archivemail (Version 0.8.0)
+# spec file for package archivemail
 #
-# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
 
 Name:           archivemail
 BuildRequires:  python-devel
-Version:        0.8.0
+Version:        0.8.2
 Release:        1
 Group:          Productivity/Networking/Email/Utilities
 License:        GPLv2+

++++++ archivemail-0.8.0.tar.gz -> archivemail-0.8.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/archivemail-0.8.0/CHANGELOG 
new/archivemail-0.8.2/CHANGELOG
--- old/archivemail-0.8.0/CHANGELOG     2010-08-09 13:27:51.000000000 +0200
+++ new/archivemail-0.8.2/CHANGELOG     2010-10-16 18:57:45.000000000 +0200
@@ -1,3 +1,13 @@
+version 0.8.2   - 16 October 2010
+
+  * IMAP: don't prepend NAMESPACE prefix to INBOX and its children.
+    Closes: #3083236.
+
+version 0.8.1   - 30 September 2010
+
+  * IMAP: fixed handling of LIST replies by the server where the mailbox name
+    is not a quoted string. (Thanks Karsten Müller)
+
 Version 0.8.0   - 9 August 2010
 
   * Fixed date header parsing to be precise with timezone information.  Also,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/archivemail-0.8.0/PKG-INFO 
new/archivemail-0.8.2/PKG-INFO
--- old/archivemail-0.8.0/PKG-INFO      2010-08-09 13:38:25.000000000 +0200
+++ new/archivemail-0.8.2/PKG-INFO      2010-10-16 18:58:52.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: archivemail
-Version: 0.8.0
+Version: 0.8.2
 Summary: archive and compress old email
 Home-page: http://archivemail.sourceforge.net/
 Author: Nikolaus Schulz, Peter Poeml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/archivemail-0.8.0/archivemail 
new/archivemail-0.8.2/archivemail
--- old/archivemail-0.8.0/archivemail   2010-08-09 11:51:05.000000000 +0200
+++ new/archivemail-0.8.2/archivemail   2010-10-16 18:57:57.000000000 +0200
@@ -24,7 +24,7 @@
 """
 
 # global administrivia 
-__version__ = "archivemail v0.8.0"
+__version__ = "archivemail v0.8.2"
 __copyright__ = """\
 Copyright (C) 2002  Paul Rodger <[email protected]>
           (C) 2006  Peter Poeml <[email protected]>,
@@ -1410,6 +1410,21 @@
 
 ###############  IMAP  functions  ###############
 
+def imap_quote(astring):
+    """Quote an IMAP `astring' string (see RFC 3501, section "Formal 
Syntax")."""
+    if astring.startswith('"') and astring.endswith('"'):
+        quoted = astring
+    else:
+        quoted = '"' + astring.replace('\\', '\\\\').replace('"', '\\"') + '"'
+    return quoted
+
+def imap_unquote(quoted):
+    """Un-quote a `quoted' IMAP string (see RFC 3501, section "Formal 
Syntax")."""
+    if not (quoted.startswith('"') and quoted.endswith('"')):
+        unquoted = quoted
+    else:
+        unquoted = re.sub(r'\\(\\|")', r'\1', quoted[1:-1])
+    return unquoted
 
 def parse_imap_url(url): 
     """Parse IMAP URL and return username, password (if appliciable), 
servername
@@ -1462,7 +1477,7 @@
         "server says '%s'" % response[0])
 
     # Response should be a list of strings like 
-    # '(\\Noselect \\HasChildren) "." "boxname"'
+    # '(\\Noselect \\HasChildren) "." boxname'
     # We parse only the first list item and just grab the delimiter. 
     m = re.match(r'\([^\)]*\) (?P<delim>"."|NIL)', response[0])
     if not m: 
@@ -1505,7 +1520,7 @@
         vprint("examining imap folder '%s' read-only" % mailbox)
     else:
         vprint("selecting imap folder '%s'" % mailbox)
-    result, response = srv.select(mailbox, roflag)
+    result, response = srv.select(imap_quote(mailbox), roflag)
     if result != 'OK':
         unexpected_error("selecting '%s' failed; server says: '%s'." \
                 % (mailbox, response[0]))
@@ -1533,12 +1548,12 @@
             vprint("Looking for mailboxes matching '%s'..." % curbox)
         else:
             vprint("Looking for mailbox '%s'..." % curbox)
-        result, response = srv.list(pattern=curbox)
+        result, response = srv.list(pattern=imap_quote(curbox))
         if result != 'OK': 
             unexpected_error("LIST command failed; " \
                 "server says: '%s'" % response[0])
         # Say we queried for the mailbox "foo". 
-        # Upon success, response is e.g. ['(\\HasChildren) "." "foo"'].
+        # Upon success, response is e.g. ['(\\HasChildren) "." foo'].
         # Upon failure, response is [None].  Funky imaplib!
         if response[0] != None: 
             break
@@ -1546,8 +1561,22 @@
         user_error("Cannot find mailbox '%s' on server." % mailbox)
     mailboxes = []
     for mailbox_data in response:
-        m = re.match(r'\((.*?)\) "." "(.*?)"', mailbox_data)
-        attrs, name = m.groups()
+        if not mailbox_data:    # imaplib sometimes returns an empty string
+            continue
+        try:
+            m = re.match(r'\((.*?)\) (?:"."|NIL) (.+)', mailbox_data)
+        except TypeError:
+            # May be a literal.  For literals, imaplib returns a tuple like
+            # ('(\\HasNoChildren) "." {12}', 'with "quote"').
+            m = re.match(r'\((.*?)\) (?:"."|NIL) \{\d+\}$', mailbox_data[0])
+            if m is None:
+                unexpected_error("cannot parse LIST reply %s" %
+                        (mailbox_data,))
+            attrs = m.group(1)
+            name = mailbox_data[1]
+        else:
+            attrs, name = m.groups()
+            name = imap_unquote(name)
         if '\\noselect' in attrs.lower().split():
             vprint("skipping not selectable mailbox '%s'" % name)
             continue
@@ -1570,16 +1599,24 @@
         hdelim = imap_getdelim(srv)
     vprint("IMAP namespace prefix: '%s', hierarchy delimiter: '%s'" % \
             (nsprefix, hdelim))
-    if mailbox.startswith(nsprefix):
+    if mailbox.upper() == "INBOX" or \
+       (hdelim is not None and mailbox.upper().startswith("INBOX" + hdelim)):
+        # INBOX is not a real mailbox name, so namespace prefixes do not apply
+        # to INBOX and its children
+        boxnames = [mailbox]
+    elif mailbox.startswith(nsprefix):
         boxnames = [mailbox]
     else:
         boxnames = [nsprefix + mailbox]
     if os.path.sep in mailbox and hdelim is not None:
         mailbox = mailbox.replace(os.path.sep, hdelim)
-        if mailbox.startswith(nsprefix):
+        if mailbox.upper().startswith("INBOX" + hdelim):
             boxnames.append(mailbox)
-        if nsprefix: 
-            boxnames.append(nsprefix + mailbox)
+        else:
+            if mailbox.startswith(nsprefix):
+                boxnames.append(mailbox)
+            if nsprefix:
+                boxnames.append(nsprefix + mailbox)
     return boxnames
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/archivemail-0.8.0/setup.py 
new/archivemail-0.8.2/setup.py
--- old/archivemail-0.8.0/setup.py      2010-08-09 11:51:05.000000000 +0200
+++ new/archivemail-0.8.2/setup.py      2010-10-16 18:57:45.000000000 +0200
@@ -20,7 +20,7 @@
 from distutils.core import setup
 
 setup(name="archivemail",
-      version="0.8.0",
+      version="0.8.2",
       description="archive and compress old email",
       license="GNU GPL",
       url="http://archivemail.sourceforge.net/";,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/archivemail-0.8.0/test_archivemail 
new/archivemail-0.8.2/test_archivemail
--- old/archivemail-0.8.0/test_archivemail      2010-08-09 11:51:05.000000000 
+0200
+++ new/archivemail-0.8.2/test_archivemail      2010-09-30 22:27:50.000000000 
+0200
@@ -617,6 +617,26 @@
         archivemail.options.verbose = False
         archivemail.options.pwfile = None
 
+########## quoting and un-quoting of IMAP strings ##########
+
+class TestIMAPQuoting(unittest.TestCase):
+    stringlist = (
+            ('{braces} and space', '"{braces} and space"'),
+            ('\\backslash', '"\\\\backslash"'),
+            ('with "quotes" inbetween', '"with \\"quotes\\" inbetween"'),
+            ('ending with "quotes"', '"ending with \\"quotes\\""'),
+            ('\\"backslash before quote', '"\\\\\\"backslash before quote"')
+    )
+
+    def testQuote(self):
+        for unquoted, quoted in self.stringlist:
+            self.assertEqual(archivemail.imap_quote(unquoted), quoted)
+
+    def testUnquote(self):
+        for unquoted, quoted in self.stringlist:
+            self.assertEqual(unquoted, archivemail.imap_unquote(quoted))
+
+
 ########## acceptance testing ###########
 
 class TestArchive(TestCaseInTempdir):


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to