[Telepathy-commits] [mingle/master] handle incoming session-initiates ourselves, so we can use the existing fs conference

Sjoerd Simons sjoerd at luon.net
Wed Nov 5 07:27:37 PST 2008


---
 mingle-client.py |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/mingle-client.py b/mingle-client.py
index cb387e7..e4639ac 100644
--- a/mingle-client.py
+++ b/mingle-client.py
@@ -31,6 +31,30 @@ class Muc:
         self.my_jid = JID('%s/%s' % (self.jid.userhost(),
             self.client.jid.user))
 
+        transports = jingle.get_available_transports()
+        client.features.update([
+         ns.JINGLE,
+         ns.JINGLE_RTP,
+         ns.OLD_JINGLE,
+         ns.OLD_JINGLE_DESC_AUDIO,
+         ns.OLD_JINGLE_DESC_VIDEO,
+        ] + transports)
+
+        client.send_presence()
+
+        client.add_iq_handler('set', ns.JINGLE, 'jingle',
+            self.jingle_iq_received)
+
+    def jingle_iq_received(self, iq):
+        j = xpath.queryForNodes('/iq/jingle', iq)[0]
+        if j['action'] != 'session-initiate':
+            return None
+
+        session = jingle.JingleSession(self.client, self.conference)
+
+        return session.handle_session_initiate (iq,
+            self.client.get_contact (JID(iq['from'])))
+
     def join(self):
         self.state = Muc.JOINING
         self.client.stream.addObserver('/presence', self.presence)
@@ -193,7 +217,6 @@ def run(jid, password, muc_jid, peers):
         muc.join()
 
     client = create_client(jid, password)
-    jingle.enable_incoming_calls(client)
 
     client.authenticated.addCallback(authd)
     client.done.addBoth(lambda *args: reactor.stop())
-- 
1.5.6.5




More information about the Telepathy-commits mailing list