|
@ -124,11 +124,10 @@ class FetchmailServer(orm.Model): |
|
|
count, failed = 0, 0 |
|
|
count, failed = 0, 0 |
|
|
last_date = False |
|
|
last_date = False |
|
|
imap_server = False |
|
|
imap_server = False |
|
|
if server.type == 'imap': |
|
|
|
|
|
|
|
|
if server.type == 'imap' and server.last_internal_date: |
|
|
try: |
|
|
try: |
|
|
imap_server = server.connect() |
|
|
imap_server = server.connect() |
|
|
imap_server.select() |
|
|
imap_server.select() |
|
|
if server.last_internal_date: |
|
|
|
|
|
count, failed, last_date = self._fetch_from_data_imap( |
|
|
count, failed, last_date = self._fetch_from_data_imap( |
|
|
cr, uid, server, imap_server, mail_thread, |
|
|
cr, uid, server, imap_server, mail_thread, |
|
|
action_pool, count, failed, context=context |
|
|
action_pool, count, failed, context=context |
|
@ -145,6 +144,11 @@ class FetchmailServer(orm.Model): |
|
|
imap_server.close() |
|
|
imap_server.close() |
|
|
imap_server.logout() |
|
|
imap_server.logout() |
|
|
if last_date: |
|
|
if last_date: |
|
|
|
|
|
_logger.info( |
|
|
|
|
|
"Fetched %d email(s) on %s server %s; \ |
|
|
|
|
|
%d succeeded, %d failed.", count, |
|
|
|
|
|
server.type, server.name, |
|
|
|
|
|
(count - failed), failed) |
|
|
vals = {'last_internal_date': last_date} |
|
|
vals = {'last_internal_date': last_date} |
|
|
server.write(vals) |
|
|
server.write(vals) |
|
|
return super(FetchmailServer, self).fetch_mail( |
|
|
return super(FetchmailServer, self).fetch_mail( |
|
|