aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-08-27 21:41:32 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-08-27 21:41:32 +0800
commit607bea527c91d369b6f0d16b1bb63699310d71ed (patch)
treed1597fb64f00555682968fccfd49bdd37eb53d7d /libempathy
parentc8eb8757721031aba99238804896881f2182bd9e (diff)
parent8dba3957946252b622ba9c09e209f007d5961199 (diff)
downloadgsoc2013-empathy-607bea527c91d369b6f0d16b1bb63699310d71ed.tar
gsoc2013-empathy-607bea527c91d369b6f0d16b1bb63699310d71ed.tar.gz
gsoc2013-empathy-607bea527c91d369b6f0d16b1bb63699310d71ed.tar.bz2
gsoc2013-empathy-607bea527c91d369b6f0d16b1bb63699310d71ed.tar.lz
gsoc2013-empathy-607bea527c91d369b6f0d16b1bb63699310d71ed.tar.xz
gsoc2013-empathy-607bea527c91d369b6f0d16b1bb63699310d71ed.tar.zst
gsoc2013-empathy-607bea527c91d369b6f0d16b1bb63699310d71ed.zip
Merge commit 'jtellier/reconnect-account'
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-account.c43
-rw-r--r--libempathy/empathy-account.h7
2 files changed, 50 insertions, 0 deletions
diff --git a/libempathy/empathy-account.c b/libempathy/empathy-account.c
index 5527aab68..0e4758baa 100644
--- a/libempathy/empathy-account.c
+++ b/libempathy/empathy-account.c
@@ -976,6 +976,49 @@ empathy_account_set_enabled_async (EmpathyAccount *account,
}
static void
+account_reconnected_cb (TpAccount *proxy,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ GSimpleAsyncResult *result = user_data;
+
+ if (error != NULL)
+ g_simple_async_result_set_from_error (result, (GError *) error);
+
+ g_simple_async_result_complete (result);
+ g_object_unref (result);
+}
+
+gboolean
+empathy_account_reconnect_finish (EmpathyAccount *account,
+ GAsyncResult *result,
+ GError **error)
+{
+ if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
+ error) ||
+ !g_simple_async_result_is_valid (result, G_OBJECT (account),
+ empathy_account_reconnect_finish))
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+empathy_account_reconnect_async (EmpathyAccount *account,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ EmpathyAccountPriv *priv = GET_PRIV (account);
+
+ GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (account),
+ callback, user_data, empathy_account_reconnect_finish);
+
+ tp_cli_account_call_reconnect (priv->account,
+ -1, account_reconnected_cb, result, NULL, G_OBJECT (account));
+}
+
+static void
empathy_account_requested_presence_cb (TpProxy *proxy,
const GError *error,
gpointer user_data,
diff --git a/libempathy/empathy-account.h b/libempathy/empathy-account.h
index d327de60d..e789ca702 100644
--- a/libempathy/empathy-account.h
+++ b/libempathy/empathy-account.h
@@ -72,6 +72,13 @@ void empathy_account_set_enabled_async (EmpathyAccount *account,
gboolean empathy_account_set_enabled_finish (EmpathyAccount *account,
GAsyncResult *result, GError **error);
+void empathy_account_reconnect_async (EmpathyAccount *account,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean empathy_account_reconnect_finish (EmpathyAccount *account,
+ GAsyncResult *result,
+ GError **error);
+
gboolean empathy_account_is_enabled (EmpathyAccount *account);
gboolean empathy_account_is_valid (EmpathyAccount *account);