aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-account-manager.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-05 23:19:59 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-06 17:49:04 +0800
commit7445fd6d08294399972dd0c2c808d9aabfc11b20 (patch)
tree697f76c9a250d631a55a888bd3ff1290032fa818 /libempathy/empathy-account-manager.c
parent2d517a8bf5f8048a83d753fb0977d4949cbdeb7a (diff)
downloadgsoc2013-empathy-7445fd6d08294399972dd0c2c808d9aabfc11b20.tar
gsoc2013-empathy-7445fd6d08294399972dd0c2c808d9aabfc11b20.tar.gz
gsoc2013-empathy-7445fd6d08294399972dd0c2c808d9aabfc11b20.tar.bz2
gsoc2013-empathy-7445fd6d08294399972dd0c2c808d9aabfc11b20.tar.lz
gsoc2013-empathy-7445fd6d08294399972dd0c2c808d9aabfc11b20.tar.xz
gsoc2013-empathy-7445fd6d08294399972dd0c2c808d9aabfc11b20.tar.zst
gsoc2013-empathy-7445fd6d08294399972dd0c2c808d9aabfc11b20.zip
Add api to create accounts, by cm and proto name
Diffstat (limited to 'libempathy/empathy-account-manager.c')
-rw-r--r--libempathy/empathy-account-manager.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c
index fd8a21b1d..0d09ec5f0 100644
--- a/libempathy/empathy-account-manager.c
+++ b/libempathy/empathy-account-manager.c
@@ -22,6 +22,7 @@
#include "config.h"
#include <libmissioncontrol/mc-account-monitor.h>
+#include <telepathy-glib/util.h>
#include "empathy-account-manager.h"
#include "empathy-account-priv.h"
@@ -582,7 +583,7 @@ empathy_account_manager_dup_singleton (void)
}
EmpathyAccount *
-empathy_account_manager_create (EmpathyAccountManager *manager,
+empathy_account_manager_create_by_profile (EmpathyAccountManager *manager,
McProfile *profile)
{
McAccount *mc_account = mc_account_create (profile);
@@ -591,6 +592,45 @@ empathy_account_manager_create (EmpathyAccountManager *manager,
mc_account));
}
+EmpathyAccount *
+empathy_account_manager_create (EmpathyAccountManager *manager,
+ const gchar *connection_manager,
+ const gchar *protocol,
+ const gchar *display_name)
+{
+ McProfile *profile;
+ gboolean found;
+ GList *profiles, *l;
+ EmpathyAccount *result = NULL;
+
+ profiles = mc_profiles_list_by_protocol (protocol);
+
+ for (l = profiles; l != NULL; l = g_list_next (l)) {
+ McProtocol *protocol;
+ McManager *cm;
+
+ profile = MC_PROFILE (l->data);
+
+ protocol = mc_profile_get_protocol (profile);
+ cm = mc_protocol_get_manager (protocol);
+ found = !tp_strdiff (mc_manager_get_unique_name (cm),
+ connection_manager);
+
+ g_object_unref (protocol);
+ g_object_unref (manager);
+
+ if (found) {
+ result = empathy_account_manager_create_by_profile (manager, profile);
+ empathy_account_set_display_name (result, display_name);
+ break;
+ }
+ }
+
+ mc_profiles_free_list (profiles);
+
+ return result;
+}
+
int
empathy_account_manager_get_connected_accounts (EmpathyAccountManager *manager)
{