[Telepathy-commits] [telepathy-gabble/master] Raise a D-Bus error if Gadget is not available when requesting a view channel
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Thu Oct 9 09:45:21 PDT 2008
---
src/olpc-gadget-manager.c | 14 ++++++++++++--
tests/twisted/olpc/olpc-activity-search.py | 12 +++++++++++-
tests/twisted/olpc/olpc-buddy-search.py | 12 +++++++++++-
3 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/src/olpc-gadget-manager.c b/src/olpc-gadget-manager.c
index 496f441..1262abd 100644
--- a/src/olpc-gadget-manager.c
+++ b/src/olpc-gadget-manager.c
@@ -301,7 +301,12 @@ create_buddy_view_channel (GabbleOlpcGadgetManager *self,
const gchar *alias;
GHashTable *properties;
- /* TODO: check if Gadget is available */
+ if (self->priv->conn->olpc_gadget_buddy == NULL)
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+ "Gadget is not available");
+ return NULL;
+ }
if ((tp_asv_get_uint32 (request_properties,
TP_IFACE_CHANNEL ".TargetHandleType", NULL) != 0) ||
@@ -368,7 +373,12 @@ create_activity_view_channel (GabbleOlpcGadgetManager *self,
GHashTable *properties;
GArray *participants;
- /* TODO: check if Gadget is available */
+ if (self->priv->conn->olpc_gadget_activity == NULL)
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+ "Gadget is not available");
+ return NULL;
+ }
if ((tp_asv_get_uint32 (request_properties,
TP_IFACE_CHANNEL ".TargetHandleType", NULL) != 0) ||
diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index d55c7c4..2373c02 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -54,7 +54,6 @@ def test(q, bus, conn, stream):
EventPattern('stream-iq', to='localhost', query_ns=NS_DISCO_ITEMS))
acknowledge_iq(stream, iq_event.stanza)
- announce_gadget(q, stream, disco_event.stanza)
activity_prop_iface = dbus.Interface(conn,
'org.laptop.Telepathy.ActivityProperties')
@@ -62,6 +61,17 @@ def test(q, bus, conn, stream):
gadget_iface = dbus.Interface(conn, 'org.laptop.Telepathy.Gadget')
requests_iface = dbus.Interface(conn, tp_name_prefix + '.Connection.Interface.Requests')
+ # Gadget was not announced yet
+ call_async(q, requests_iface, 'CreateChannel',
+ { 'org.freedesktop.Telepathy.Channel.ChannelType':
+ 'org.laptop.Telepathy.Channel.Type.ActivityView',
+ 'org.laptop.Telepathy.Channel.Interface.View.MaxSize': 5,
+ })
+
+ event = q.expect('dbus-error', method='CreateChannel')
+
+ announce_gadget(q, stream, disco_event.stanza)
+
sync_stream(q, stream)
# TODO: change view var name
diff --git a/tests/twisted/olpc/olpc-buddy-search.py b/tests/twisted/olpc/olpc-buddy-search.py
index c97573f..ca48193 100644
--- a/tests/twisted/olpc/olpc-buddy-search.py
+++ b/tests/twisted/olpc/olpc-buddy-search.py
@@ -39,12 +39,22 @@ def test(q, bus, conn, stream):
EventPattern('stream-iq', to='localhost', query_ns=NS_DISCO_ITEMS))
acknowledge_iq(stream, iq_event.stanza)
- announce_gadget(q, stream, disco_event.stanza)
buddy_info_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo')
gadget_iface = dbus.Interface(conn, 'org.laptop.Telepathy.Gadget')
requests_iface = dbus.Interface(conn, tp_name_prefix + '.Connection.Interface.Requests')
+ # Gadget was not announced yet
+ call_async(q, requests_iface, 'CreateChannel',
+ { 'org.freedesktop.Telepathy.Channel.ChannelType':
+ 'org.laptop.Telepathy.Channel.Type.BuddyView',
+ 'org.laptop.Telepathy.Channel.Interface.View.MaxSize': 5,
+ })
+
+ event = q.expect('dbus-error', method='CreateChannel')
+
+ announce_gadget(q, stream, disco_event.stanza)
+
call_async(q, conn, 'RequestHandles', 1, ['bob at localhost'])
event = q.expect('dbus-return', method='RequestHandles')
--
1.5.6.5
More information about the Telepathy-commits
mailing list