From 09828a9d4fba20f957c4ef010a044c78b8b26d42 Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Fri, 3 Jan 2003 03:05:14 +0100 Subject: [PATCH] /offlineimap/head: changeset 293 Now properly handles folder names that contain parenthesis. Used patch from Kyler Laird in http://bugs.debian.org/cgi- bin/bugreport.cgi?bug=173895. Closes: #173895. --- offlineimap/head/debian/changelog | 4 ++++ offlineimap/head/offlineimap/imaputil.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/offlineimap/head/debian/changelog b/offlineimap/head/debian/changelog index 2cd1a7e..69bf076 100644 --- a/offlineimap/head/debian/changelog +++ b/offlineimap/head/debian/changelog @@ -1,6 +1,10 @@ offlineimap (3.99.6) unstable; urgency=low * Beginnings of work to make it work with a threaded Tcl/Tk Tkinter. + * Now properly handles folder names that contain parenthesis. Used + patch from Kyler Laird in + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=173895. + Closes: #173895. -- John Goerzen Thu, 2 Jan 2003 13:59:44 -0600 diff --git a/offlineimap/head/offlineimap/imaputil.py b/offlineimap/head/offlineimap/imaputil.py index e906b29..b533daf 100644 --- a/offlineimap/head/offlineimap/imaputil.py +++ b/offlineimap/head/offlineimap/imaputil.py @@ -112,8 +112,14 @@ def imapsplit(imapstring): retval = [] while len(workstr): if workstr[0] == '(': - # Needs rindex to properly process eg (FLAGS () UID 123) - rpareni = workstr.rindex(')') + 1 + rparenc = 1 # count of right parenthesis to match + rpareni = 1 # position to examine + while rparenc: # Find the end of the group. + if workstr[rpareni] == ')': # end of a group + rparenc -= 1 + elif workstr[rpareni] == '(': # start of a group + rparenc += 1 + rpareni += 1 # Move to next character. parenlist = workstr[0:rpareni] workstr = workstr[rpareni:].lstrip() retval.append(parenlist)