bridge, quick_frontend: the JID that is assigned by the server can differ from the one we asked for (resource)
This commit is contained in:
parent
e10070f923
commit
640537662a
4 changed files with 18 additions and 12 deletions
|
|
@ -63,8 +63,8 @@ class ProfileManager(object):
|
|||
self.bridge.asyncGetParamA("JabberID", "Connection", profile_key=self.profile,
|
||||
callback=self._plug_profile_jid, errback=self._getParamError)
|
||||
|
||||
def _plug_profile_jid(self, _jid):
|
||||
self.whoami = jid.JID(_jid)
|
||||
def _plug_profile_jid(self, jid_s):
|
||||
self.whoami = jid.JID(jid_s) # resource might change after the connection
|
||||
self.bridge.asyncGetParamA("autoconnect", "Connection", profile_key=self.profile,
|
||||
callback=self._plug_profile_autoconnect, errback=self._getParamError)
|
||||
|
||||
|
|
@ -439,9 +439,14 @@ class QuickApp(object):
|
|||
def newWidget(self, widget):
|
||||
raise NotImplementedError
|
||||
|
||||
def connectedHandler(self, profile):
|
||||
"""called when the connection is made"""
|
||||
def connectedHandler(self, profile, jid_s):
|
||||
"""Called when the connection is made.
|
||||
|
||||
@param jid_s (unicode): the JID that we were assigned by the server,
|
||||
as the resource might differ from the JID we asked for.
|
||||
"""
|
||||
log.debug(_("Connected"))
|
||||
self.profiles[profile].whoami = jid.JID(jid_s)
|
||||
self.setPresenceStatus(profile=profile)
|
||||
self.contact_lists[profile].fill()
|
||||
|
||||
|
|
@ -451,8 +456,8 @@ class QuickApp(object):
|
|||
self.contact_lists[profile].clearContacts()
|
||||
self.setPresenceStatus(C.PRESENCE_UNAVAILABLE, '', profile=profile)
|
||||
|
||||
def newContactHandler(self, JabberId, attributes, groups, profile):
|
||||
entity = jid.JID(JabberId)
|
||||
def newContactHandler(self, jid_s, attributes, groups, profile):
|
||||
entity = jid.JID(jid_s)
|
||||
_groups = list(groups)
|
||||
self.contact_lists[profile].setContact(entity, _groups, attributes, in_roster=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -141,8 +141,8 @@ class DbusObject(dbus.service.Object):
|
|||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='s')
|
||||
def connected(self, profile):
|
||||
signature='ss')
|
||||
def connected(self, profile, jid_s):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
|
|
@ -555,8 +555,8 @@ class DBusBridge(Bridge):
|
|||
def askConfirmation(self, id, conf_type, data, profile):
|
||||
self.dbus_bridge.askConfirmation(id, conf_type, data, profile)
|
||||
|
||||
def connected(self, profile):
|
||||
self.dbus_bridge.connected(profile)
|
||||
def connected(self, profile, jid_s):
|
||||
self.dbus_bridge.connected(profile, jid_s)
|
||||
|
||||
def contactDeleted(self, entity_jid, profile):
|
||||
self.dbus_bridge.contactDeleted(entity_jid, profile)
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@ doc_security_limit=security_limit: -1 means no security, 0 is the maximum securi
|
|||
[connected]
|
||||
type=signal
|
||||
category=core
|
||||
sig_in=s
|
||||
sig_in=ss
|
||||
doc=Connection is done
|
||||
doc_param_0=%(doc_profile)s
|
||||
doc_param_1=jid_s: the JID that we were assigned by the server, as the resource might differ from the JID we asked for.
|
||||
|
||||
[disconnected]
|
||||
type=signal
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class SatXMPPClient(client.XMPPClient):
|
|||
self.__connected = True
|
||||
log.info(_("********** [%s] CONNECTED **********") % self.profile)
|
||||
self.streamInitialized()
|
||||
self.host_app.bridge.connected(self.profile) # we send the signal to the clients
|
||||
self.host_app.bridge.connected(self.profile, unicode(self.jid)) # we send the signal to the clients
|
||||
|
||||
def streamInitialized(self):
|
||||
"""Called after _authd"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue