def update(self): """""" self.switchFileAccount(self.conf.profile) try: if self.idx != None : if not isinstance(self.idx,bytes): self.idx = Io.bytes(self.idx) self.delids.append(self.idx) except Exception as e : Sys.dprint('error : ') Sys.dprint(e) self.index.fixDuplicateIds() #~ self.index.fixAccount('gmail5') self.index.encrypt() msgIndex = self.mb.buildIndex(self.pathIdx) _, self.idx = self.ih.send(msgIndex.as_string(), self.rootBox) date = self.ih.headerField(self.idx, 'date', True) self.conf.sets((['uid' , self.idx , 'index'], ['date' , date , 'index'], ['time' , str(Sys.datetime.now()), 'index'])) Sys.pwlog([(' Index updated (' , Const.CLZ_0), (str(int(self.idx)) , Const.CLZ_2), (') ' , Const.CLZ_0), (str(date) , Const.CLZ_7, True)]) try : self.ih.delete(self.delids, True) except : Sys.dprint('error : ') Sys.dprint(e) self.ih.clearTrash() return True
def initBoxNames(self): """""" status, resp = self.cnx.xlist() if status == self.OK : bdef, bname, c = None, None, None for c in resp : bdef, bname = c[1:-1].split(b') "/" "') if bdef == Io.bytes(self.NO_SELECT+' '+self.CHILDREN) : self.BOXS['/'] = Io.str(bname) elif bdef == Io.bytes(self.NO_CHILDREN+' '+self.INBOX) : self.BOXS[self.INBOX] = self.INBOX[1:].upper() elif bdef == Io.bytes(self.NO_CHILDREN+' '+self.DRAFTS) : self.BOXS[self.DRAFTS] = Io.str(bname) elif bdef == Io.bytes(self.NO_CHILDREN+' '+self.TRASH) : self.BOXS[self.TRASH] = Io.str(bname) elif bdef == Io.bytes(self.NO_CHILDREN+' '+self.SENT) : self.BOXS[self.SENT] = Io.str(bname) else : self.BOXS = { '/' : '/', self.INBOX : self.INBOX[1:].upper(), self.DRAFTS : self.DRAFTS[1:], self.TRASH : self.TRASH[1:], self.SENT : self.SENT[1:] }
def remove(self): """""" self._getId() try: if self.idx!= None : self.delids.append(Io.bytes(self.idx)) self.ih.delete(self.delids, True) self.idx = None except Exception as e : Sys.dprint('error : ') Sys.dprint(e) self.ih.clearTrash() self.removeLocal()
def checkSendIds(self, sendIds, subject): """""" lloc = [Io.bytes(str(data[0])) for mid, data in enumerate(sendIds)] lsrv = self.idxu.ih.searchBySubject(subject, True) return [int(i) for i in set(lloc).difference(set(lsrv))]