Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorgan Collett <morgan.collett@gmail.com>2008-05-08 12:24:44 (GMT)
committer Morgan Collett <morgan.collett@gmail.com>2008-06-13 14:59:33 (GMT)
commit35f08ef4fc1426b0d538d8a846b31c8e74ba307b (patch)
treebf9cfd1a2a77563c7ca5554860e92704047f403e /src
parent3b9e8d224fd538f99029a82e5571578b71d6da1d (diff)
#6298: Launch Chat for 1-1 XMPP chat
Diffstat (limited to 'src')
-rw-r--r--src/model/Owner.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/model/Owner.py b/src/model/Owner.py
index 1447267..73bd5da 100644
--- a/src/model/Owner.py
+++ b/src/model/Owner.py
@@ -1,4 +1,5 @@
# Copyright (C) 2006-2007 Red Hat, Inc.
+# Copyright (C) 2008 One Laptop Per Child
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -64,6 +65,8 @@ class ShellOwner(gobject.GObject):
self._pservice = presenceservice.get_instance()
self._pservice.connect('activity-invitation',
self._activity_invitation_cb)
+ self._pservice.connect('private-invitation',
+ self._private_invitation_cb)
self._pservice.connect('activity-disappeared',
self._activity_disappeared_cb)
@@ -79,5 +82,21 @@ class ShellOwner(gobject.GObject):
self._invites.add_invite(buddy, activity.props.type,
activity.props.id)
+ def _private_invitation_cb(self, pservice, bus_name, connection,
+ channel):
+ """Handle a private-invitation from Presence Service.
+
+ This is a connection by a non-Sugar XMPP client, so
+ launch Chat with the Telepathy connection and channel.
+ """
+ import json
+ from sugar import activity
+ from sugar.activity import activityfactory
+ tp_channel = json.write([str(bus_name), str(connection),
+ str(channel)])
+ registry = activity.get_registry()
+ if registry.get_activity('org.laptop.Chat'):
+ activityfactory.create_with_uri('org.laptop.Chat', tp_channel)
+
def _activity_disappeared_cb(self, pservice, activity):
self._invites.remove_activity(activity.props.id)