catch invitations request
This commit is contained in:
parent
375f61c9ee
commit
139b190650
@ -67,6 +67,7 @@ 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.start()
|
||||
|
||||
# Set up the link local connection
|
||||
@ -198,6 +199,12 @@ class PresenceService(dbus.service.Object):
|
||||
if len(activities) > 0:
|
||||
buddy.set_properties({'current-activity':activities[0]})
|
||||
|
||||
def _activity_invited(self, tp, act_id):
|
||||
activity = self._activities.get(act_id)
|
||||
if activity:
|
||||
pass
|
||||
# FIXME do something
|
||||
|
||||
@dbus.service.signal(_PRESENCE_INTERFACE, signature="o")
|
||||
def ActivityAppeared(self, activity):
|
||||
pass
|
||||
|
@ -83,7 +83,9 @@ class ServerPlugin(gobject.GObject):
|
||||
'properties-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||
([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])),
|
||||
'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,
|
||||
([gobject.TYPE_PYOBJECT]))
|
||||
}
|
||||
|
||||
def __init__(self, registry):
|
||||
@ -154,6 +156,7 @@ class ServerPlugin(gobject.GObject):
|
||||
del acct
|
||||
|
||||
conn[CONN_INTERFACE].connect_to_signal('StatusChanged', self._status_changed_cb)
|
||||
conn[CONN_INTERFACE].connect_to_signal('NewChannel', self._new_channel_cb)
|
||||
|
||||
# hack
|
||||
conn._valid_interfaces.add(CONN_INTERFACE_PRESENCE)
|
||||
@ -417,3 +420,17 @@ class ServerPlugin(gobject.GObject):
|
||||
self._activities[act_id] = act_handle
|
||||
activities_id = map(lambda x: x[0], activities)
|
||||
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:
|
||||
channel = Channel(self._conn._dbus_object._named_service, object_path)
|
||||
|
||||
# hack
|
||||
channel._valid_interfaces.add(CHANNEL_INTERFACE_GROUP)
|
||||
|
||||
current, local_pending, remote_pending = channel[CHANNEL_INTERFACE_GROUP].GetAllMembers()
|
||||
|
||||
if local_pending:
|
||||
for act_id, act_handle in self._activities.items():
|
||||
if handle == act_handle:
|
||||
self.emit("activity-invited", act_id)
|
||||
|
Loading…
Reference in New Issue
Block a user