def loadAllMessages(self, num=None): resp, messageList, messageSize = self.getAllMessages() parser = Parser() headerList = [parser.parseHeader(header) for header in messageList] fromList = [ parser.splitAddrHeader(header.get("From", "<Unknow>")) for header in headerList ] toList = [ parser.splitAddrHeader(header.get("To", "<Unknow>")) for header in headerList ] subjList = [ parser.decodeHeader(header.get("Subject", "<Unknow>")) for header in headerList ] dateList = [header.get("Date", "<Unknow>") for header in headerList] #dateList = [ parser.paseDate(header.get("Date", "<Unknow>")) for header in headerList] self.indexList = [hdr[:33].rstrip() for hdr in fromList] self.indexList.reverse() self.outputLineNum = len(self.indexList) messageList = [parser.parseMessage(message) for message in messageList] messageList = [parser.findText(message)[1] for message in messageList] count = self.outputLineNum for (subj, frm, to, date, msg) in zip(subjList, fromList, toList, dateList, messageList): messageDict[count] = [subj, frm, to, date, msg] count -= 1
def loadAllHeaders(self): resp, headerList, headerSize = self.getAllHeaders() parser = Parser() headerList = [parser.parseHeader(header) for header in headerList] headerList = [ parser.splitAddrHeader(header.get('From', '<Unknow>')) for header in headerList ] self.headerLine = [hdr[:30].rstrip() for hdr in headerList] self.outputLineNum = len(self.headerLine)
def Reply(self): linenum = self.topLineNum + self.hightlightLineNum + 1 addr = messageDict[linenum] addr = Parser().getAddress(addr)