Ejemplo n.º 1
0
    def update(self):
        SMTPEmailAccount.update(self)
        info('starting timeout timer')
        self.timeouttimer.start()

        self.real_update(success = self.finish_update,
                         error   = self.on_error)
Ejemplo n.º 2
0
    def delete(self, msg):
        SMTPEmailAccount.delete(self, msg)
        conn = self.conn

        if self.uidlworks:
            uidl = conn.uidl()
            #check if response is ok
            mids = [mid for mid, uid in
                    [tuple(tup.split()) for tup in uidl[1]]
                    if uid == msg.id]
            if mids:
                mid = mids[0]
                conn.dele(mid)
        else:
            hash, msgid, _ = msg.id.split("SHA")
            newmsg = conn.retr(msgid)
            #check if response is ok
            newstring = "\n".join(newmsg[1])
            newhash = sha1(newstring).hexdigest()
            if hash == newhash:
                conn.dele(msgid)
            else:
                num_emails, box_size = conn.stat()
                num_emails = int(num_emails)
                for i in xrange(num_emails):
                    emailhash = sha1("\n".join(conn.retr(str(i))[1])).hexdigest()
                    if hash == emailhash:
                        conn.dele(msgid)
                        break
Ejemplo n.º 3
0
    def delete(self, msg):
        SMTPEmailAccount.delete(self, msg)
        conn = self.conn

        if self.uidlworks:
            uidl = conn.uidl()
            #check if response is ok
            mids = [
                mid for mid, uid in [tuple(tup.split()) for tup in uidl[1]]
                if uid == msg.id
            ]
            if mids:
                mid = mids[0]
                conn.dele(mid)
        else:
            hash, msgid, _ = msg.id.split("SHA")
            newmsg = conn.retr(msgid)
            #check if response is ok
            newstring = "\n".join(newmsg[1])
            newhash = sha1(newstring).hexdigest()
            if hash == newhash:
                conn.dele(msgid)
            else:
                num_emails, box_size = conn.stat()
                num_emails = int(num_emails)
                for i in xrange(num_emails):
                    emailhash = sha1("\n".join(conn.retr(
                        str(i))[1])).hexdigest()
                    if hash == emailhash:
                        conn.dele(msgid)
                        break
Ejemplo n.º 4
0
    def __init__(self, **options):
        d = self.default
        self.popserver   = options.get('popserver', '')
        self.require_ssl = options.get('require_ssl', d('require_ssl'))
        self.popport     = options.get('popport', d('popport'))
        self.uidlworks   = None
        self.topworks    = True #assume it does until proven otherwise

        self.cmdq = CommandQueue(start_hooks=[self._connect], end_hooks=[self._quit])
        self.timeouttimer = ResetTimer(pref('pop.timeout',self.default_timeout), self.timeout_check)

        SMTPEmailAccount.__init__(self, **options)
Ejemplo n.º 5
0
    def __init__(self, **options):
        d = self.default
        self.popserver = options.get('popserver', '')
        self.require_ssl = options.get('require_ssl', d('require_ssl'))
        self.popport = options.get('popport', d('popport'))
        self.uidlworks = None
        self.topworks = True  #assume it does until proven otherwise

        self.cmdq = CommandQueue(start_hooks=[self._connect],
                                 end_hooks=[self._quit])
        self.timeouttimer = ResetTimer(
            pref('pop.timeout', self.default_timeout), self.timeout_check)

        SMTPEmailAccount.__init__(self, **options)
Ejemplo n.º 6
0
    def __init__(self, **options):
        d = self.default
        log.info("imap options: %r", options)
        self.imapserver   = options.get('imapserver')
        self.require_ssl  = options.get('require_ssl', d('require_ssl'))
        self.imapport     = options.get('imapport', d('default_ssl_port') if
                                                    self.require_ssl else
                                                    d('imapport'))

        self.timeouttimer = ResetTimer(pref('imap.timeout', self.default_timeout),
                                       self.timeout_check)

        from mail.imapcheck import IMAPCheck
        self.imap = IMAPCheck(self.max_fetch)
        self.cmdq = CommandQueue([], [], 30, 1)
        #print 'IMAPMail:', repr(options['name']), repr(options['password'])
        SMTPEmailAccount.__init__(self, **options)
Ejemplo n.º 7
0
 def _get_options(self):
     opts = SMTPEmailAccount._get_options(self)
     opts.update(dict((a, getattr(self, a)) for a in
                     'imapserver imapport require_ssl'.split()))
     d = self.protocol_info()['defaults']
     if opts['require_ssl'] and opts['imapport'] == d['default_ssl_port']:
         opts.pop('imapport')
     return opts
Ejemplo n.º 8
0
    def __init__(self, **options):
        d = self.default
        log.info("imap options: %r", options)
        self.imapserver = options.get('imapserver')
        self.require_ssl = options.get('require_ssl', d('require_ssl'))
        self.imapport = options.get(
            'imapport',
            d('default_ssl_port') if self.require_ssl else d('imapport'))

        self.timeouttimer = ResetTimer(
            pref('imap.timeout', self.default_timeout), self.timeout_check)

        from mail.imapcheck import IMAPCheck
        self.imap = IMAPCheck(self.max_fetch)
        self.cmdq = CommandQueue([], [], 30, 1)
        #print 'IMAPMail:', repr(options['name']), repr(options['password'])
        SMTPEmailAccount.__init__(self, **options)
Ejemplo n.º 9
0
 def _get_options(self):
     opts = SMTPEmailAccount._get_options(self)
     opts.update(
         dict((a, getattr(self, a))
              for a in 'imapserver imapport require_ssl'.split()))
     d = self.protocol_info()['defaults']
     if opts['require_ssl'] and opts['imapport'] == d['default_ssl_port']:
         opts.pop('imapport')
     return opts
Ejemplo n.º 10
0
 def _get_options(self):
     opts = SMTPEmailAccount._get_options(self)
     opts.update(
         dict((a, getattr(self, a))
              for a in 'popserver popport require_ssl'.split()))
     return opts
Ejemplo n.º 11
0
 def _delete(self, msg):
     SMTPEmailAccount.delete(self, msg)
     self.imap.delete(msg, error = lambda:self.on_error(lambda:self.delete(msg)))
Ejemplo n.º 12
0
 def delete(self, msg):
     SMTPEmailAccount.delete(self, msg)
     self._delete(msg)
Ejemplo n.º 13
0
 def markAsRead(self, msg):
     SMTPEmailAccount.markAsRead(self, msg)
     self._markAsRead(msg)
Ejemplo n.º 14
0
 def update(self):
     SMTPEmailAccount.update(self)
     log.info('starting timeout timer')
     self.timeouttimer.start()
     self.real_update(success=self.finish_update)
Ejemplo n.º 15
0
 def _get_options(self):
     opts = SMTPEmailAccount._get_options(self)
     opts.update(dict((a, getattr(self, a)) for a in
             'popserver popport require_ssl'.split()))
     return opts
Ejemplo n.º 16
0
 def _delete(self, msg):
     SMTPEmailAccount.delete(self, msg)
     self.imap.delete(msg,
                      error=lambda: self.on_error(lambda: self.delete(msg)))
Ejemplo n.º 17
0
 def delete(self, msg):
     SMTPEmailAccount.delete(self, msg)
     self._delete(msg)
Ejemplo n.º 18
0
 def markAsRead(self, msg):
     SMTPEmailAccount.markAsRead(self, msg)
     self._markAsRead(msg)