POP3 exception and IMAP infinite loop corrected
darcs-hash:20060207221528-86b55-fac5a34889bd37751ad3f6f3f4b2f423360535ec.gz
This commit is contained in:
@@ -836,7 +836,7 @@ class MailComponent(Component):
|
|||||||
|
|
||||||
""" Check mail account """
|
""" Check mail account """
|
||||||
def check_mail(self, jid, name):
|
def check_mail(self, jid, name):
|
||||||
self.__logger.debug("CHECK_MAIL " + unicode(jid) + " " + name)
|
self.__logger.debug("\nCHECK_MAIL " + unicode(jid) + " " + name)
|
||||||
account = self.__storage[(jid, name)]
|
account = self.__storage[(jid, name)]
|
||||||
action = account.action
|
action = account.action
|
||||||
|
|
||||||
@@ -861,7 +861,7 @@ class MailComponent(Component):
|
|||||||
subject = account.default_lang_class.new_mail_subject % (email_from), \
|
subject = account.default_lang_class.new_mail_subject % (email_from), \
|
||||||
body = body)
|
body = body)
|
||||||
self.stream.send(mesg)
|
self.stream.send(mesg)
|
||||||
account.get_next_mail_index(mail_list)
|
mail_index = account.get_next_mail_index(mail_list)
|
||||||
else:
|
else:
|
||||||
body = ""
|
body = ""
|
||||||
new_mail_count = 0
|
new_mail_count = 0
|
||||||
@@ -882,6 +882,7 @@ class MailComponent(Component):
|
|||||||
self.stream.send(mesg)
|
self.stream.send(mesg)
|
||||||
account.disconnect()
|
account.disconnect()
|
||||||
account.in_error = False
|
account.in_error = False
|
||||||
|
self.__logger.debug("\nCHECK_MAIL ends " + unicode(jid) + " " + name)
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
if account.in_error == False:
|
if account.in_error == False:
|
||||||
account.in_error = True
|
account.in_error = True
|
||||||
|
|||||||
@@ -445,12 +445,8 @@ class POP3Connection(MailConnection):
|
|||||||
def get_mail_list(self):
|
def get_mail_list(self):
|
||||||
POP3Connection._logger.debug("Getting mail list")
|
POP3Connection._logger.debug("Getting mail list")
|
||||||
count, size = self.connection.stat()
|
count, size = self.connection.stat()
|
||||||
result = [str(i) for i in range(1, count + 1)]
|
self.__nb_mail = count
|
||||||
if not result or result[0] == '':
|
return [str(i) for i in range(1, count + 1)]
|
||||||
self.__nb_mail = 0
|
|
||||||
else:
|
|
||||||
self.__nb_mail = len(result)
|
|
||||||
return result
|
|
||||||
|
|
||||||
def get_mail(self, index):
|
def get_mail(self, index):
|
||||||
POP3Connection._logger.debug("Getting mail " + str(index))
|
POP3Connection._logger.debug("Getting mail " + str(index))
|
||||||
@@ -471,7 +467,7 @@ class POP3Connection(MailConnection):
|
|||||||
return None
|
return None
|
||||||
if self.__nb_mail < self.__lastmail:
|
if self.__nb_mail < self.__lastmail:
|
||||||
self.__lastmail = 0
|
self.__lastmail = 0
|
||||||
result = self.__lastmail
|
result = int(mail_list[self.__lastmail])
|
||||||
self.__lastmail += 1
|
self.__lastmail += 1
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user