diff options
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-account-manager.c | 16 | ||||
-rw-r--r-- | libempathy/empathy-account-manager.h | 3 | ||||
-rw-r--r-- | libempathy/empathy-dispatcher.c | 2 |
3 files changed, 17 insertions, 4 deletions
diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c index 2f0f13415..20facd379 100644 --- a/libempathy/empathy-account-manager.c +++ b/libempathy/empathy-account-manager.c @@ -337,6 +337,15 @@ empathy_account_manager_get_account (EmpathyAccountManager *manager, const gchar *path) { EmpathyAccountManagerPriv *priv = GET_PRIV (manager); + + return g_hash_table_lookup (priv->accounts, path); +} + +EmpathyAccount * +empathy_account_manager_ensure_account (EmpathyAccountManager *manager, + const gchar *path) +{ + EmpathyAccountManagerPriv *priv = GET_PRIV (manager); EmpathyAccount *account; account = g_hash_table_lookup (priv->accounts, path); @@ -352,6 +361,7 @@ empathy_account_manager_get_account (EmpathyAccountManager *manager, return account; } + static void account_manager_got_all_cb (TpProxy *proxy, GHashTable *properties, @@ -378,7 +388,7 @@ account_manager_got_all_cb (TpProxy *proxy, { gchar *name = g_ptr_array_index (accounts, i); - empathy_account_manager_get_account (manager, name); + empathy_account_manager_ensure_account (manager, name); } } @@ -397,7 +407,7 @@ account_validity_changed_cb (TpAccountManager *proxy, if (!valid) return; - empathy_account_manager_get_account (manager, path); + empathy_account_manager_ensure_account (manager, path); } static void @@ -909,7 +919,7 @@ empathy_account_manager_created_cb (TpAccountManager *proxy, return; } - account = empathy_account_manager_get_account (manager, account_path); + account = empathy_account_manager_ensure_account (manager, account_path); g_hash_table_insert (priv->create_results, account, my_res); } diff --git a/libempathy/empathy-account-manager.h b/libempathy/empathy-account-manager.h index e0ec93761..25adfdbeb 100644 --- a/libempathy/empathy-account-manager.h +++ b/libempathy/empathy-account-manager.h @@ -69,6 +69,9 @@ int empathy_account_manager_get_count EmpathyAccount * empathy_account_manager_get_account_for_connection (EmpathyAccountManager *manager, TpConnection *connection); +EmpathyAccount * empathy_account_manager_ensure_account + (EmpathyAccountManager *manager, + const gchar *unique_name); EmpathyAccount * empathy_account_manager_get_account (EmpathyAccountManager *manager, const gchar *unique_name); diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 7e1492de8..465f23b75 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -1800,7 +1800,7 @@ empathy_dispatcher_handle_channels (TpSvcClientHandler *self, EmpathyAccount *account; TpConnection *connection; - account = empathy_account_manager_get_account (priv->account_manager, + account = empathy_account_manager_ensure_account (priv->account_manager, account_path); g_assert (account != NULL); |