rename __sessions to _session
This commit is contained in:
parent
75b6872064
commit
ffa7cbda9c
|
@ -44,7 +44,7 @@ class ConnectionJingle(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# dictionary: sessionid => JingleSession object
|
# dictionary: sessionid => JingleSession object
|
||||||
self.__sessions = {}
|
self._sessions = {}
|
||||||
|
|
||||||
# dictionary: (jid, iq stanza id) => JingleSession object,
|
# dictionary: (jid, iq stanza id) => JingleSession object,
|
||||||
# one time callbacks
|
# one time callbacks
|
||||||
|
@ -54,12 +54,12 @@ class ConnectionJingle(object):
|
||||||
"""
|
"""
|
||||||
Remove a jingle session from a jingle stanza dispatcher
|
Remove a jingle session from a jingle stanza dispatcher
|
||||||
"""
|
"""
|
||||||
if sid in self.__sessions:
|
if sid in self._sessions:
|
||||||
#FIXME: Move this elsewhere?
|
#FIXME: Move this elsewhere?
|
||||||
for content in self.__sessions[sid].contents.values():
|
for content in self._sessions[sid].contents.values():
|
||||||
content.destroy()
|
content.destroy()
|
||||||
self.__sessions[sid].callbacks = []
|
self._sessions[sid].callbacks = []
|
||||||
del self.__sessions[sid]
|
del self._sessions[sid]
|
||||||
|
|
||||||
def _JingleCB(self, con, stanza):
|
def _JingleCB(self, con, stanza):
|
||||||
"""
|
"""
|
||||||
|
@ -85,15 +85,15 @@ class ConnectionJingle(object):
|
||||||
sid = jingle.getAttr('sid')
|
sid = jingle.getAttr('sid')
|
||||||
|
|
||||||
# do we need to create a new jingle object
|
# do we need to create a new jingle object
|
||||||
if sid not in self.__sessions:
|
if sid not in self._sessions:
|
||||||
#TODO: tie-breaking and other things...
|
#TODO: tie-breaking and other things...
|
||||||
newjingle = JingleSession(con=self, weinitiate=False, jid=jid, sid=sid)
|
newjingle = JingleSession(con=self, weinitiate=False, jid=jid, sid=sid)
|
||||||
self.__sessions[sid] = newjingle
|
self._sessions[sid] = newjingle
|
||||||
|
|
||||||
# we already have such session in dispatcher...
|
# we already have such session in dispatcher...
|
||||||
self.__sessions[sid].on_stanza(stanza)
|
self._sessions[sid].on_stanza(stanza)
|
||||||
# Delete invalid/unneeded sessions
|
# 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)
|
self.delete_jingle_session(sid)
|
||||||
|
|
||||||
raise xmpp.NodeProcessed
|
raise xmpp.NodeProcessed
|
||||||
|
@ -106,7 +106,7 @@ class ConnectionJingle(object):
|
||||||
jingle.add_content('voice', JingleAudio(jingle))
|
jingle.add_content('voice', JingleAudio(jingle))
|
||||||
else:
|
else:
|
||||||
jingle = JingleSession(self, weinitiate=True, jid=jid)
|
jingle = JingleSession(self, weinitiate=True, jid=jid)
|
||||||
self.__sessions[jingle.sid] = jingle
|
self._sessions[jingle.sid] = jingle
|
||||||
jingle.add_content('voice', JingleAudio(jingle))
|
jingle.add_content('voice', JingleAudio(jingle))
|
||||||
jingle.start_session()
|
jingle.start_session()
|
||||||
return jingle.sid
|
return jingle.sid
|
||||||
|
@ -119,7 +119,7 @@ class ConnectionJingle(object):
|
||||||
jingle.add_content('video', JingleVideo(jingle))
|
jingle.add_content('video', JingleVideo(jingle))
|
||||||
else:
|
else:
|
||||||
jingle = JingleSession(self, weinitiate=True, jid=jid)
|
jingle = JingleSession(self, weinitiate=True, jid=jid)
|
||||||
self.__sessions[jingle.sid] = jingle
|
self._sessions[jingle.sid] = jingle
|
||||||
jingle.add_content('video', JingleVideo(jingle))
|
jingle.add_content('video', JingleVideo(jingle))
|
||||||
jingle.start_session()
|
jingle.start_session()
|
||||||
return jingle.sid
|
return jingle.sid
|
||||||
|
@ -127,8 +127,8 @@ class ConnectionJingle(object):
|
||||||
|
|
||||||
def iter_jingle_sessions(self, jid, sid=None, media=None):
|
def iter_jingle_sessions(self, jid, sid=None, media=None):
|
||||||
if sid:
|
if sid:
|
||||||
return (session for session in self.__sessions.values() if session.sid == 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)
|
sessions = (session for session in self._sessions.values() if session.peerjid == jid)
|
||||||
if media:
|
if media:
|
||||||
if media not in ('audio', 'video'):
|
if media not in ('audio', 'video'):
|
||||||
return tuple()
|
return tuple()
|
||||||
|
@ -140,14 +140,14 @@ class ConnectionJingle(object):
|
||||||
|
|
||||||
def get_jingle_session(self, jid, sid=None, media=None):
|
def get_jingle_session(self, jid, sid=None, media=None):
|
||||||
if sid:
|
if sid:
|
||||||
if sid in self.__sessions:
|
if sid in self._sessions:
|
||||||
return self.__sessions[sid]
|
return self._sessions[sid]
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
elif media:
|
elif media:
|
||||||
if media not in ('audio', 'video'):
|
if media not in ('audio', 'video'):
|
||||||
return None
|
return None
|
||||||
for session in self.__sessions.values():
|
for session in self._sessions.values():
|
||||||
if session.peerjid == jid and session.get_content(media):
|
if session.peerjid == jid and session.get_content(media):
|
||||||
return session
|
return session
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue