Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
This commit is contained in:
commit
4c05c4247c
@ -27,6 +27,7 @@ class Activity(dbus.service.Object):
|
|||||||
self._buddies = []
|
self._buddies = []
|
||||||
self._color = None
|
self._color = None
|
||||||
self._valid = False
|
self._valid = False
|
||||||
|
self._name = None
|
||||||
self._activity_id = activity_id
|
self._activity_id = activity_id
|
||||||
|
|
||||||
self._object_id = object_id
|
self._object_id = object_id
|
||||||
@ -85,6 +86,11 @@ class Activity(dbus.service.Object):
|
|||||||
def GetChannels(self):
|
def GetChannels(self):
|
||||||
return self.get_channels()
|
return self.get_channels()
|
||||||
|
|
||||||
|
@dbus.service.method(_ACTIVITY_INTERFACE,
|
||||||
|
in_signature="", out_signature="s")
|
||||||
|
def GetName(self):
|
||||||
|
return self.get_name()
|
||||||
|
|
||||||
# methods
|
# methods
|
||||||
def object_path(self):
|
def object_path(self):
|
||||||
return dbus.ObjectPath(self._object_path)
|
return dbus.ObjectPath(self._object_path)
|
||||||
@ -102,6 +108,9 @@ class Activity(dbus.service.Object):
|
|||||||
def get_joined_buddies(self):
|
def get_joined_buddies(self):
|
||||||
return self._buddies
|
return self._buddies
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
def buddy_joined(self, buddy):
|
def buddy_joined(self, buddy):
|
||||||
if buddy not in self._buddies:
|
if buddy not in self._buddies:
|
||||||
self._buddies.append(buddy)
|
self._buddies.append(buddy)
|
||||||
|
@ -67,7 +67,8 @@ class PresenceService(dbus.service.Object):
|
|||||||
self._server_plugin.connect('avatar-updated', self._avatar_updated)
|
self._server_plugin.connect('avatar-updated', self._avatar_updated)
|
||||||
self._server_plugin.connect('properties-changed', self._properties_changed)
|
self._server_plugin.connect('properties-changed', self._properties_changed)
|
||||||
self._server_plugin.connect('contact-activities-changed', self._contact_activities_changed)
|
self._server_plugin.connect('contact-activities-changed', self._contact_activities_changed)
|
||||||
self._server_plugin.connect('activity-invited', self._activity_invited)
|
self._server_plugin.connect('activity-invitation', self._activity_invitation)
|
||||||
|
self._server_plugin.connect('private-invitation', self._private_invitation)
|
||||||
self._server_plugin.start()
|
self._server_plugin.start()
|
||||||
|
|
||||||
# Set up the link local connection
|
# Set up the link local connection
|
||||||
@ -199,11 +200,14 @@ class PresenceService(dbus.service.Object):
|
|||||||
if len(activities) > 0:
|
if len(activities) > 0:
|
||||||
buddy.set_properties({'current-activity':activities[0]})
|
buddy.set_properties({'current-activity':activities[0]})
|
||||||
|
|
||||||
def _activity_invited(self, tp, act_id):
|
def _activity_invitation(self, tp, act_id):
|
||||||
activity = self._activities.get(act_id)
|
activity = self._activities.get(act_id)
|
||||||
if activity:
|
if activity:
|
||||||
pass
|
self.ActivityInvitation(activity.object_path())
|
||||||
# FIXME do something
|
|
||||||
|
def _private_invitation(self, tp, chan_path):
|
||||||
|
conn = tp.get_connection()
|
||||||
|
self.PrivateInvitation(str(conn.service_name), conn.object_path, chan_path)
|
||||||
|
|
||||||
@dbus.service.signal(_PRESENCE_INTERFACE, signature="o")
|
@dbus.service.signal(_PRESENCE_INTERFACE, signature="o")
|
||||||
def ActivityAppeared(self, activity):
|
def ActivityAppeared(self, activity):
|
||||||
@ -221,6 +225,14 @@ class PresenceService(dbus.service.Object):
|
|||||||
def BuddyDisappeared(self, buddy):
|
def BuddyDisappeared(self, buddy):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@dbus.service.signal(_PRESENCE_INTERFACE, signature="o")
|
||||||
|
def ActivityInvitation(self, activity):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@dbus.service.signal(_PRESENCE_INTERFACE, signature="soo")
|
||||||
|
def PrivateInvitation(self, bus_name, connection, channel):
|
||||||
|
pass
|
||||||
|
|
||||||
@dbus.service.method(_PRESENCE_INTERFACE, out_signature="ao")
|
@dbus.service.method(_PRESENCE_INTERFACE, out_signature="ao")
|
||||||
def GetActivities(self):
|
def GetActivities(self):
|
||||||
ret = []
|
ret = []
|
||||||
|
@ -29,7 +29,7 @@ import hashlib
|
|||||||
from telepathy.client import ConnectionManager, ManagerRegistry, Connection, Channel
|
from telepathy.client import ConnectionManager, ManagerRegistry, Connection, Channel
|
||||||
from telepathy.interfaces import (
|
from telepathy.interfaces import (
|
||||||
CONN_MGR_INTERFACE, CONN_INTERFACE, CHANNEL_TYPE_CONTACT_LIST, CHANNEL_INTERFACE_GROUP, CONN_INTERFACE_ALIASING,
|
CONN_MGR_INTERFACE, CONN_INTERFACE, CHANNEL_TYPE_CONTACT_LIST, CHANNEL_INTERFACE_GROUP, CONN_INTERFACE_ALIASING,
|
||||||
CONN_INTERFACE_AVATARS, CONN_INTERFACE_PRESENCE, CHANNEL_TYPE_TEXT)
|
CONN_INTERFACE_AVATARS, CONN_INTERFACE_PRESENCE, CHANNEL_TYPE_TEXT, CHANNEL_TYPE_STREAMED_MEDIA)
|
||||||
from telepathy.constants import (
|
from telepathy.constants import (
|
||||||
CONNECTION_HANDLE_TYPE_NONE, CONNECTION_HANDLE_TYPE_CONTACT,
|
CONNECTION_HANDLE_TYPE_NONE, CONNECTION_HANDLE_TYPE_CONTACT,
|
||||||
CONNECTION_STATUS_CONNECTED, CONNECTION_STATUS_DISCONNECTED, CONNECTION_STATUS_CONNECTING,
|
CONNECTION_STATUS_CONNECTED, CONNECTION_STATUS_DISCONNECTED, CONNECTION_STATUS_CONNECTING,
|
||||||
@ -84,7 +84,9 @@ class ServerPlugin(gobject.GObject):
|
|||||||
([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])),
|
([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])),
|
||||||
'contact-activities-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
'contact-activities-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||||
([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])),
|
([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])),
|
||||||
'activity-invited': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
'activity-invitation': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||||
|
([gobject.TYPE_PYOBJECT])),
|
||||||
|
'private-invitation': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||||
([gobject.TYPE_PYOBJECT]))
|
([gobject.TYPE_PYOBJECT]))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +421,7 @@ class ServerPlugin(gobject.GObject):
|
|||||||
self.emit("contact-activities-changed", contact, activities_id)
|
self.emit("contact-activities-changed", contact, activities_id)
|
||||||
|
|
||||||
def _new_channel_cb(self, object_path, channel_type, handle_type, handle, suppress_handler):
|
def _new_channel_cb(self, object_path, channel_type, handle_type, handle, suppress_handler):
|
||||||
if handle_type == CONNECTION_HANDLE_TYPE_ROOM:
|
if handle_type == CONNECTION_HANDLE_TYPE_ROOM and channel_type == CHANNEL_TYPE_TEXT:
|
||||||
channel = Channel(self._conn._dbus_object._named_service, object_path)
|
channel = Channel(self._conn._dbus_object._named_service, object_path)
|
||||||
|
|
||||||
# hack
|
# hack
|
||||||
@ -430,4 +432,8 @@ class ServerPlugin(gobject.GObject):
|
|||||||
if local_pending:
|
if local_pending:
|
||||||
for act_id, act_handle in self._activities.items():
|
for act_id, act_handle in self._activities.items():
|
||||||
if handle == act_handle:
|
if handle == act_handle:
|
||||||
self.emit("activity-invited", act_id)
|
self.emit("activity-invitation", act_id)
|
||||||
|
|
||||||
|
elif handle_type == CONNECTION_HANDLE_TYPE_CONTACT and \
|
||||||
|
channel_type in [CHANNEL_TYPE_TEXT, CHANNEL_TYPE_STREAMED_MEDIA]:
|
||||||
|
self.emit("private-invitation", object_path)
|
||||||
|
Loading…
Reference in New Issue
Block a user