]> git.0d.be Git - empathy.git/blobdiff - goa-mc-plugin/mcp-account-manager-goa.c
Clean up #include directives in source files
[empathy.git] / goa-mc-plugin / mcp-account-manager-goa.c
index 911b2d6ca162574788800a17ed6f84354d9b76d7..dc9e036ee6db02aaa47d6b26a36f681e60f8807f 100644 (file)
  */
 
 #include "config.h"
-
-#include <glib/gi18n.h>
-
-#include <telepathy-glib/util.h>
+#include "mcp-account-manager-goa.h"
 
 #define GOA_API_IS_SUBJECT_TO_CHANGE /* awesome! */
 #include <goa/goa.h>
 
-#include "mcp-account-manager-goa.h"
-
 #define DEBUG g_debug
 #define GET_PRIVATE(self) (((McpAccountManagerGoa *) self)->priv)
 #define DECLARE_GASYNC_CALLBACK(name) \
@@ -149,6 +144,9 @@ get_tp_parameters (GoaAccount *account)
 
       PARAM ("param-account", "messenger.live.com");
       PARAM ("param-require-encryption", "true");
+      PARAM ("param-fallback-servers", "xmpp.messenger.live.com");
+      PARAM ("param-extra-certificate-identities",
+          "*.gateway.messenger.live.com");
     }
   else
     {
@@ -355,10 +353,10 @@ static void
 get_enabled (const McpAccountStorage *self,
     const McpAccountManager *am,
     const gchar *acc,
-    GoaObject *object)
+    GoaAccount *account)
 {
   mcp_account_manager_set_value (am, acc, "Enabled",
-      goa_object_peek_chat (object) != NULL ? "true" : "false");
+      goa_account_get_chat_disabled (account) == FALSE ? "true" : "false");
 }
 
 
@@ -418,11 +416,11 @@ mcp_account_manager_goa_get (const McpAccountStorage *self,
       g_strfreev (keys);
 
       /* Enabled */
-      get_enabled (self, am, acc, object);
+      get_enabled (self, am, acc, account);
     }
   else if (!tp_strdiff (key, "Enabled"))
     {
-      get_enabled (self, am, acc, object);
+      get_enabled (self, am, acc, account);
     }
   else
     {
@@ -467,18 +465,33 @@ mcp_account_manager_goa_set (const McpAccountStorage *self,
   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. */
+  DEBUG ("%s: (%s, %s, %s)", G_STRFUNC, account, key, val);
+
   if (!tp_strdiff (key, "Enabled"))
-    return TRUE;
+    {
+      GoaObject *object;
+      GoaAccount *acc;
 
-  DEBUG ("%s: (%s, %s, %s)", G_STRFUNC, account, key, val);
+      object = g_hash_table_lookup (priv->accounts, account);
+
+      if (object == NULL)
+        return FALSE;
+
+      acc = goa_object_peek_account (object);
+
+      if (acc == NULL)
+        return FALSE;
+
+      goa_account_set_chat_disabled (acc, tp_strdiff (val, "true"));
+      goto out;
+    }
 
   if (val != NULL)
     g_key_file_set_value (priv->store, account, key, val);
   else
     g_key_file_remove_key (priv->store, account, key, NULL);
 
+ out:
   /* Pretend we save everything so MC won't save this in accounts.cfg */
   return TRUE;
 }
@@ -561,8 +574,7 @@ mcp_account_manager_goa_get_restrictions (const McpAccountStorage *self,
     const gchar *account)
 {
   return TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PARAMETERS |
-         TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_SERVICE |
-         TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_ENABLED;
+         TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_SERVICE;
 }
 
 
@@ -589,13 +601,12 @@ mcp_account_manager_goa_get_identifier (const McpAccountStorage *self,
 static void
 account_storage_iface_init (McpAccountStorageIface *iface)
 {
-  mcp_account_storage_iface_set_name (iface, PLUGIN_NAME);
-  mcp_account_storage_iface_set_desc (iface, PLUGIN_DESCRIPTION);
-  mcp_account_storage_iface_set_priority (iface, PLUGIN_PRIORITY);
-  mcp_account_storage_iface_set_provider (iface, PLUGIN_PROVIDER);
+  iface->name = PLUGIN_NAME;
+  iface->desc = PLUGIN_DESCRIPTION;
+  iface->priority = PLUGIN_PRIORITY;
+  iface->provider = PLUGIN_PROVIDER;
 
-#define IMPLEMENT(x) mcp_account_storage_iface_implement_##x(iface, \
-    mcp_account_manager_goa_##x)
+#define IMPLEMENT(x) iface->x = mcp_account_manager_goa_##x
   IMPLEMENT (get);
   IMPLEMENT (list);
   IMPLEMENT (set);