~ken-vandine/account-plugins/0.8-0ubuntu2.2

« back to all changes in this revision

Viewing changes to src/windows-live.c

  • Committer: Ken VanDine
  • Date: 2012-08-02 18:41:39 UTC
  • mfrom: (12.1.47)
  • Revision ID: ken.vandine@canonical.com-20120802184139-dz2yjdak2iegaa47
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* windows-live.c generated by valac 0.16.1, the Vala compiler
 
2
 * generated from windows-live.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2012 Collabora Ltd.
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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,
 
20
 * USA.
 
21
 *
 
22
 * Authors:
 
23
 *      Xavier Claessens <xavier.claessens@collabora.co.uk>
 
24
 */
 
25
 
 
26
#include <glib.h>
 
27
#include <glib-object.h>
 
28
#include <libaccount-plugin/account-plugin.h>
 
29
#include <libaccounts-glib/accounts-glib.h>
 
30
#include <stdlib.h>
 
31
#include <string.h>
 
32
#include <config.h>
 
33
 
 
34
 
 
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))
 
41
 
 
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)))
 
46
 
 
47
struct _WindowsLivePlugin {
 
48
        ApOAuthPlugin parent_instance;
 
49
        WindowsLivePluginPrivate * priv;
 
50
};
 
51
 
 
52
struct _WindowsLivePluginClass {
 
53
        ApOAuthPluginClass parent_class;
 
54
};
 
55
 
 
56
 
 
57
static gpointer windows_live_plugin_parent_class = NULL;
 
58
 
 
59
GType windows_live_plugin_get_type (void) G_GNUC_CONST;
 
60
enum  {
 
61
        WINDOWS_LIVE_PLUGIN_DUMMY_PROPERTY
 
62
};
 
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);
 
72
 
 
73
 
 
74
WindowsLivePlugin* windows_live_plugin_construct (GType object_type, AgAccount* account) {
 
75
        WindowsLivePlugin * self = NULL;
 
76
        AgAccount* _tmp0_;
 
77
        g_return_val_if_fail (account != NULL, NULL);
 
78
        _tmp0_ = account;
 
79
        self = (WindowsLivePlugin*) g_object_new (object_type, "account", _tmp0_, NULL);
 
80
        return self;
 
81
}
 
82
 
 
83
 
 
84
WindowsLivePlugin* windows_live_plugin_new (AgAccount* account) {
 
85
        return windows_live_plugin_construct (TYPE_WINDOWS_LIVE_PLUGIN, account);
 
86
}
 
87
 
 
88
 
 
89
static void _g_free0_ (gpointer var) {
 
90
        var = (g_free (var), NULL);
 
91
}
 
92
 
 
93
 
 
94
static void _vala_GValue_free (GValue* self) {
 
95
        g_value_unset (self);
 
96
        g_free (self);
 
97
}
 
98
 
 
99
 
 
100
static void __vala_GValue_free0_ (gpointer var) {
 
101
        (var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL));
 
102
}
 
103
 
 
104
 
 
105
static GObject * windows_live_plugin_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
 
106
        GObject * obj;
 
107
        GObjectClass * parent_class;
 
108
        WindowsLivePlugin * self;
 
109
        GHashFunc _tmp0_;
 
110
        GHashTable* _tmp1_;
 
111
        GHashTable* oauth_params;
 
112
        GHashTable* _tmp2_;
 
113
        gchar* _tmp3_;
 
114
        GValue* _tmp4_ = NULL;
 
115
        GHashTable* _tmp5_;
 
116
        gchar* _tmp6_;
 
117
        GValue* _tmp7_ = NULL;
 
118
        GHashTable* _tmp8_;
 
119
        gchar* _tmp9_;
 
120
        GValue* _tmp10_ = NULL;
 
121
        GHashTable* _tmp11_;
 
122
        gchar* _tmp12_;
 
123
        GValue* _tmp13_ = NULL;
 
124
        GHashTable* _tmp14_;
 
125
        gchar* _tmp15_;
 
126
        GValue* _tmp16_ = NULL;
 
127
        GHashTable* _tmp17_;
 
128
        gchar* _tmp18_;
 
129
        GValue* _tmp19_ = NULL;
 
130
        gchar* _tmp20_;
 
131
        gchar* _tmp21_;
 
132
        gchar* _tmp22_;
 
133
        gchar** _tmp23_ = NULL;
 
134
        gchar** scopes;
 
135
        gint scopes_length1;
 
136
        gint _scopes_size_;
 
137
        GHashTable* _tmp24_;
 
138
        gchar* _tmp25_;
 
139
        gchar** _tmp26_;
 
140
        gint _tmp26__length1;
 
141
        GValue* _tmp27_ = NULL;
 
142
        GHashTable* _tmp28_;
 
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);
 
146
        _tmp0_ = g_str_hash;
 
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_;
 
192
        scopes = _tmp23_;
 
193
        scopes_length1 = 3;
 
194
        _scopes_size_ = scopes_length1;
 
195
        _tmp24_ = oauth_params;
 
196
        _tmp25_ = g_strdup ("Scope");
 
197
        _tmp26_ = scopes;
 
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);
 
208
        return obj;
 
209
}
 
210
 
 
211
 
 
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;
 
215
}
 
216
 
 
217
 
 
218
static void windows_live_plugin_instance_init (WindowsLivePlugin * self) {
 
219
}
 
220
 
 
221
 
 
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);
 
229
        }
 
230
        return windows_live_plugin_type_id__volatile;
 
231
}
 
232
 
 
233
 
 
234
GType ap_module_get_object_type (void) {
 
235
        GType result = 0UL;
 
236
        result = TYPE_WINDOWS_LIVE_PLUGIN;
 
237
        return result;
 
238
}
 
239
 
 
240
 
 
241
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
242
        if ((array != NULL) && (destroy_func != NULL)) {
 
243
                int i;
 
244
                for (i = 0; i < array_length; i = i + 1) {
 
245
                        if (((gpointer*) array)[i] != NULL) {
 
246
                                destroy_func (((gpointer*) array)[i]);
 
247
                        }
 
248
                }
 
249
        }
 
250
}
 
251
 
 
252
 
 
253
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
254
        _vala_array_destroy (array, array_length, destroy_func);
 
255
        g_free (array);
 
256
}
 
257
 
 
258
 
 
259