/offlineimap/head: changeset 257

Added more debugging to the IMAP debug stream
This commit is contained in:
jgoerzen 2002-10-01 19:57:56 +01:00
parent 24cb7f76c2
commit c6c40bdf34
3 changed files with 17 additions and 2 deletions

View File

@ -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())

View File

@ -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.

View File

@ -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):
@ -57,6 +68,7 @@ def imapsplit(imapstring):
['(\\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):