From c104199f6cf0e1e269e67898dc710d774ccee188 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 24 Nov 2010 09:19:38 +0100 Subject: [PATCH] handle presences before caps. Fixes #6046 --- src/common/connection_handlers.py | 5 ++++- src/common/protocol/caps.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index eb43a7fb0..3ee669262 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -1071,6 +1071,10 @@ ConnectionJingle, ConnectionIBBytestream): ConnectionPubSub.__init__(self) ConnectionPEP.__init__(self, account=self.name, dispatcher=self, pubsub_connection=self) + + # Handle presences BEFORE caps + gajim.nec.register_incoming_event(PresenceReceivedEvent) + ConnectionCaps.__init__(self, account=self.name, dispatch_event=self.dispatch, capscache=capscache.capscache, client_caps_factory=capscache.create_suitable_client_caps) @@ -1104,7 +1108,6 @@ ConnectionJingle, ConnectionIBBytestream): PrivateStorageRosternotesReceivedEvent) gajim.nec.register_incoming_event(RosternotesReceivedEvent) gajim.nec.register_incoming_event(StreamConflictReceivedEvent) - gajim.nec.register_incoming_event(PresenceReceivedEvent) gajim.nec.register_incoming_event(MessageReceivedEvent) gajim.nec.register_incoming_event(ArchivingErrorReceivedEvent) gajim.nec.register_incoming_event( diff --git a/src/common/protocol/caps.py b/src/common/protocol/caps.py index 8ebe3a4c1..2f6f302d4 100644 --- a/src/common/protocol/caps.py +++ b/src/common/protocol/caps.py @@ -41,13 +41,15 @@ class ConnectionCaps(object): self._create_suitable_client_caps = client_caps_factory gajim.nec.register_incoming_event(CapsPresenceReceivedEvent) gajim.nec.register_incoming_event(CapsReceivedEvent) - gajim.ged.register_event_handler('caps-presence-received', ged.GUI1, + gajim.ged.register_event_handler('caps-presence-received', ged.GUI1, self._nec_caps_presence_received) def caps_change_account_name(self, new_name): self._account = new_name def _nec_caps_presence_received(self, obj): + if obj.conn.name != self._account: + return obj.client_caps = self._create_suitable_client_caps(obj.node, obj.caps_hash, obj.hash_method) self._capscache.query_client_of_jid_if_unknown(self, obj.fjid,