leto's bug: display a warning when it happens, and backend ignores malformated threads
This commit is contained in:
parent
5d70abf8f9
commit
6973611e2a
2 changed files with 11 additions and 1 deletions
|
|
@ -94,6 +94,8 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
|||
contacts = self.browser.get_threads_list()
|
||||
|
||||
for contact in contacts:
|
||||
if not contact.get_id():
|
||||
continue
|
||||
thread = Thread(contact.get_id())
|
||||
yield thread
|
||||
|
||||
|
|
@ -169,6 +171,8 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
|||
with self.browser:
|
||||
contacts = self.browser.get_threads_list()
|
||||
for contact in contacts:
|
||||
if not contact.get_id():
|
||||
continue
|
||||
slut = self._get_slut(contact.get_id())
|
||||
if contact.get_lastmsg_date() > slut['lastmsg']:
|
||||
thread = self.get_thread(contact.get_id(), profiles)
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class ContactItem:
|
|||
|
||||
def __init__(self, tr):
|
||||
self.tr = tr
|
||||
self.id = 0
|
||||
|
||||
def __get_element(self, id):
|
||||
return self.tr.getElementsByTagName('td')[self.fields.index(id)]
|
||||
|
|
@ -107,6 +108,9 @@ class ContactItem:
|
|||
return None
|
||||
|
||||
def get_id(self):
|
||||
if self.id:
|
||||
return self.id
|
||||
|
||||
tag = self.__get_element('thread_link')
|
||||
|
||||
text = tag.getAttribute('onclick')
|
||||
|
|
@ -115,8 +119,10 @@ class ContactItem:
|
|||
m = regexp.match(text)
|
||||
|
||||
if m:
|
||||
return int(m.group(1))
|
||||
self.id = int(m.group(1))
|
||||
return self.id
|
||||
|
||||
warning('Unable to parse ID (%s)' % text)
|
||||
return 0
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue