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,