plugins XE0166, XEP-0234, XEP-0260, XEP-0261: renamed session key managing other peer's jid to "peer_jid" instead of "to_jid"
This commit is contained in:
parent
1a5f1bd144
commit
31c9e0d06e
1 changed files with 19 additions and 19 deletions
|
|
@ -115,7 +115,7 @@ class XEP_0166(object):
|
|||
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 @@ class XEP_0166(object):
|
|||
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 @@ class XEP_0166(object):
|
|||
'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 @@ class XEP_0166(object):
|
|||
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 @@ class XEP_0166(object):
|
|||
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 @@ class XEP_0166(object):
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue