handle presences before caps. Fixes #6046

This commit is contained in:
Yann Leboulanger 2010-11-24 09:19:38 +01:00
parent 1c9d56e7de
commit c104199f6c
2 changed files with 7 additions and 2 deletions

View File

@ -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(

View File

@ -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,