Mercurial > libervia-backend
diff src/plugins/plugin_xep_0166.py @ 1567:268fda4236ca
plugins XE0166, XEP-0234, XEP-0260, XEP-0261: renamed session key managing other peer's jid to "peer_jid" instead of "to_jid"
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 08 Nov 2015 14:44:33 +0100 |
parents | cbfbe028d099 |
children | 846a39900fa6 |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0166.py Sun Nov 08 14:44:30 2015 +0100 +++ b/src/plugins/plugin_xep_0166.py Sun Nov 08 14:44:33 2015 +0100 @@ -115,7 +115,7 @@ def _buildJingleElt(self, client, session, action): iq_elt = client.IQ('set') iq_elt['from'] = client.jid.full() - iq_elt['to'] = session['to_jid'].full() + iq_elt['to'] = session['peer_jid'].full() jingle_elt = iq_elt.addElement("jingle", NS_JINGLE) jingle_elt["sid"] = session['id'] jingle_elt['action'] = action @@ -259,10 +259,10 @@ return iq_elt, context_elt @defer.inlineCallbacks - def initiate(self, to_jid, contents, profile=C.PROF_KEY_NONE): + def initiate(self, peer_jid, contents, profile=C.PROF_KEY_NONE): """Send a session initiation request - @param to_jid(jid.JID): jid to establith session with + @param peer_jid(jid.JID): jid to establith session with @param contents(list[dict]): list of contents to use: The dict must have the following keys: - app_ns(unicode): namespace of the application @@ -285,7 +285,7 @@ 'state': STATE_PENDING, 'initiator': initiator, 'role': XEP_0166.ROLE_INITIATOR, - 'to_jid': to_jid, + 'peer_jid': peer_jid, 'started': time.time(), 'contents': {} } @@ -369,7 +369,7 @@ def jingleRequestConfirmationDefault(self, action, session, content_name, desc_elt, profile): """This method request confirmation for a jingle session""" log.debug(u"Using generic jingle confirmation method") - return xml_tools.deferConfirm(self.host, _(CONFIRM_TXT).format(entity=session['to_jid'].full()), _('Confirm Jingle session'), profile=profile) + return xml_tools.deferConfirm(self.host, _(CONFIRM_TXT).format(entity=session['peer_jid'].full()), _('Confirm Jingle session'), profile=profile) ## jingle events ## @@ -405,7 +405,7 @@ self.sendError('bad-request', None, request, profile) return - to_jid = jid.JID(request['from']) + peer_jid = jid.JID(request['from']) # we get or create the session try: @@ -413,13 +413,13 @@ except KeyError: session = client.jingle_sessions[sid] = {'id': sid, 'state': STATE_PENDING, - 'initiator': to_jid, + 'initiator': peer_jid, 'role': XEP_0166.ROLE_RESPONDER, - 'to_jid': to_jid, + 'peer_jid': peer_jid, 'started': time.time(), } else: - if session['to_jid'] != to_jid: + if session['peer_jid'] != peer_jid: log.warning(u"sid conflict ({}), the jid doesn't match. Can be a collision, a hack attempt, or a bad sid generation".format(sid)) self.sendError('service-unavailable', sid, request, profile) return