POP3 exception and IMAP infinite loop corrected

darcs-hash:20060207221528-86b55-fac5a34889bd37751ad3f6f3f4b2f423360535ec.gz
This commit is contained in:
David Rousselie
2006-02-07 23:15:28 +01:00
parent 505543262f
commit 8e9a420517
2 changed files with 6 additions and 9 deletions

View File

@@ -836,7 +836,7 @@ class MailComponent(Component):
""" Check mail account """
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)]
action = account.action
@@ -861,7 +861,7 @@ class MailComponent(Component):
subject = account.default_lang_class.new_mail_subject % (email_from), \
body = body)
self.stream.send(mesg)
account.get_next_mail_index(mail_list)
mail_index = account.get_next_mail_index(mail_list)
else:
body = ""
new_mail_count = 0
@@ -882,6 +882,7 @@ class MailComponent(Component):
self.stream.send(mesg)
account.disconnect()
account.in_error = False
self.__logger.debug("\nCHECK_MAIL ends " + unicode(jid) + " " + name)
except Exception,e:
if account.in_error == False:
account.in_error = True

View File

@@ -445,12 +445,8 @@ class POP3Connection(MailConnection):
def get_mail_list(self):
POP3Connection._logger.debug("Getting mail list")
count, size = self.connection.stat()
result = [str(i) for i in range(1, count + 1)]
if not result or result[0] == '':
self.__nb_mail = 0
else:
self.__nb_mail = len(result)
return result
self.__nb_mail = count
return [str(i) for i in range(1, count + 1)]
def get_mail(self, index):
POP3Connection._logger.debug("Getting mail " + str(index))
@@ -471,7 +467,7 @@ class POP3Connection(MailConnection):
return None
if self.__nb_mail < self.__lastmail:
self.__lastmail = 0
result = self.__lastmail
result = int(mail_list[self.__lastmail])
self.__lastmail += 1
return result