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 return d
def expunge(self): def expunge(self):
self.__load_flags_()
uids = [] uids = []
for path in self.__msg_list_(): with SqliteDict(self.path_msg_info) as msg_info:
fn = path.split('/')[-1] for path in self.__msg_list_():
if fn not in self.flags['uid']: fn = path.split('/')[-1]
continue if fn not in msg_info.keys():
uid = self.flags['uid'][fn] continue
if misc.IMAP_FLAGS['DELETED'] in self.flags['flags'][fn]: uid = msg_info[fn]['uid']
os.remove(path) if misc.IMAP_FLAGS['DELETED'] in msg_info[fn]['flags']:
del self.flags['uid'][fn] os.remove(path)
del self.flags['flags'][fn] del msg_info[fn]
self._save_flags() uids.append(uid)
uids.append(uid) msg_info.commit()
return uids return uids
def addListener(self, listener): def addListener(self, listener):