def get_header(self, msg, left): if self.config.optexpresion: aprint(_("Looking header %d (%s)") % (msg['orignumber'], self.alias), VIOLET) typ, data = self.objimap.fetch(msg['number'], '(BODY[HEADER])') if self.config.optv: print 'IMAP4: %s' % typ return data[0][1]
def make_list_real(self): optmax = self.config.optmax max_number = self.config.max_number optorder = self.config.optorder num = 0 aprint(_("Getting message list (%s)") % self.alias, CYAN) self.lmsg = [] if self.nummesg <= 0: return for msg in range(1, self.nummesg + 1): if not (optmax and (num > max_number)): num += 1 typ, data = self.objimap.fetch(msg, '(RFC822.SIZE)') if self.config.optv: print 'IMAP4: %s' % typ lst = data[0].split(' ') tmpd = {} tmpd['size'] = int(lst[2][:-1]) pok = int(msg) tmpd['number'] = pok tmpd['orignumber'] = pok self.insert_to_list(tmpd, optorder) self.server_bytes_left += tmpd['size'] else: aprint(_("Message number limit reached"), RED) return
def cleanup(self): aprint(_("Deleting already downloaded messages from IMAP4 server..."), YELLOW) self.objimap.expunge() self.objimap.logout() aprint(_("...done"), YELLOW) self.finished()
def serv_exit(self): if self.optdelete and self.some_deleted: aprint(_("Deleting marked messages..."), YELLOW) self.objimap.expunge() self.objimap.logout() self.finished() self.num_trans = 0
def connect(self): self.lmsg = [] if self.adress == '': raise ConfigError, _("Server address not given!!") if self.ssl: import imapslib try: self.objimap = imapslib.IMAP4S(self.adress, self.port) except socket.sslerror, err: aprint(_("SSL error while trying to connect to the server (%s), be sure that you have configured the correct port for IMAP4-SSL(usually 993)")%err,RED) exit() #Only exits thead
def get_header(self, nummsg, left): if self.config.optexpresion: aprint(_("Looking header %d (%s)") % (nummsg, self.alias), VIOLET) typ, data = self.objimap.fetch(nummsg, '(BODY[HEADER])') return data[0][1]