changeset a660888d0a98 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=a660888d0a98 description: A little fix with content acceptance ; modified a bit JINGLE_DISCONNECTED
diffstat:
src/common/jingle.py | 20 ++++++++++++++------ src/gajim.py | 8 +++++--- 2 files changed, 19 insertions(+), 9 deletions(-)
diffs (89 lines):
diff -r a39c323da8bd -r a660888d0a98 src/common/jingle.py --- a/src/common/jingle.py Sat Sep 26 12:31:56 2009 +0200 +++ b/src/common/jingle.py Sat Sep 26 14:14:58 2009 +0200 @@ -364,7 +364,11 @@ creator = content['creator'] name = content['name'] if (creator, name) in self.contents: - self.contents[(creator, name)].destroy() + content = self.contents[(creator, name)] + #TODO: this will fail if content is not an RTP content + self.connection.dispatch('JINGLE_DISCONNECTED', + (self.peerjid, self.sid, content.media, 'removed')) + content.destroy() if len(self.contents) == 0: reason = xmpp.Node('reason') reason.setTag('success') @@ -399,7 +403,7 @@ self.__content_reject(content) self.contents[(content.creator, content.name)].destroy()
- self.connection.dispatch('JINGLE_INCOMING', (self.initiator, self.sid, + self.connection.dispatch('JINGLE_INCOMING', (self.peerjid, self.sid, contents))
def __sessionInitiateCB(self, stanza, jingle, error, action): @@ -442,7 +446,7 @@ self.state = JingleStates.pending
# Send event about starting a session - self.connection.dispatch('JINGLE_INCOMING', (self.initiator, self.sid, + self.connection.dispatch('JINGLE_INCOMING', (self.peerjid, self.sid, contents))
def __broadcastCB(self, stanza, jingle, error, action): @@ -462,7 +466,8 @@ text = '%s (%s)' % (reason, text) else: text = reason#TODO - self.connection.dispatch('JINGLE_DISCONNECTED', (self.peerjid, self.sid, text)) + self.connection.dispatch('JINGLE_DISCONNECTED', + (self.peerjid, self.sid, None, text))
def __broadcastAllCB(self, stanza, jingle, error, action): ''' Broadcast the stanza to all content handlers. ''' @@ -598,7 +603,8 @@ else: text = reason self.connection.delete_jingle(self) - self.connection.dispatch('JINGLE_DISCONNECTED', (self.peerjid, self.sid, text)) + self.connection.dispatch('JINGLE_DISCONNECTED', + (self.peerjid, self.sid, None, text))
def __content_add(self, content): #TODO: test @@ -630,7 +636,9 @@ stanza, jingle = self.__make_jingle('content-remove') self.__append_content(jingle, content) self.connection.connection.send(stanza) - #TODO: dispatch something? + #TODO: this will fail if content is not an RTP content + self.connection.dispatch('JINGLE_DISCONNECTED', + (self.peerjid, self.sid, content.media, 'removed'))
def content_negociated(self, media): self.connection.dispatch('JINGLE_CONNECTED', (self.peerjid, self.sid, diff -r a39c323da8bd -r a660888d0a98 src/gajim.py --- a/src/gajim.py Sat Sep 26 12:31:56 2009 +0200 +++ b/src/gajim.py Sat Sep 26 14:14:58 2009 +0200 @@ -2164,15 +2164,17 @@
def handle_event_jingle_disconnected(self, account, data): # ('JINGLE_DISCONNECTED', account, (peerjid, sid, reason)) - peerjid, sid, reason = data + peerjid, sid, media, reason = data jid = gajim.get_jid_without_resource(peerjid) resource = gajim.get_resource_from_jid(peerjid) ctrl = self.msg_win_mgr.get_control(peerjid, account) if not ctrl: ctrl = self.msg_win_mgr.get_control(jid, account) if ctrl: - ctrl.set_audio_state('stop', sid=sid, reason=reason) - ctrl.set_video_state('stop', sid=sid, reason=reason) + if media in ('audio', None): + ctrl.set_audio_state('stop', sid=sid, reason=reason) + if media in ('video', None): + ctrl.set_video_state('stop', sid=sid, reason=reason) dialog = dialogs.VoIPCallReceivedDialog.get_dialog(peerjid, sid) if dialog: dialog.dialog.destroy()