X-Git-Url: https://git.0d.be/?p=empathy.git;a=blobdiff_plain;f=goa-mc-plugin%2Fmcp-account-manager-goa.c;h=fd3942eaf359df2be0f1cb553828cc9b7ac9cbe1;hp=7804f9ea1dd0efa15b6bc0bbe5d8671e9fac647d;hb=2bfe326976653cd35b6f4af943746df084a9dad2;hpb=e49885103b7bd1754511282b05a1b44c13d7289f diff --git a/goa-mc-plugin/mcp-account-manager-goa.c b/goa-mc-plugin/mcp-account-manager-goa.c index 7804f9ea..fd3942ea 100644 --- a/goa-mc-plugin/mcp-account-manager-goa.c +++ b/goa-mc-plugin/mcp-account-manager-goa.c @@ -23,6 +23,8 @@ * Danielle Madeley */ +#include "config.h" + #include #include @@ -40,7 +42,7 @@ #define PLUGIN_NAME "goa" #define PLUGIN_PRIORITY (MCP_ACCOUNT_STORAGE_PLUGIN_PRIO_KEYRING + 10) #define PLUGIN_DESCRIPTION "Provide Telepathy Accounts from GOA" -#define PLUGIN_PROVIDER "org.gnome.OnlineAccounts" +#define PLUGIN_PROVIDER EMPATHY_GOA_PROVIDER #define INITIAL_COMMENT "Parameters of GOA Telepathy accounts" @@ -80,7 +82,7 @@ mcp_account_manager_goa_finalize (GObject *self) { McpAccountManagerGoaPrivate *priv = GET_PRIVATE (self); - g_hash_table_destroy (priv->accounts); + g_hash_table_unref (priv->accounts); g_key_file_free (priv->store); g_free (priv->filename); @@ -125,18 +127,35 @@ get_tp_parameters (GoaAccount *account) PARAM ("param-extra-certificate-identities", "talk.google.com"); PARAM ("param-require-encryption", "true"); } + else if (!tp_strdiff (type, "facebook")) + { + PARAM ("manager", "gabble"); + PARAM ("protocol", "jabber"); + PARAM ("Icon", "im-facebook"); + PARAM ("Service", "facebook"); + + PARAM ("param-account", "chat.facebook.com"); + PARAM ("param-require-encryption", "true"); + } + else if (!tp_strdiff (type, "windows_live")) + { + PARAM ("manager", "gabble"); + PARAM ("protocol", "jabber"); + PARAM ("Icon", "im-msn"); + PARAM ("Service", "windows-live"); + + PARAM ("param-account", "messenger.live.com"); + PARAM ("param-require-encryption", "true"); + } else { - /* unknown account type */ - g_hash_table_destroy (params); + DEBUG ("Unknown account type %s", type); + g_hash_table_unref (params); return NULL; } - /* TODO: add Facebook support */ - /* generic properties */ PARAM ("DisplayName", goa_account_get_presentation_identity (account)); - PARAM ("ConnectAutomatically", "true"); #undef PARAM @@ -160,7 +179,7 @@ get_tp_account_name (GoaAccount *account) (char *) g_hash_table_lookup (params, "protocol"), type, id); - g_hash_table_destroy (params); + g_hash_table_unref (params); return name; } @@ -380,7 +399,7 @@ mcp_account_manager_goa_get (const McpAccountStorage *self, while (g_hash_table_iter_next (&iter, &key, &value)) mcp_account_manager_set_value (am, acct, key, value); - g_hash_table_destroy (params); + g_hash_table_unref (params); /* Stored properties */ keys = g_key_file_get_keys (priv->store, acct, &nkeys, NULL); @@ -396,6 +415,8 @@ mcp_account_manager_goa_get (const McpAccountStorage *self, } } + g_strfreev (keys); + /* Enabled */ get_enabled (self, am, acct, object); } @@ -418,13 +439,21 @@ mcp_account_manager_goa_get (const McpAccountStorage *self, mcp_account_manager_set_value (am, acct, key, value); - g_hash_table_destroy (params); + g_hash_table_unref (params); g_free (value); } return TRUE; } +static gboolean +account_is_in_goa (const McpAccountStorage *self, + const gchar *account) +{ + McpAccountManagerGoaPrivate *priv = GET_PRIVATE (self); + + return (g_hash_table_lookup (priv->accounts, acct) != NULL); +} static gboolean mcp_account_manager_goa_set (const McpAccountStorage *self, @@ -436,6 +465,9 @@ mcp_account_manager_goa_set (const McpAccountStorage *self, McpAccountManagerGoaPrivate *priv = GET_PRIVATE (self); GError *error = NULL; + if (!account_is_in_goa (self, account)) + return FALSE; + /* No need to save Enabled, it's up to the GOA configuration if the account * is configured or not. */ if (!tp_strdiff (key, "Enabled")) @@ -461,6 +493,9 @@ mcp_account_manager_goa_delete (const McpAccountStorage *self, { McpAccountManagerGoaPrivate *priv = GET_PRIVATE (self); + if (!account_is_in_goa (self, account)) + return FALSE; + DEBUG ("%s: (%s, %s)", G_STRFUNC, account, key); if (key == NULL)