/head: changeset 89
Another attempt at the read-only bug
This commit is contained in:
parent
a6f5b1da98
commit
bd9873632c
@ -46,29 +46,23 @@ class IMAPFolder(BaseFolder):
|
|||||||
def getuidvalidity(self):
|
def getuidvalidity(self):
|
||||||
imapobj = self.imapserver.acquireconnection()
|
imapobj = self.imapserver.acquireconnection()
|
||||||
x = None
|
x = None
|
||||||
|
readonlysave = imapobj.is_readonly
|
||||||
|
imapobj.is_readonly = 1
|
||||||
try:
|
try:
|
||||||
try:
|
x = imapobj.status(self.getfullname(), '(UIDVALIDITY)')[1][0]
|
||||||
x = imapobj.status(self.getfullname(), '(UIDVALIDITY)')[1][0]
|
|
||||||
except imapobj.readonly:
|
|
||||||
x = imapobj.status(self.getfullname(), '(UIDVALIDITY)')[1][0]
|
|
||||||
finally:
|
finally:
|
||||||
self.imapserver.releaseconnection(imapobj)
|
self.imapserver.releaseconnection(imapobj)
|
||||||
|
imapobj.is_readonly = readonlysave
|
||||||
uidstring = imaputil.imapsplit(x)[1]
|
uidstring = imaputil.imapsplit(x)[1]
|
||||||
return long(imaputil.flagsplit(uidstring)[1])
|
return long(imaputil.flagsplit(uidstring)[1])
|
||||||
|
|
||||||
def cachemessagelist(self):
|
def cachemessagelist(self):
|
||||||
imapobj = self.imapserver.acquireconnection()
|
imapobj = self.imapserver.acquireconnection()
|
||||||
try:
|
try:
|
||||||
try:
|
# Needed for fetch below
|
||||||
imapobj.select(self.getfullname()) # Needed for fetch below
|
imapobj.select(self.getfullname(), readonly = 1)
|
||||||
except imapobj.readonly:
|
|
||||||
pass
|
|
||||||
self.messagelist = {}
|
self.messagelist = {}
|
||||||
response = None
|
response = imapobj.status(self.getfullname(), '(MESSAGES)')[1][0]
|
||||||
try:
|
|
||||||
response = imapobj.status(self.getfullname(), '(MESSAGES)')[1][0]
|
|
||||||
except imapobj.readonly:
|
|
||||||
response = imapobj.status(self.getfullname(), '(MESSAGES)')[1][0]
|
|
||||||
result = imaputil.imapsplit(response)[1]
|
result = imaputil.imapsplit(response)[1]
|
||||||
maxmsgid = long(imaputil.flags2hash(result)['MESSAGES'])
|
maxmsgid = long(imaputil.flags2hash(result)['MESSAGES'])
|
||||||
if (maxmsgid < 1):
|
if (maxmsgid < 1):
|
||||||
@ -93,10 +87,7 @@ class IMAPFolder(BaseFolder):
|
|||||||
def getmessage(self, uid):
|
def getmessage(self, uid):
|
||||||
imapobj = self.imapserver.acquireconnection()
|
imapobj = self.imapserver.acquireconnection()
|
||||||
try:
|
try:
|
||||||
try:
|
imapobj.select(self.getfullname(), readonly = 1)
|
||||||
imapobj.select(self.getfullname())
|
|
||||||
except imapobj.readonly:
|
|
||||||
pass
|
|
||||||
return imapobj.uid('fetch', '%d' % uid, '(BODY.PEEK[])')[1][0][1].replace("\r\n", "\n")
|
return imapobj.uid('fetch', '%d' % uid, '(BODY.PEEK[])')[1][0][1].replace("\r\n", "\n")
|
||||||
finally:
|
finally:
|
||||||
self.imapserver.releaseconnection(imapobj)
|
self.imapserver.releaseconnection(imapobj)
|
||||||
|
Loading…
Reference in New Issue
Block a user