implement ActivityInvitation and PrivateInvitation signals
This commit is contained in:
parent
c07596a1ea
commit
cb2489bff6
@ -67,7 +67,8 @@ class PresenceService(dbus.service.Object):
|
||||
self._server_plugin.connect('avatar-updated', self._avatar_updated)
|
||||
self._server_plugin.connect('properties-changed', self._properties_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()
|
||||
|
||||
# Set up the link local connection
|
||||
@ -199,11 +200,14 @@ class PresenceService(dbus.service.Object):
|
||||
if len(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)
|
||||
if activity:
|
||||
pass
|
||||
# FIXME do something
|
||||
self.ActivityInvitation(activity.object_path())
|
||||
|
||||
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")
|
||||
def ActivityAppeared(self, activity):
|
||||
@ -221,6 +225,14 @@ class PresenceService(dbus.service.Object):
|
||||
def BuddyDisappeared(self, buddy):
|
||||
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")
|
||||
def GetActivities(self):
|
||||
ret = []
|
||||
|
@ -29,7 +29,7 @@ import hashlib
|
||||
from telepathy.client import ConnectionManager, ManagerRegistry, Connection, Channel
|
||||
from telepathy.interfaces import (
|
||||
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 (
|
||||
CONNECTION_HANDLE_TYPE_NONE, CONNECTION_HANDLE_TYPE_CONTACT,
|
||||
CONNECTION_STATUS_CONNECTED, CONNECTION_STATUS_DISCONNECTED, CONNECTION_STATUS_CONNECTING,
|
||||
@ -84,7 +84,9 @@ class ServerPlugin(gobject.GObject):
|
||||
([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])),
|
||||
'contact-activities-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||
([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]))
|
||||
}
|
||||
|
||||
@ -422,7 +424,7 @@ class ServerPlugin(gobject.GObject):
|
||||
self.emit("contact-activities-changed", contact, activities_id)
|
||||
|
||||
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)
|
||||
|
||||
# hack
|
||||
@ -433,4 +435,8 @@ class ServerPlugin(gobject.GObject):
|
||||
if local_pending:
|
||||
for act_id, act_handle in self._activities.items():
|
||||
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