From c6c40bdf34a42d9d996e3e42bf70a235f3049ca1 Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Tue, 1 Oct 2002 19:57:56 +0100 Subject: [PATCH] /offlineimap/head: changeset 257 Added more debugging to the IMAP debug stream --- offlineimap/head/bin/offlineimap | 3 ++- offlineimap/head/debian/changelog | 1 + offlineimap/head/offlineimap/imaputil.py | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/offlineimap/head/bin/offlineimap b/offlineimap/head/bin/offlineimap index 36b19e1..3477d5a 100644 --- a/offlineimap/head/bin/offlineimap +++ b/offlineimap/head/bin/offlineimap @@ -17,7 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -from offlineimap import imaplib, imaputil, imapserver, repository, folder, mbnames, threadutil, version, localeval +from offlineimap import imaplib, imapserver, repository, folder, mbnames, threadutil, version, localeval from offlineimap.threadutil import InstanceLimitedThread, ExitNotifyThread from offlineimap.ui import UIBase import re, os, os.path, offlineimap, sys @@ -67,6 +67,7 @@ localeval = localeval.LocalEval(path) ui = offlineimap.ui.detector.findUI(config, localeval, options.get('-u')) ui.init_banner() + if '-d' in options: for debugtype in options['-d'].split(','): ui.add_debug(debugtype.strip()) diff --git a/offlineimap/head/debian/changelog b/offlineimap/head/debian/changelog index 92d30e8..afa6069 100644 --- a/offlineimap/head/debian/changelog +++ b/offlineimap/head/debian/changelog @@ -1,5 +1,6 @@ offlineimap (3.2.9) unstable; urgency=low + * imaputil.py now logs information with IMAP debugging is enabled. * Added folderfilter capability to mbnames recorder. You can now omit specified folders from the mbnames output. diff --git a/offlineimap/head/offlineimap/imaputil.py b/offlineimap/head/offlineimap/imaputil.py index eca38c3..c67e56b 100644 --- a/offlineimap/head/offlineimap/imaputil.py +++ b/offlineimap/head/offlineimap/imaputil.py @@ -18,17 +18,26 @@ import re, string quotere = re.compile('^("(?:[^"]|\\\\")*")') +import __main__ + +def debug(*args): + msg = [] + for arg in args: + msg.append(str(arg)) + __main__.ui.debug('imap', " ".join(msg)) def dequote(string): """Takes a string which may or may not be quoted and returns it, unquoted. This function does NOT consider parenthised lists to be quoted. """ + debug("dequote() called with input:", string) if not (string[0] == '"' and string[-1] == '"'): return string string = string[1:-1] # Strip off quotes. string = string.replace('\\"', '"') string = string.replace('\\\\', '\\') + debug("dequote() returning:", string) return string def flagsplit(string): @@ -37,11 +46,13 @@ def flagsplit(string): return imapsplit(string[1:-1]) def options2hash(list): + debug("options2hash called with input:", list) retval = {} counter = 0 while (counter < len(list)): retval[list[counter]] = list[counter + 1] counter += 2 + debug("options2hash returning:", retval) return retval def flags2hash(string): @@ -56,7 +67,8 @@ def imapsplit(imapstring): The result from parsing this will be: ['(\\HasNoChildren)', '"."', '"INBOX.Sent"']""" - + + debug("imapsplit() called with input:", imapstring) workstr = imapstring.strip() retval = [] while len(workstr): @@ -87,6 +99,7 @@ def imapsplit(imapstring): elif splitslen == 0: # There was not even an unquoted word. break + debug("imapsplit() returning:", retval) return retval def flagsimap2maildir(flagstring):