1
/* windows-live.c generated by valac 0.16.1, the Vala compiler
2
* generated from windows-live.vala, do not modify */
5
* Copyright (C) 2012 Collabora Ltd.
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23
* Xavier Claessens <xavier.claessens@collabora.co.uk>
27
#include <glib-object.h>
28
#include <libaccount-plugin/account-plugin.h>
29
#include <libaccounts-glib/accounts-glib.h>
35
#define TYPE_WINDOWS_LIVE_PLUGIN (windows_live_plugin_get_type ())
36
#define WINDOWS_LIVE_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_WINDOWS_LIVE_PLUGIN, WindowsLivePlugin))
37
#define WINDOWS_LIVE_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_WINDOWS_LIVE_PLUGIN, WindowsLivePluginClass))
38
#define IS_WINDOWS_LIVE_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_WINDOWS_LIVE_PLUGIN))
39
#define IS_WINDOWS_LIVE_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_WINDOWS_LIVE_PLUGIN))
40
#define WINDOWS_LIVE_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_WINDOWS_LIVE_PLUGIN, WindowsLivePluginClass))
42
typedef struct _WindowsLivePlugin WindowsLivePlugin;
43
typedef struct _WindowsLivePluginClass WindowsLivePluginClass;
44
typedef struct _WindowsLivePluginPrivate WindowsLivePluginPrivate;
45
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
47
struct _WindowsLivePlugin {
48
ApOAuthPlugin parent_instance;
49
WindowsLivePluginPrivate * priv;
52
struct _WindowsLivePluginClass {
53
ApOAuthPluginClass parent_class;
57
static gpointer windows_live_plugin_parent_class = NULL;
59
GType windows_live_plugin_get_type (void) G_GNUC_CONST;
61
WINDOWS_LIVE_PLUGIN_DUMMY_PROPERTY
63
WindowsLivePlugin* windows_live_plugin_new (AgAccount* account);
64
WindowsLivePlugin* windows_live_plugin_construct (GType object_type, AgAccount* account);
65
static GObject * windows_live_plugin_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
66
static void _g_free0_ (gpointer var);
67
static void _vala_GValue_free (GValue* self);
68
static void __vala_GValue_free0_ (gpointer var);
69
GType ap_module_get_object_type (void);
70
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
71
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
74
WindowsLivePlugin* windows_live_plugin_construct (GType object_type, AgAccount* account) {
75
WindowsLivePlugin * self = NULL;
77
g_return_val_if_fail (account != NULL, NULL);
79
self = (WindowsLivePlugin*) g_object_new (object_type, "account", _tmp0_, NULL);
84
WindowsLivePlugin* windows_live_plugin_new (AgAccount* account) {
85
return windows_live_plugin_construct (TYPE_WINDOWS_LIVE_PLUGIN, account);
89
static void _g_free0_ (gpointer var) {
90
var = (g_free (var), NULL);
94
static void _vala_GValue_free (GValue* self) {
100
static void __vala_GValue_free0_ (gpointer var) {
101
(var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL));
105
static GObject * windows_live_plugin_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
107
GObjectClass * parent_class;
108
WindowsLivePlugin * self;
111
GHashTable* oauth_params;
114
GValue* _tmp4_ = NULL;
117
GValue* _tmp7_ = NULL;
120
GValue* _tmp10_ = NULL;
123
GValue* _tmp13_ = NULL;
126
GValue* _tmp16_ = NULL;
129
GValue* _tmp19_ = NULL;
133
gchar** _tmp23_ = NULL;
140
gint _tmp26__length1;
141
GValue* _tmp27_ = NULL;
143
parent_class = G_OBJECT_CLASS (windows_live_plugin_parent_class);
144
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
145
self = WINDOWS_LIVE_PLUGIN (obj);
147
_tmp1_ = g_hash_table_new_full (_tmp0_, NULL, _g_free0_, __vala_GValue_free0_);
148
oauth_params = _tmp1_;
149
_tmp2_ = oauth_params;
150
_tmp3_ = g_strdup ("Host");
151
_tmp4_ = g_new0 (GValue, 1);
152
g_value_init (_tmp4_, G_TYPE_STRING);
153
g_value_set_string (_tmp4_, "login.live.com");
154
g_hash_table_insert (_tmp2_, _tmp3_, _tmp4_);
155
_tmp5_ = oauth_params;
156
_tmp6_ = g_strdup ("AuthPath");
157
_tmp7_ = g_new0 (GValue, 1);
158
g_value_init (_tmp7_, G_TYPE_STRING);
159
g_value_set_string (_tmp7_, "/oauth20_authorize.srf");
160
g_hash_table_insert (_tmp5_, _tmp6_, _tmp7_);
161
_tmp8_ = oauth_params;
162
_tmp9_ = g_strdup ("TokenPath");
163
_tmp10_ = g_new0 (GValue, 1);
164
g_value_init (_tmp10_, G_TYPE_STRING);
165
g_value_set_string (_tmp10_, "/oauth20_token.srf");
166
g_hash_table_insert (_tmp8_, _tmp9_, _tmp10_);
167
_tmp11_ = oauth_params;
168
_tmp12_ = g_strdup ("RedirectUri");
169
_tmp13_ = g_new0 (GValue, 1);
170
g_value_init (_tmp13_, G_TYPE_STRING);
171
g_value_set_string (_tmp13_, "https://login.live.com/oauth20_desktop.srf");
172
g_hash_table_insert (_tmp11_, _tmp12_, _tmp13_);
173
_tmp14_ = oauth_params;
174
_tmp15_ = g_strdup ("ClientId");
175
_tmp16_ = g_new0 (GValue, 1);
176
g_value_init (_tmp16_, G_TYPE_STRING);
177
g_value_set_string (_tmp16_, WINDOWS_LIVE_CLIENT_ID);
178
g_hash_table_insert (_tmp14_, _tmp15_, _tmp16_);
179
_tmp17_ = oauth_params;
180
_tmp18_ = g_strdup ("ResponseType");
181
_tmp19_ = g_new0 (GValue, 1);
182
g_value_init (_tmp19_, G_TYPE_STRING);
183
g_value_set_string (_tmp19_, "code");
184
g_hash_table_insert (_tmp17_, _tmp18_, _tmp19_);
185
_tmp20_ = g_strdup ("wl.messenger");
186
_tmp21_ = g_strdup ("wl.offline_access");
187
_tmp22_ = g_strdup ("wl.emails");
188
_tmp23_ = g_new0 (gchar*, 3 + 1);
189
_tmp23_[0] = _tmp20_;
190
_tmp23_[1] = _tmp21_;
191
_tmp23_[2] = _tmp22_;
194
_scopes_size_ = scopes_length1;
195
_tmp24_ = oauth_params;
196
_tmp25_ = g_strdup ("Scope");
198
_tmp26__length1 = scopes_length1;
199
_tmp27_ = g_new0 (GValue, 1);
200
g_value_init (_tmp27_, G_TYPE_STRV);
201
g_value_set_boxed (_tmp27_, _tmp26_);
202
g_hash_table_insert (_tmp24_, _tmp25_, _tmp27_);
203
_tmp28_ = oauth_params;
204
ap_oauth_plugin_set_oauth_parameters ((ApOAuthPlugin*) self, _tmp28_);
205
ap_oauth_plugin_set_mechanism ((ApOAuthPlugin*) self, AP_OAUTH_MECHANISM_WEB_SERVER);
206
scopes = (_vala_array_free (scopes, scopes_length1, (GDestroyNotify) g_free), NULL);
207
_g_hash_table_unref0 (oauth_params);
212
static void windows_live_plugin_class_init (WindowsLivePluginClass * klass) {
213
windows_live_plugin_parent_class = g_type_class_peek_parent (klass);
214
G_OBJECT_CLASS (klass)->constructor = windows_live_plugin_constructor;
218
static void windows_live_plugin_instance_init (WindowsLivePlugin * self) {
222
GType windows_live_plugin_get_type (void) {
223
static volatile gsize windows_live_plugin_type_id__volatile = 0;
224
if (g_once_init_enter (&windows_live_plugin_type_id__volatile)) {
225
static const GTypeInfo g_define_type_info = { sizeof (WindowsLivePluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) windows_live_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WindowsLivePlugin), 0, (GInstanceInitFunc) windows_live_plugin_instance_init, NULL };
226
GType windows_live_plugin_type_id;
227
windows_live_plugin_type_id = g_type_register_static (ap_oauth_plugin_get_type (), "WindowsLivePlugin", &g_define_type_info, 0);
228
g_once_init_leave (&windows_live_plugin_type_id__volatile, windows_live_plugin_type_id);
230
return windows_live_plugin_type_id__volatile;
234
GType ap_module_get_object_type (void) {
236
result = TYPE_WINDOWS_LIVE_PLUGIN;
241
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
242
if ((array != NULL) && (destroy_func != NULL)) {
244
for (i = 0; i < array_length; i = i + 1) {
245
if (((gpointer*) array)[i] != NULL) {
246
destroy_func (((gpointer*) array)[i]);
253
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
254
_vala_array_destroy (array, array_length, destroy_func);