asyncio
inpos 2016-05-29 17:07:41 +03:00
parent 1378cef1f5
commit 5ab9b0c9cf
1 changed files with 11 additions and 12 deletions

View File

@ -224,19 +224,18 @@ class IMAPMailbox(ExtendedMaildir):
return d
def expunge(self):
self.__load_flags_()
uids = []
with SqliteDict(self.path_msg_info) as msg_info:
for path in self.__msg_list_():
fn = path.split('/')[-1]
if fn not in self.flags['uid']:
if fn not in msg_info.keys():
continue
uid = self.flags['uid'][fn]
if misc.IMAP_FLAGS['DELETED'] in self.flags['flags'][fn]:
uid = msg_info[fn]['uid']
if misc.IMAP_FLAGS['DELETED'] in msg_info[fn]['flags']:
os.remove(path)
del self.flags['uid'][fn]
del self.flags['flags'][fn]
self._save_flags()
del msg_info[fn]
uids.append(uid)
msg_info.commit()
return uids
def addListener(self, listener):