first f##ck lazy hacking and respect the API. add_accounts_contacts cannot also mess with messages; second move it to new method (instead of f.e. renaming the current method) because we want to have all contacts in roster and then see events about them

This commit is contained in:
Nikos Kouremenos 2006-04-10 23:30:18 +00:00
parent 213dcd32bb
commit 924528aadb
1 changed files with 10 additions and 3 deletions

View File

@ -877,17 +877,24 @@ class RosterWindow:
ctrl.update_ui()
def draw_roster(self):
'''Clear and draw roster'''
'''clear and draw roster'''
# clear the model, only if it is not empty
if self.tree.get_model():
self.tree.get_model().clear()
model = self.tree.get_model()
if model:
model.clear()
for acct in gajim.connections:
self.add_account_to_roster(acct)
self.add_account_contacts(acct)
self.fire_up_unread_messages_events(acct)
def add_account_contacts(self, account):
'''adds contacts of group to roster treeview'''
for jid in gajim.contacts.get_jid_list(account):
self.add_contact_to_roster(jid, account)
def fire_up_unread_messages_events(self, account):
'''reads from db the unread messages, and fire them up'''
for jid in gajim.contacts.get_jid_list(account):
results = gajim.logger.get_unread_msgs_for_jid(jid)
for result in results:
tim = time.localtime(float(result[2]))