/offlineimap/head: changeset 274

This commit is contained in:
jgoerzen 2002-10-30 05:26:49 +01:00
parent 4ab770bb3d
commit 3c395c66a9
4 changed files with 24 additions and 9 deletions

View File

@ -78,9 +78,14 @@ class IMAPFolder(BaseFolder):
# Discard the message number. # Discard the message number.
messagestr = string.split(messagestr, maxsplit = 1)[1] messagestr = string.split(messagestr, maxsplit = 1)[1]
options = imaputil.flags2hash(messagestr) options = imaputil.flags2hash(messagestr)
uid = long(options['UID']) if not options.has_key('UID'):
flags = imaputil.flagsimap2maildir(options['FLAGS']) UIBase.getglobalui().warn('No UID in message with options %s' %\
self.messagelist[uid] = {'uid': uid, 'flags': flags} str(options),
minor = 1)
else:
uid = long(options['UID'])
flags = imaputil.flagsimap2maildir(options['FLAGS'])
self.messagelist[uid] = {'uid': uid, 'flags': flags}
def getmessagelist(self): def getmessagelist(self):
return self.messagelist return self.messagelist

View File

@ -26,8 +26,11 @@ class Basic(UIBase):
def _msg(s, msg): def _msg(s, msg):
print msg print msg
def warn(s, msg): def warn(s, msg, minor = 0):
sys.stderr.write("WARNING: " + str(msg) + "\n") warntxt = 'WARNING'
if minor:
warntxt = 'warning'
sys.stderr.write(warntxt + ": " + str(msg) + "\n")
def sleep(s, sleepsecs): def sleep(s, sleepsecs):
if s.verbose >= 0: if s.verbose >= 0:

View File

@ -236,8 +236,12 @@ class VerboseUI(UIBase):
s.top = None s.top = None
TextOKDialog("Main Program Exception", exceptionstr) TextOKDialog("Main Program Exception", exceptionstr)
def warn(s, msg): def warn(s, msg, minor):
TextOKDialog("OfflineIMAP Warning", msg) if minor:
# Just let the default handler catch it
UIBase.warn(s, msg, minor)
else:
TextOKDialog("OfflineIMAP Warning", msg)
def showlicense(s): def showlicense(s):
TextOKDialog(version.productname + " License", TextOKDialog(version.productname + " License",

View File

@ -44,8 +44,11 @@ class UIBase:
"""Generic tool called when no other works.""" """Generic tool called when no other works."""
raise NotImplementedError raise NotImplementedError
def warn(s, msg): def warn(s, msg, minor = 0):
s._msg("WARNING: " + msg) if minor:
s._msg("warning: " + msg)
else:
s._msg("WARNING: " + msg)
def debug(s, debugtype, msg): def debug(s, debugtype, msg):
thisthread = threading.currentThread() thisthread = threading.currentThread()