]> git.0d.be Git - empathy.git/blob - ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c
Add skeleton of an MC plugin to import Ubuntu Online Accounts
[empathy.git] / ubuntu-online-accounts / mc-plugin / mcp-account-manager-uoa.c
1 /*
2  * Copyright © 2012 Collabora Ltd.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18
19 #include "config.h"
20 #include "mcp-account-manager-uoa.h"
21
22 #include <telepathy-glib/telepathy-glib.h>
23
24 #include <string.h>
25 #include <ctype.h>
26
27 #define PLUGIN_NAME "uoa"
28 #define PLUGIN_PRIORITY (MCP_ACCOUNT_STORAGE_PLUGIN_PRIO_KEYRING + 10)
29 #define PLUGIN_DESCRIPTION "Provide Telepathy Accounts from UOA via libaccounts-glib"
30 #define PLUGIN_PROVIDER EMPATHY_UOA_PROVIDER
31
32 #define DEBUG g_debug
33
34 static void account_storage_iface_init (McpAccountStorageIface *iface);
35
36 G_DEFINE_TYPE_WITH_CODE (McpAccountManagerUoa, mcp_account_manager_uoa,
37     G_TYPE_OBJECT,
38     G_IMPLEMENT_INTERFACE (MCP_TYPE_ACCOUNT_STORAGE,
39         account_storage_iface_init));
40
41 struct _McpAccountManagerUoaPrivate
42 {
43 };
44
45 static void
46 mcp_account_manager_uoa_dispose (GObject *object)
47 {
48   G_OBJECT_CLASS (mcp_account_manager_uoa_parent_class)->dispose (object);
49 }
50
51 static void
52 mcp_account_manager_uoa_init (McpAccountManagerUoa *self)
53 {
54   DEBUG ("UOA MC plugin initialised");
55
56   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
57       MCP_TYPE_ACCOUNT_MANAGER_UOA, McpAccountManagerUoaPrivate);
58 }
59
60 static void
61 mcp_account_manager_uoa_class_init (McpAccountManagerUoaClass *klass)
62 {
63   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
64
65   gobject_class->dispose = mcp_account_manager_uoa_dispose;
66
67   g_type_class_add_private (gobject_class,
68       sizeof (McpAccountManagerUoaPrivate));
69 }
70
71 static GList *
72 account_manager_uoa_list (const McpAccountStorage *storage,
73     const McpAccountManager *am)
74 {
75   return NULL;
76 }
77
78 static gboolean
79 account_manager_uoa_get (const McpAccountStorage *storage,
80     const McpAccountManager *am,
81     const gchar *acc,
82     const gchar *key)
83 {
84   return FALSE;
85 }
86
87 static gboolean
88 account_manager_uoa_set (const McpAccountStorage *storage,
89     const McpAccountManager *am,
90     const gchar *acc,
91     const gchar *key,
92     const gchar *val)
93 {
94   return FALSE;
95 }
96
97 static gboolean
98 account_manager_uoa_delete (const McpAccountStorage *storage,
99     const McpAccountManager *am,
100     const gchar *acc,
101     const gchar *key)
102 {
103   return FALSE;
104 }
105
106 static gboolean
107 account_manager_uoa_commit (const McpAccountStorage *storage,
108     const McpAccountManager *am)
109 {
110   return FALSE;
111 }
112
113 static void
114 account_manager_uoa_ready (const McpAccountStorage *storage,
115     const McpAccountManager *am)
116 {
117 }
118
119 static void
120 account_manager_uoa_get_identifier (const McpAccountStorage *storage,
121     const gchar *acc,
122     GValue *identifier)
123 {
124 }
125
126 static gchar *
127 account_manager_uoa_create_account (const McpAccountStorage *storage,
128     const gchar *cm_name,
129     const gchar *protocol_name,
130     GHashTable *params)
131 {
132   return NULL;
133 }
134
135 static void
136 account_storage_iface_init (McpAccountStorageIface *iface)
137 {
138   mcp_account_storage_iface_set_name (iface, PLUGIN_NAME);
139   mcp_account_storage_iface_set_desc (iface, PLUGIN_DESCRIPTION);
140   mcp_account_storage_iface_set_priority (iface, PLUGIN_PRIORITY);
141   mcp_account_storage_iface_set_provider (iface, PLUGIN_PROVIDER);
142
143 #define IMPLEMENT(x) mcp_account_storage_iface_implement_##x(iface, \
144     account_manager_uoa_##x)
145   IMPLEMENT (get);
146   IMPLEMENT (list);
147   IMPLEMENT (set);
148   IMPLEMENT (delete);
149   IMPLEMENT (commit);
150   IMPLEMENT (ready);
151   IMPLEMENT (get_identifier);
152   IMPLEMENT (create_account);
153 #undef IMPLEMENT
154 }
155
156 McpAccountManagerUoa *
157 mcp_account_manager_uoa_new (void)
158 {
159   return g_object_new (MCP_TYPE_ACCOUNT_MANAGER_UOA, NULL);
160 }