/head: changeset 18

Updated.
This commit is contained in:
jgoerzen
2002-06-20 08:40:29 +01:00
parent b179602b31
commit 3c199703c2
6 changed files with 101 additions and 9 deletions

View File

@ -31,14 +31,14 @@ class IMAPFolder(BaseFolder):
def getuidvalidity(self):
x = self.imapobj.status(self.getfullname(), ('UIDVALIDITY'))[1][0]
uidstring = imaputil.imapsplit(x)[1]
return int(imaputil.flagsplit(x)[1])
return long(imaputil.flagsplit(uidstring)[1])
def cachemessagelist(self):
assert(self.imapobj.select(self.getfullname())[0] == 'OK')
self.messagelist = {}
response = self.imapobj.status(self.getfullname(), ('MESSAGES'))[1][0]
result = imaputil.imapsplit(response)[1]
maxmsgid = int(imaputil.flags2hash(result)['MESSAGES'])
maxmsgid = long(imaputil.flags2hash(result)['MESSAGES'])
# Now, get the flags and UIDs for these.
response = self.imapobj.fetch('1:%d' % maxmsgid, '(FLAGS UID)')[1]
@ -46,5 +46,12 @@ class IMAPFolder(BaseFolder):
# Discard the message number.
messagestr = imaputil.imapsplit(messagestr)[1]
options = imaputil.flags2hash(messagestr)
uid = long(options['UID'])
flags = imaputil.flagsimap2maildir(options['FLAGS'])
self.messagelist[uid] = {'uid': uid, 'flags': flags}
def getmessagelist(self):
return self.messagelist

View File

@ -35,7 +35,7 @@ class MaildirFolder(BaseFolder):
if not os.path.exists(self.uidfilename):
return None
file = open(self.uidfilename, "rt")
retval = int(file.readline().strip())
retval = long(file.readline().strip())
file.close()
return retval
@ -75,7 +75,7 @@ class MaildirFolder(BaseFolder):
uid = nouidcounter
nouidcounter -= 1
else:
uid = int(uidmatch.group(1))
uid = long(uidmatch.group(1))
flagmatch = re.search(':.*2,([A-Z]+)')
flags = []
if flagmatch:
@ -107,7 +107,7 @@ class MaildirFolder(BaseFolder):
if attempts > 15:
raise IOError, "Couldn't write to file %s" % messagename
messagename = '%d.%d.%s,U=%d' % \
(int(time.time()),
(long(time.time()),
os.getpid(),
socket.gethostname(),
uid)