coding standards

This commit is contained in:
Yann Leboulanger 2012-01-08 20:48:03 +01:00
parent 69544d5f5c
commit 8bbca8a0a7
1 changed files with 17 additions and 15 deletions

View File

@ -78,11 +78,11 @@ class ConnectionJingle(object):
"""
# get data
jid = helpers.get_full_jid_from_iq(stanza)
id = stanza.getID()
id_ = stanza.getID()
if (jid, id) in self.__iq_responses.keys():
self.__iq_responses[(jid, id)].on_stanza(stanza)
del self.__iq_responses[(jid, id)]
if (jid, id_) in self.__iq_responses.keys():
self.__iq_responses[(jid, id_)].on_stanza(stanza)
del self.__iq_responses[(jid, id_)]
raise xmpp.NodeProcessed
jingle = stanza.getTag('jingle')
@ -93,7 +93,7 @@ class ConnectionJingle(object):
else:
sid = None
for sesn in self._sessions.values():
if id in sesn.iq_ids:
if id_ in sesn.iq_ids:
sesn.on_stanza(stanza)
return
@ -101,14 +101,15 @@ class ConnectionJingle(object):
if sid not in self._sessions:
#TODO: tie-breaking and other things...
newjingle = JingleSession(con=self, weinitiate=False, jid=jid,
iq_id=id, sid=sid)
iq_id=id_, sid=sid)
self._sessions[sid] = newjingle
# we already have such session in dispatcher...
self._sessions[sid].collect_iq_id(id)
self._sessions[sid].collect_iq_id(id_)
self._sessions[sid].on_stanza(stanza)
# Delete invalid/unneeded sessions
if sid in self._sessions and self._sessions[sid].state == JingleStates.ended:
if sid in self._sessions and \
self._sessions[sid].state == JingleStates.ended:
self.delete_jingle_session(sid)
raise xmpp.NodeProcessed
@ -155,20 +156,21 @@ class ConnectionJingle(object):
jingle.start_session()
return c.transport.sid
def iter_jingle_sessions(self, jid, sid=None, media=None):
if sid:
return (session for session in self._sessions.values() if session.sid == sid)
sessions = (session for session in self._sessions.values() if session.peerjid == jid)
return (session for session in self._sessions.values() if \
session.sid == sid)
sessions = (session for session in self._sessions.values() if \
session.peerjid == jid)
if media:
if media not in ('audio', 'video', 'file'):
return tuple()
else:
return (session for session in sessions if session.get_content(media))
return (session for session in sessions if \
session.get_content(media))
else:
return sessions
def get_jingle_session(self, jid, sid=None, media=None):
if sid:
if sid in self._sessions: