[Telepathy-commits] [telepathy-gabble/master] conn-olpc: check_gadget_{buddy, activity}: no need to query disco to check if the service was discovered as now we are notified when it is and update conn->olpc_gadget_{buddy, activity} accordingly
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Thu Oct 9 09:28:17 PDT 2008
---
src/conn-olpc.c | 48 ++++++++++++------------------------------------
1 files changed, 12 insertions(+), 36 deletions(-)
diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index e97d815..0eed836 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -151,58 +151,34 @@ static gboolean
check_gadget_buddy (GabbleConnection *conn,
DBusGMethodInvocation *context)
{
- const GabbleDiscoItem *item;
+ GError error = { TP_ERRORS, TP_ERROR_NETWORK_ERROR,
+ "Server does not provide Gadget Buddy service" };
if (conn->olpc_gadget_buddy != NULL)
return TRUE;
- item = gabble_disco_service_find (conn->disco, "collaboration", "gadget",
- NS_OLPC_BUDDY);
-
- if (item != NULL)
- conn->olpc_gadget_buddy = item->jid;
-
- if (conn->olpc_gadget_buddy == NULL)
- {
- GError error = { TP_ERRORS, TP_ERROR_NETWORK_ERROR,
- "Server does not provide Gadget Buddy service" };
-
- DEBUG ("%s", error.message);
- if (context != NULL)
- dbus_g_method_return_error (context, &error);
- return FALSE;
- }
+ DEBUG ("%s", error.message);
+ if (context != NULL)
+ dbus_g_method_return_error (context, &error);
- return TRUE;
+ return FALSE;
}
static gboolean
check_gadget_activity (GabbleConnection *conn,
DBusGMethodInvocation *context)
{
- const GabbleDiscoItem *item;
+ GError error = { TP_ERRORS, TP_ERROR_NETWORK_ERROR,
+ "Server does not provide Gadget Activity service" };
if (conn->olpc_gadget_activity != NULL)
return TRUE;
- item = gabble_disco_service_find (conn->disco, "collaboration", "gadget",
- NS_OLPC_ACTIVITY);
-
- if (item != NULL)
- conn->olpc_gadget_activity = item->jid;
-
- if (conn->olpc_gadget_activity == NULL)
- {
- GError error = { TP_ERRORS, TP_ERROR_NETWORK_ERROR,
- "Server does not provide Gadget Activity service" };
-
- DEBUG ("%s", error.message);
- if (context != NULL)
- dbus_g_method_return_error (context, &error);
- return FALSE;
- }
+ DEBUG ("%s", error.message);
+ if (context != NULL)
+ dbus_g_method_return_error (context, &error);
- return TRUE;
+ return FALSE;
}
/* context may be NULL, since this may be called in response to becoming
--
1.5.6.5
More information about the Telepathy-commits
mailing list