/offlineimap/head: changeset 257
Added more debugging to the IMAP debug stream
This commit is contained in:
		| @@ -17,7 +17,7 @@ | |||||||
| #    along with this program; if not, write to the Free Software | #    along with this program; if not, write to the Free Software | ||||||
| #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | #    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.threadutil import InstanceLimitedThread, ExitNotifyThread | ||||||
| from offlineimap.ui import UIBase | from offlineimap.ui import UIBase | ||||||
| import re, os, os.path, offlineimap, sys | 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 = offlineimap.ui.detector.findUI(config, localeval, options.get('-u')) | ||||||
| ui.init_banner() | ui.init_banner() | ||||||
|  |  | ||||||
|  |  | ||||||
| if '-d' in options: | if '-d' in options: | ||||||
|     for debugtype in options['-d'].split(','): |     for debugtype in options['-d'].split(','): | ||||||
|         ui.add_debug(debugtype.strip()) |         ui.add_debug(debugtype.strip()) | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| offlineimap (3.2.9) unstable; urgency=low | 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 |   * Added folderfilter capability to mbnames recorder.  You can now omit | ||||||
|     specified folders from the mbnames output. |     specified folders from the mbnames output. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -18,17 +18,26 @@ | |||||||
|  |  | ||||||
| import re, string | import re, string | ||||||
| quotere = re.compile('^("(?:[^"]|\\\\")*")') | 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): | def dequote(string): | ||||||
|     """Takes a string which may or may not be quoted and returns it, unquoted. |     """Takes a string which may or may not be quoted and returns it, unquoted. | ||||||
|     This function does NOT consider parenthised lists to be quoted. |     This function does NOT consider parenthised lists to be quoted. | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
|  |     debug("dequote() called with input:", string) | ||||||
|     if not (string[0] == '"' and string[-1] == '"'): |     if not (string[0] == '"' and string[-1] == '"'): | ||||||
|         return string |         return string | ||||||
|     string = string[1:-1]               # Strip off quotes. |     string = string[1:-1]               # Strip off quotes. | ||||||
|     string = string.replace('\\"', '"') |     string = string.replace('\\"', '"') | ||||||
|     string = string.replace('\\\\', '\\') |     string = string.replace('\\\\', '\\') | ||||||
|  |     debug("dequote() returning:", string) | ||||||
|     return string |     return string | ||||||
|  |  | ||||||
| def flagsplit(string): | def flagsplit(string): | ||||||
| @@ -37,11 +46,13 @@ def flagsplit(string): | |||||||
|     return imapsplit(string[1:-1]) |     return imapsplit(string[1:-1]) | ||||||
|  |  | ||||||
| def options2hash(list): | def options2hash(list): | ||||||
|  |     debug("options2hash called with input:", list) | ||||||
|     retval = {} |     retval = {} | ||||||
|     counter = 0 |     counter = 0 | ||||||
|     while (counter < len(list)): |     while (counter < len(list)): | ||||||
|         retval[list[counter]] = list[counter + 1] |         retval[list[counter]] = list[counter + 1] | ||||||
|         counter += 2 |         counter += 2 | ||||||
|  |     debug("options2hash returning:", retval) | ||||||
|     return retval |     return retval | ||||||
|  |  | ||||||
| def flags2hash(string): | def flags2hash(string): | ||||||
| @@ -56,7 +67,8 @@ def imapsplit(imapstring): | |||||||
|     The result from parsing this will be: |     The result from parsing this will be: | ||||||
|  |  | ||||||
|     ['(\\HasNoChildren)', '"."', '"INBOX.Sent"']""" |     ['(\\HasNoChildren)', '"."', '"INBOX.Sent"']""" | ||||||
|      |  | ||||||
|  |     debug("imapsplit() called with input:", imapstring) | ||||||
|     workstr = imapstring.strip() |     workstr = imapstring.strip() | ||||||
|     retval = [] |     retval = [] | ||||||
|     while len(workstr): |     while len(workstr): | ||||||
| @@ -87,6 +99,7 @@ def imapsplit(imapstring): | |||||||
|             elif splitslen == 0: |             elif splitslen == 0: | ||||||
|                 # There was not even an unquoted word. |                 # There was not even an unquoted word. | ||||||
|                 break |                 break | ||||||
|  |     debug("imapsplit() returning:", retval) | ||||||
|     return retval |     return retval | ||||||
|              |              | ||||||
| def flagsimap2maildir(flagstring): | def flagsimap2maildir(flagstring): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jgoerzen
					jgoerzen