2 * Copyright (C) 2008 Collabora Ltd.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 * Authors: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
19 * Sjoerd Simons <sjoerd.simons@collabora.co.uk>
24 #include <telepathy-glib/util.h>
25 #include <telepathy-glib/account-manager.h>
26 #include <telepathy-glib/enums.h>
27 #include <telepathy-glib/defs.h>
28 #include <telepathy-glib/dbus.h>
29 #include <telepathy-glib/interfaces.h>
31 #include "empathy-account-manager.h"
32 #include "empathy-marshal.h"
33 #include "empathy-utils.h"
35 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
36 #include <libempathy/empathy-debug.h>
38 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountManager)
40 #define MC5_BUS_NAME "org.freedesktop.Telepathy.MissionControl5"
43 /* (owned) unique name -> (reffed) EmpathyAccount */
49 TpAccountManager *tp_manager;
53 EmpathyAccount *global_account;
55 TpConnectionPresenceType global_presence;
57 gchar *global_status_message;
59 /* requested global presence, could be different
60 * from the actual global one.
62 TpConnectionPresenceType requested_presence;
63 gchar *requested_status;
64 gchar *requested_status_message;
66 GHashTable *create_results;
67 } EmpathyAccountManagerPriv;
75 ACCOUNT_CONNECTION_CHANGED,
76 GLOBAL_PRESENCE_CHANGED,
85 static guint signals[LAST_SIGNAL];
86 static EmpathyAccountManager *manager_singleton = NULL;
88 G_DEFINE_TYPE (EmpathyAccountManager, empathy_account_manager, G_TYPE_OBJECT);
91 emp_account_connection_cb (EmpathyAccount *account,
95 TpConnection *connection = empathy_account_get_connection (account);
97 DEBUG ("Signalling connection %p of account %s",
98 connection, empathy_account_get_unique_name (account));
100 if (connection != NULL)
101 g_signal_emit (manager, signals[NEW_CONNECTION], 0, connection);
105 emp_account_enabled_cb (EmpathyAccount *account,
109 if (empathy_account_is_enabled (account))
110 g_signal_emit (manager, signals[ACCOUNT_ENABLED], 0, account);
112 g_signal_emit (manager, signals[ACCOUNT_DISABLED], 0, account);
116 emp_account_status_changed_cb (EmpathyAccount *account,
117 TpConnectionStatus old,
118 TpConnectionStatus new,
119 TpConnectionStatusReason reason,
122 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (user_data);
123 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
127 case TP_CONNECTION_STATUS_CONNECTING:
130 case TP_CONNECTION_STATUS_CONNECTED:
139 case TP_CONNECTION_STATUS_CONNECTING:
142 case TP_CONNECTION_STATUS_CONNECTED:
149 g_signal_emit (manager, signals[ACCOUNT_CONNECTION_CHANGED], 0,
150 account, reason, new, old);
154 emp_account_manager_update_global_presence (EmpathyAccountManager *manager)
156 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
157 TpConnectionPresenceType presence = TP_CONNECTION_PRESENCE_TYPE_OFFLINE;
158 EmpathyAccount *account = NULL;
162 /* Make the global presence is equal to the presence of the account with the
163 * highest availability */
165 g_hash_table_iter_init (&iter, priv->accounts);
166 while (g_hash_table_iter_next (&iter, NULL, &value))
168 EmpathyAccount *a = EMPATHY_ACCOUNT (value);
169 TpConnectionPresenceType p;
171 g_object_get (a, "presence", &p, NULL);
173 if (tp_connection_presence_type_cmp_availability (p, presence) > 0)
180 priv->global_account = account;
181 g_free (priv->global_status);
182 g_free (priv->global_status_message);
186 priv->global_presence = presence;
187 priv->global_status = NULL;
188 priv->global_status_message = NULL;
192 g_object_get (account,
193 "presence", &priv->global_presence,
194 "status", &priv->global_status,
195 "status-message", &priv->global_status_message,
198 DEBUG ("Updated global presence to: %s (%d) \"%s\"",
199 priv->global_status, priv->global_presence, priv->global_status_message);
203 emp_account_presence_changed_cb (EmpathyAccount *account,
204 TpConnectionPresenceType presence,
206 const gchar *status_message,
209 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (user_data);
210 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
212 if (tp_connection_presence_type_cmp_availability (presence,
213 priv->global_presence) > 0)
215 priv->global_account = account;
217 priv->global_presence = presence;
219 g_free (priv->global_status);
220 priv->global_status = g_strdup (status);
222 g_free (priv->global_status_message);
223 priv->global_status_message = g_strdup (status_message);
227 else if (priv->global_account == account)
229 emp_account_manager_update_global_presence (manager);
235 g_signal_emit (manager, signals[GLOBAL_PRESENCE_CHANGED], 0,
236 priv->global_presence, priv->global_status, priv->global_status_message);
240 emp_account_removed_cb (EmpathyAccount *account, gpointer user_data)
242 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (user_data);
243 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
245 g_object_ref (account);
246 g_hash_table_remove (priv->accounts,
247 empathy_account_get_unique_name (account));
249 g_signal_emit (manager, signals[ACCOUNT_DELETED], 0, account);
250 g_object_unref (account);
254 empathy_account_manager_check_ready (EmpathyAccountManager *manager)
256 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
263 g_hash_table_iter_init (&iter, priv->accounts);
264 while (g_hash_table_iter_next (&iter, NULL, &value))
266 EmpathyAccount *account = EMPATHY_ACCOUNT (value);
269 g_object_get (account, "ready", &ready, NULL);
275 /* Rerequest global presence on the initial set of accounts for cases where a
276 * global presence was requested before the manager was ready */
277 if (priv->requested_presence != TP_CONNECTION_PRESENCE_TYPE_UNSET)
278 empathy_account_manager_request_global_presence (manager,
279 priv->requested_presence,
280 priv->requested_status,
281 priv->requested_status_message);
284 g_object_notify (G_OBJECT (manager), "ready");
288 account_manager_account_ready_cb (GObject *obj,
292 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (user_data);
293 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
294 EmpathyAccount *account = EMPATHY_ACCOUNT (obj);
295 GSimpleAsyncResult *result;
298 g_object_get (account, "ready", &ready, NULL);
303 /* see if there's any pending callbacks for this account */
304 result = g_hash_table_lookup (priv->create_results, account);
307 g_simple_async_result_set_op_res_gpointer (
308 G_SIMPLE_ASYNC_RESULT (result), account, NULL);
310 g_simple_async_result_complete (result);
312 g_hash_table_remove (priv->create_results, account);
313 g_object_unref (result);
316 g_signal_emit (manager, signals[ACCOUNT_CREATED], 0, account);
318 g_signal_connect (account, "notify::connection",
319 G_CALLBACK (emp_account_connection_cb), manager);
321 g_signal_connect (account, "notify::enabled",
322 G_CALLBACK (emp_account_enabled_cb), manager);
324 g_signal_connect (account, "status-changed",
325 G_CALLBACK (emp_account_status_changed_cb), manager);
327 g_signal_connect (account, "presence-changed",
328 G_CALLBACK (emp_account_presence_changed_cb), manager);
330 g_signal_connect (account, "removed",
331 G_CALLBACK (emp_account_removed_cb), manager);
333 empathy_account_manager_check_ready (manager);
337 empathy_account_manager_get_account (EmpathyAccountManager *manager,
340 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
342 return g_hash_table_lookup (priv->accounts, path);
346 empathy_account_manager_ensure_account (EmpathyAccountManager *manager,
349 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
350 EmpathyAccount *account;
352 account = g_hash_table_lookup (priv->accounts, path);
356 account = empathy_account_new (priv->dbus, path);
357 g_hash_table_insert (priv->accounts, g_strdup (path), account);
359 g_signal_connect (account, "notify::ready",
360 G_CALLBACK (account_manager_account_ready_cb), manager);
367 account_manager_got_all_cb (TpProxy *proxy,
368 GHashTable *properties,
371 GObject *weak_object)
373 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (weak_object);
379 DEBUG ("Failed to get account manager properties: %s", error->message);
383 accounts = tp_asv_get_boxed (properties, "ValidAccounts",
384 EMPATHY_ARRAY_TYPE_OBJECT);
386 if (accounts != NULL)
388 for (i = 0; i < accounts->len; i++)
390 gchar *name = g_ptr_array_index (accounts, i);
392 empathy_account_manager_ensure_account (manager, name);
396 empathy_account_manager_check_ready (manager);
400 account_validity_changed_cb (TpAccountManager *proxy,
404 GObject *weak_object)
406 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (weak_object);
411 empathy_account_manager_ensure_account (manager, path);
415 account_manager_name_owner_cb (TpDBusDaemon *proxy,
417 const gchar *new_owner,
420 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (user_data);
421 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
423 tp_dbus_daemon_cancel_name_owner_watch (proxy, name,
424 account_manager_name_owner_cb, user_data);
426 priv->tp_manager = tp_account_manager_new (priv->dbus);
428 tp_cli_account_manager_connect_to_account_validity_changed (
430 account_validity_changed_cb,
436 tp_cli_dbus_properties_call_get_all (priv->tp_manager, -1,
437 TP_IFACE_ACCOUNT_MANAGER,
438 account_manager_got_all_cb,
445 empathy_account_manager_init (EmpathyAccountManager *manager)
447 EmpathyAccountManagerPriv *priv;
450 priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
451 EMPATHY_TYPE_ACCOUNT_MANAGER, EmpathyAccountManagerPriv);
453 manager->priv = priv;
454 priv->connected = priv->connecting = 0;
455 priv->global_presence = TP_CONNECTION_PRESENCE_TYPE_UNSET;
457 priv->accounts = g_hash_table_new_full (g_str_hash, g_str_equal,
458 g_free, (GDestroyNotify) g_object_unref);
460 priv->create_results = g_hash_table_new (g_direct_hash, g_direct_equal);
462 priv->dbus = tp_dbus_daemon_dup (NULL);
464 tp_dbus_daemon_watch_name_owner (priv->dbus,
465 TP_ACCOUNT_MANAGER_BUS_NAME,
466 account_manager_name_owner_cb,
470 /* trigger MC5 starting */
471 mc5_proxy = g_object_new (TP_TYPE_PROXY,
472 "dbus-daemon", priv->dbus,
473 "dbus-connection", tp_proxy_get_dbus_connection (TP_PROXY (priv->dbus)),
474 "bus-name", MC5_BUS_NAME,
478 tp_cli_dbus_peer_call_ping (mc5_proxy, -1, NULL, NULL, NULL, NULL);
480 g_object_unref (mc5_proxy);
484 do_finalize (GObject *obj)
486 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (obj);
487 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
489 g_hash_table_destroy (priv->create_results);
490 g_hash_table_destroy (priv->accounts);
492 g_free (priv->global_status);
493 g_free (priv->global_status_message);
495 g_free (priv->requested_status);
496 g_free (priv->requested_status_message);
498 G_OBJECT_CLASS (empathy_account_manager_parent_class)->finalize (obj);
502 do_dispose (GObject *obj)
504 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (obj);
505 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
507 GSimpleAsyncResult *result;
509 if (priv->dispose_run)
512 priv->dispose_run = TRUE;
514 /* the manager is being destroyed while there are account creation
515 * processes pending; this should not happen, but emit the callbacks
516 * with an error anyway.
518 g_hash_table_iter_init (&iter, priv->create_results);
519 while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &result))
521 g_simple_async_result_set_error (result, G_IO_ERROR,
522 G_IO_ERROR_CANCELLED, "The account manager was disposed while "
523 "creating the account");
524 g_simple_async_result_complete (result);
525 g_object_unref (result);
527 g_hash_table_remove_all (priv->create_results);
529 if (priv->dbus != NULL)
531 tp_dbus_daemon_cancel_name_owner_watch (priv->dbus,
532 TP_ACCOUNT_MANAGER_BUS_NAME, account_manager_name_owner_cb, manager);
534 g_object_unref (priv->dbus);
538 G_OBJECT_CLASS (empathy_account_manager_parent_class)->dispose (obj);
542 do_constructor (GType type,
543 guint n_construct_params,
544 GObjectConstructParam *construct_params)
548 if (!manager_singleton)
550 retval = G_OBJECT_CLASS (empathy_account_manager_parent_class)->constructor (type,
553 manager_singleton = EMPATHY_ACCOUNT_MANAGER (retval);
554 g_object_add_weak_pointer (retval, (gpointer) &manager_singleton);
558 retval = g_object_ref (manager_singleton);
565 do_get_property (GObject *object,
570 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (object);
571 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
576 g_value_set_boolean (value, priv->ready);
579 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
585 empathy_account_manager_class_init (EmpathyAccountManagerClass *klass)
587 GObjectClass *oclass = G_OBJECT_CLASS (klass);
589 oclass->finalize = do_finalize;
590 oclass->dispose = do_dispose;
591 oclass->constructor = do_constructor;
592 oclass->get_property = do_get_property;
594 g_object_class_install_property (oclass, PROP_READY,
595 g_param_spec_boolean ("ready",
597 "Whether the initial state dump from the account manager is finished",
599 G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
601 signals[ACCOUNT_CREATED] =
602 g_signal_new ("account-created",
603 G_TYPE_FROM_CLASS (klass),
607 g_cclosure_marshal_VOID__OBJECT,
609 1, EMPATHY_TYPE_ACCOUNT);
611 signals[ACCOUNT_DELETED] =
612 g_signal_new ("account-deleted",
613 G_TYPE_FROM_CLASS (klass),
617 g_cclosure_marshal_VOID__OBJECT,
619 1, EMPATHY_TYPE_ACCOUNT);
621 signals[ACCOUNT_ENABLED] =
622 g_signal_new ("account-enabled",
623 G_TYPE_FROM_CLASS (klass),
627 g_cclosure_marshal_VOID__OBJECT,
629 1, EMPATHY_TYPE_ACCOUNT);
631 signals[ACCOUNT_DISABLED] =
632 g_signal_new ("account-disabled",
633 G_TYPE_FROM_CLASS (klass),
637 g_cclosure_marshal_VOID__OBJECT,
639 1, EMPATHY_TYPE_ACCOUNT);
641 signals[ACCOUNT_CHANGED] =
642 g_signal_new ("account-changed",
643 G_TYPE_FROM_CLASS (klass),
647 g_cclosure_marshal_VOID__OBJECT,
649 1, EMPATHY_TYPE_ACCOUNT);
651 signals[ACCOUNT_CONNECTION_CHANGED] =
652 g_signal_new ("account-connection-changed",
653 G_TYPE_FROM_CLASS (klass),
657 _empathy_marshal_VOID__OBJECT_INT_UINT_UINT,
659 4, EMPATHY_TYPE_ACCOUNT,
660 G_TYPE_INT, /* reason */
661 G_TYPE_UINT, /* actual connection */
662 G_TYPE_UINT); /* previous connection */
664 signals[GLOBAL_PRESENCE_CHANGED] =
665 g_signal_new ("global-presence-changed",
666 G_TYPE_FROM_CLASS (klass),
670 _empathy_marshal_VOID__UINT_STRING_STRING,
672 3, G_TYPE_UINT, /* Presence type */
673 G_TYPE_STRING, /* status */
674 G_TYPE_STRING); /* stauts message*/
676 signals[NEW_CONNECTION] =
677 g_signal_new ("new-connection",
678 G_TYPE_FROM_CLASS (klass),
682 g_cclosure_marshal_VOID__OBJECT,
684 1, TP_TYPE_CONNECTION);
686 g_type_class_add_private (oclass, sizeof (EmpathyAccountManagerPriv));
691 EmpathyAccountManager *
692 empathy_account_manager_dup_singleton (void)
694 return g_object_new (EMPATHY_TYPE_ACCOUNT_MANAGER, NULL);
698 empathy_account_manager_is_ready (EmpathyAccountManager *manager)
700 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
706 empathy_account_manager_get_connected_accounts (EmpathyAccountManager *manager)
708 EmpathyAccountManagerPriv *priv;
710 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), 0);
712 priv = GET_PRIV (manager);
714 return priv->connected;
718 empathy_account_manager_get_connecting_accounts (EmpathyAccountManager *manager)
720 EmpathyAccountManagerPriv *priv;
722 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), 0);
724 priv = GET_PRIV (manager);
726 return priv->connecting;
730 * empathy_account_manager_get_count:
731 * @manager: a #EmpathyAccountManager
733 * Get the number of accounts.
735 * Returns: the number of accounts.
738 empathy_account_manager_get_count (EmpathyAccountManager *manager)
740 EmpathyAccountManagerPriv *priv;
742 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), 0);
744 priv = GET_PRIV (manager);
746 return g_hash_table_size (priv->accounts);
750 empathy_account_manager_get_account_for_connection (
751 EmpathyAccountManager *manager,
752 TpConnection *connection)
754 EmpathyAccountManagerPriv *priv;
758 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), 0);
760 priv = GET_PRIV (manager);
762 g_hash_table_iter_init (&iter, priv->accounts);
763 while (g_hash_table_iter_next (&iter, NULL, &value))
765 EmpathyAccount *account = EMPATHY_ACCOUNT (value);
767 if (connection == empathy_account_get_connection (account))
775 empathy_account_manager_dup_accounts (EmpathyAccountManager *manager)
777 EmpathyAccountManagerPriv *priv;
780 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), NULL);
782 priv = GET_PRIV (manager);
784 ret = g_hash_table_get_values (priv->accounts);
785 g_list_foreach (ret, (GFunc) g_object_ref, NULL);
791 * empathy_account_manager_dup_connections:
792 * @manager: a #EmpathyAccountManager
794 * Get a #GList of all ready #TpConnection. The list must be freed with
795 * g_list_free, and its elements must be unreffed.
797 * Returns: the list of connections
800 empathy_account_manager_dup_connections (EmpathyAccountManager *manager)
802 EmpathyAccountManagerPriv *priv;
807 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), NULL);
809 priv = GET_PRIV (manager);
811 g_hash_table_iter_init (&iter, priv->accounts);
812 while (g_hash_table_iter_next (&iter, NULL, &value))
814 EmpathyAccount *account = EMPATHY_ACCOUNT (value);
815 TpConnection *connection;
817 connection = empathy_account_get_connection (account);
818 if (connection != NULL)
819 ret = g_list_prepend (ret, g_object_ref (connection));
826 empathy_account_manager_request_global_presence (
827 EmpathyAccountManager *manager,
828 TpConnectionPresenceType type,
830 const gchar *message)
832 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
836 DEBUG ("request global presence, type: %d, status: %s, message: %s",
837 type, status, message);
839 g_hash_table_iter_init (&iter, priv->accounts);
840 while (g_hash_table_iter_next (&iter, NULL, &value))
842 EmpathyAccount *account = EMPATHY_ACCOUNT (value);
845 g_object_get (account, "ready", &ready, NULL);
848 empathy_account_request_presence (account, type, status, message);
851 /* save the requested global presence, to use it in case we create
852 * new accounts or some accounts become ready.
854 priv->requested_presence = type;
856 if (tp_strdiff (priv->requested_status, status))
858 g_free (priv->requested_status);
859 priv->requested_status = g_strdup (status);
862 if (tp_strdiff (priv->requested_status_message, message))
864 g_free (priv->requested_status_message);
865 priv->requested_status_message = g_strdup (message);
869 TpConnectionPresenceType
870 empathy_account_manager_get_requested_global_presence (
871 EmpathyAccountManager *manager,
875 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
878 *status = g_strdup (priv->requested_status);
880 *message = g_strdup (priv->requested_status_message);
882 return priv->requested_presence;
885 TpConnectionPresenceType
886 empathy_account_manager_get_global_presence (
887 EmpathyAccountManager *manager,
891 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
894 *status = g_strdup (priv->global_status);
896 *message = g_strdup (priv->global_status_message);
898 return priv->global_presence;
902 empathy_account_manager_created_cb (TpAccountManager *proxy,
903 const gchar *account_path,
906 GObject *weak_object)
908 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (weak_object);
909 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
910 GSimpleAsyncResult *my_res = user_data;
911 EmpathyAccount *account;
915 g_simple_async_result_set_from_error (my_res,
917 g_simple_async_result_complete (my_res);
918 g_object_unref (my_res);
923 account = empathy_account_manager_ensure_account (manager, account_path);
925 g_hash_table_insert (priv->create_results, account, my_res);
929 empathy_account_manager_create_account_async (EmpathyAccountManager *manager,
930 const gchar *connection_manager,
931 const gchar *protocol,
932 const gchar *display_name,
933 GHashTable *parameters,
934 GHashTable *properties,
935 GAsyncReadyCallback callback,
938 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
939 GSimpleAsyncResult *res;
941 res = g_simple_async_result_new
942 (G_OBJECT (manager), callback, user_data,
943 empathy_account_manager_create_account_finish);
945 tp_cli_account_manager_call_create_account (priv->tp_manager,
952 empathy_account_manager_created_cb,
959 empathy_account_manager_create_account_finish (
960 EmpathyAccountManager *manager, GAsyncResult *result, GError **error)
962 EmpathyAccount *retval;
964 if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
968 g_return_val_if_fail (g_simple_async_result_is_valid (result,
969 G_OBJECT (manager), empathy_account_manager_create_account_finish), NULL);
971 retval = EMPATHY_ACCOUNT (g_simple_async_result_get_op_res_gpointer (
972 G_SIMPLE_ASYNC_RESULT (result)));