diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-09-14 18:08:59 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-09-14 18:08:59 +0800 |
commit | 3ee3162a25751ce528cf84661b2d515820b15cfb (patch) | |
tree | 7914730ce92aa230695fd76176d047882b95f7e9 /src/empathy-import-utils.c | |
parent | ddcb7848002b70bc8950d45a9079582a8787c394 (diff) | |
download | gsoc2013-empathy-3ee3162a25751ce528cf84661b2d515820b15cfb.tar gsoc2013-empathy-3ee3162a25751ce528cf84661b2d515820b15cfb.tar.gz gsoc2013-empathy-3ee3162a25751ce528cf84661b2d515820b15cfb.tar.bz2 gsoc2013-empathy-3ee3162a25751ce528cf84661b2d515820b15cfb.tar.lz gsoc2013-empathy-3ee3162a25751ce528cf84661b2d515820b15cfb.tar.xz gsoc2013-empathy-3ee3162a25751ce528cf84661b2d515820b15cfb.tar.zst gsoc2013-empathy-3ee3162a25751ce528cf84661b2d515820b15cfb.zip |
Move protocol_is_supported() to empathy-import-utils
Diffstat (limited to 'src/empathy-import-utils.c')
-rw-r--r-- | src/empathy-import-utils.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/empathy-import-utils.c b/src/empathy-import-utils.c index f84b20609..520f056f4 100644 --- a/src/empathy-import-utils.c +++ b/src/empathy-import-utils.c @@ -21,6 +21,7 @@ #include <telepathy-glib/util.h> +#include <libempathy/empathy-connection-managers.h> #include <libempathy/empathy-utils.h> #include "empathy-import-utils.h" @@ -74,3 +75,46 @@ empathy_import_accounts_load (EmpathyImportApplication id) return empathy_import_pidgin_load (); } + +gboolean +empathy_import_protocol_is_supported (const gchar *protocol, + TpConnectionManager **cm) +{ + EmpathyConnectionManagers *manager; + GList *cms; + GList *l; + gboolean proto_is_supported = FALSE; + + manager = empathy_connection_managers_dup_singleton (); + cms = empathy_connection_managers_get_cms (manager); + + for (l = cms; l; l = l->next) + { + + TpConnectionManager *tp_cm = l->data; + if (tp_connection_manager_has_protocol (tp_cm, + (const gchar*) protocol)) + { + if (!proto_is_supported) + { + *cm = tp_cm; + proto_is_supported = TRUE; + + continue; + } + + /* we have more than one CM for this protocol, + * select the one which is not haze. + */ + if (!tp_strdiff ((*cm)->name, "haze")) + { + *cm = tp_cm; + break; + } + } + } + + g_object_unref (manager); + + return proto_is_supported; +} |