changeset a7bb24c5fe6e in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=a7bb24c5fe6e
description: Added approve_content and decline_content methods.

        A content has now to be accepted (user-side) before 
{content,session}-accept

diffstat:

 src/common/jingle.py |  18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r 1b61572222a0 -r a7bb24c5fe6e src/common/jingle.py
--- a/src/common/jingle.py      Fri Sep 25 19:32:13 2009 +0200
+++ b/src/common/jingle.py      Fri Sep 25 23:05:14 2009 +0200
@@ -147,6 +147,18 @@
                reason.addChild('decline')
                self._session_terminate(reason)
 
+       def approve_content(self, media):
+               content = self.get_content(media)
+               if content:
+                       content.accepted = True
+                       self.on_session_state_changed(content)
+
+       def reject_content(self, media):
+               content = self.get_content(media)
+               if content:
+                       content.destroy()
+                       self.on_session_state_changed()
+
        def end_session(self):
                ''' Called when user stops or cancel session in UI. '''
                reason = xmpp.Node('reason')
@@ -623,7 +635,7 @@
                # (a JingleContent not added to session shouldn't send anything)
                #self.creator = None
                #self.name = None
-               self.negotiated = False         # is this content already 
negotiated?
+               self.accepted = False
                self.candidates = [] # Local transport candidates
 
                self.senders = 'both' #FIXME
@@ -653,7 +665,8 @@
        def is_ready(self):
                #print '[%s] %s, %s' % (self.media, self.candidates_ready,
                #       self.p2psession.get_property('codecs-ready'))
-               return self.candidates_ready and 
self.p2psession.get_property('codecs-ready')
+               return (self.accepted and self.candidates_ready
+                       and self.p2psession.get_property('codecs-ready'))
 
        def stanzaCB(self, stanza, content, error, action):
                ''' Called when something related to our content was sent by 
peer. '''
@@ -843,7 +856,6 @@
                                        reason.setTag('failed-transport')
                                        self.session._session_terminate(reason)
                                elif state == farsight.STREAM_STATE_READY:
-                                       self.negotiated = True
                                        #TODO: farsight.DIRECTION_BOTH only if 
senders='both'
                                        
self.p2pstream.set_property('direction', farsight.DIRECTION_BOTH)
                                        
self.session.content_negociated(self.media)
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to