From 4d10bdcf6f0661562424bc4fb34526374a012f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=C3=ABl=20Verrier?= Date: Tue, 30 Jun 2009 11:46:27 +0200 Subject: [PATCH] * In order to allow the viewing of the roster when we are offline (and some other cool stuffs), with and without roster versioning, now we load roster when RosterWindow is created (at gajim startup). Fixes #3190 --- src/common/connection_handlers.py | 6 ++++-- src/common/xmpp/roster_nb.py | 2 ++ src/gajim.py | 1 + src/roster_window.py | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 73f2160b7..2c3453ef8 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -2452,6 +2452,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, def _on_roster_set(self, roster): roster_version = roster.version + received_from_server = roster.received_from_server raw_roster = roster.getRaw() roster = {} our_jid = helpers.parse_jid(gajim.get_jid_from_account(self.name)) @@ -2490,9 +2491,10 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, # we can't determine which iconset to use self.discoverInfo(jid) - self.dispatch('ROSTER', roster) - gajim.logger.replace_roster(self.name, roster_version, roster) print raw_roster + gajim.logger.replace_roster(self.name, roster_version, roster) + if received_from_server: + self.dispatch('ROSTER', roster) def _send_first_presence(self, signed = ''): show = self.continue_connect_info[0] diff --git a/src/common/xmpp/roster_nb.py b/src/common/xmpp/roster_nb.py index 196604114..7ebd5870c 100644 --- a/src/common/xmpp/roster_nb.py +++ b/src/common/xmpp/roster_nb.py @@ -43,6 +43,7 @@ class NonBlockingRoster(PlugIn): self._data = {} self.set=None self._exported_methods=[self.getRoster] + self.received_from_server = False def Request(self,force=0): ''' Request roster from server if it were not yet requested @@ -67,6 +68,7 @@ class NonBlockingRoster(PlugIn): return query = stanza.getTag('query') if query: + self.received_from_server = True self.version = stanza.getTagAttr('query', 'ver') if self.version is None: self.version = '' diff --git a/src/gajim.py b/src/gajim.py index b486c2d2c..868e00e74 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -3423,6 +3423,7 @@ class Interface: gtk.window_set_default_icon(pix) self.roster = roster_window.RosterWindow() + self.roster.init_roster() self.init_emoticons() self.make_regexps() diff --git a/src/roster_window.py b/src/roster_window.py index 8b152de04..ef7c7b0be 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -6176,6 +6176,11 @@ class RosterWindow: # #self.xml.get_widget('menubar').hide() # return + def init_roster(self): + for account in gajim.connections: + roster = gajim.logger.get_roster(gajim.get_jid_from_account(account)) + gajim.handlers['ROSTER'](account, roster) + ################################################################################ ### ################################################################################