~ubuntu-branches/ubuntu/precise/gwibber/precise-proposed

« back to all changes in this revision

Viewing changes to libgwibber/streams.c

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2011-07-15 17:14:14 UTC
  • mto: This revision was merged to the branch mainline in revision 80.
  • Revision ID: james.westby@ubuntu.com-20110715171414-80ca971vzd56gtmh
Tags: upstream-3.1.2
ImportĀ upstreamĀ versionĀ 3.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* streams.c generated by valac 0.12.0, the Vala compiler
 
2
 * generated from streams.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright(C) 2010 Neil Jagdish Patel
 
6
 * Copyright(C) 2010 Canonical Ltd.
 
7
 *
 
8
 * This library is free software; you can redistribute it and/or modify
 
9
 * it under the terms of the GNU Lesser General Public License
 
10
 * version 3.0 as published by the Free Software Foundation.
 
11
 *
 
12
 * This library 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 Lesser General Public License version 3.0 for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU Lesser General Public
 
18
 * License along with this library. If not, see
 
19
 * <http://www.gnu.org/licenses/>.
 
20
 *
 
21
 * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
 
22
 * Authored by Ken VaDine <ken.vandine@canonical.com>
 
23
 */
 
24
 
 
25
#include <glib.h>
 
26
#include <glib-object.h>
 
27
#include <stdlib.h>
 
28
#include <string.h>
 
29
#include <gio/gio.h>
 
30
#include "gwibber.h"
 
31
#include <dee.h>
 
32
#include <json-glib/json-glib.h>
 
33
#include <gee.h>
 
34
#include <float.h>
 
35
#include <math.h>
 
36
 
 
37
 
 
38
#define TYPE_STREAMS_INTERFACE (streams_interface_get_type ())
 
39
#define STREAMS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_STREAMS_INTERFACE, StreamsInterface))
 
40
#define IS_STREAMS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_STREAMS_INTERFACE))
 
41
#define STREAMS_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_STREAMS_INTERFACE, StreamsInterfaceIface))
 
42
 
 
43
typedef struct _StreamsInterface StreamsInterface;
 
44
typedef struct _StreamsInterfaceIface StreamsInterfaceIface;
 
45
 
 
46
#define TYPE_STREAMS_INTERFACE_PROXY (streams_interface_proxy_get_type ())
 
47
typedef GDBusProxy StreamsInterfaceProxy;
 
48
typedef GDBusProxyClass StreamsInterfaceProxyClass;
 
49
#define _g_free0(var) (var = (g_free (var), NULL))
 
50
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
51
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
52
#define __g_list_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_free0_ (var), NULL)))
 
53
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
 
54
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
 
55
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
 
56
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
 
57
#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))
 
58
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))
 
59
#define _json_array_unref0(var) ((var == NULL) ? NULL : (var = (json_array_unref (var), NULL)))
 
60
 
 
61
struct _StreamsInterfaceIface {
 
62
        GTypeInterface parent_iface;
 
63
        gchar* (*Messages) (StreamsInterface* self, const gchar* stream, const gchar* account, gint time, const gchar* transient, const gchar* recipient, const gchar* orderby, const gchar* order, gint limit, GError** error);
 
64
};
 
65
 
 
66
struct _GwibberStreamsPrivate {
 
67
        StreamsInterface* streams_service;
 
68
        GwibberService* service;
 
69
        GwibberUtils* utils;
 
70
        GwibberMessages* messages_service;
 
71
        DeeModel* model;
 
72
        guint model_refresh_id;
 
73
};
 
74
 
 
75
 
 
76
static gpointer gwibber_streams_parent_class = NULL;
 
77
 
 
78
GType streams_interface_proxy_get_type (void) G_GNUC_CONST;
 
79
guint streams_interface_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
 
80
GType streams_interface_get_type (void) G_GNUC_CONST;
 
81
gchar* streams_interface_Messages (StreamsInterface* self, const gchar* stream, const gchar* account, gint time, const gchar* transient, const gchar* recipient, const gchar* orderby, const gchar* order, gint limit, GError** error);
 
82
static void streams_interface_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
 
83
static gchar* streams_interface_proxy_Messages (StreamsInterface* self, const gchar* stream, const gchar* account, gint time, const gchar* transient, const gchar* recipient, const gchar* orderby, const gchar* order, gint limit, GError** error);
 
84
static void streams_interface_proxy_streams_interface_interface_init (StreamsInterfaceIface* iface);
 
85
static void _dbus_streams_interface_Messages (StreamsInterface* self, GVariant* parameters, GDBusMethodInvocation* invocation);
 
86
static void streams_interface_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
 
87
static GVariant* streams_interface_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
 
88
static gboolean streams_interface_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
 
89
static void _streams_interface_unregister_object (gpointer user_data);
 
90
#define GWIBBER_STREAMS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GWIBBER_TYPE_STREAMS, GwibberStreamsPrivate))
 
91
enum  {
 
92
        GWIBBER_STREAMS_DUMMY_PROPERTY
 
93
};
 
94
#define GWIBBER_STREAMS_streams_name "com.Gwibber.Streams"
 
95
#define GWIBBER_STREAMS_streams_path "/com/gwibber/Streams"
 
96
void gwibber_utils_setup (GwibberUtils* self, const gchar* name, GError** error);
 
97
static void _gwibber_streams_streams_available_gwibber_utils_available (GwibberUtils* _sender, gboolean up, gpointer self);
 
98
static void _lambda3_ (const gchar* change, const gchar* data, GwibberStreams* self);
 
99
static void gwibber_streams_on_refresh (GwibberStreams* self, const gchar* change, const gchar* data);
 
100
static void __lambda3__gwibber_messages_message (GwibberMessages* _sender, const gchar* change, const gchar* data, gpointer self);
 
101
static gboolean _lambda5_ (GwibberStreams* self);
 
102
static void gwibber_streams_refresh_model (GwibberStreams* self);
 
103
static gboolean __lambda5__gsource_func (gpointer self);
 
104
static gboolean _lambda4_ (GwibberStreams* self);
 
105
static gboolean __lambda4__gsource_func (gpointer self);
 
106
static void _g_free0_ (gpointer var);
 
107
static void _g_list_free__g_free0_ (GList* self);
 
108
static gchar** _variant_get1 (GVariant* value, int* result_length1);
 
109
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle);
 
110
static void gwibber_streams_finalize (GObject* obj);
 
111
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
112
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
113
static gint _vala_array_length (gpointer array);
 
114
 
 
115
static const GDBusArgInfo _streams_interface_dbus_arg_info_Messages_stream = {-1, "stream", "s"};
 
116
static const GDBusArgInfo _streams_interface_dbus_arg_info_Messages_account = {-1, "account", "s"};
 
117
static const GDBusArgInfo _streams_interface_dbus_arg_info_Messages_time = {-1, "time", "i"};
 
118
static const GDBusArgInfo _streams_interface_dbus_arg_info_Messages_transient = {-1, "transient", "s"};
 
119
static const GDBusArgInfo _streams_interface_dbus_arg_info_Messages_recipient = {-1, "recipient", "s"};
 
120
static const GDBusArgInfo _streams_interface_dbus_arg_info_Messages_orderby = {-1, "orderby", "s"};
 
121
static const GDBusArgInfo _streams_interface_dbus_arg_info_Messages_order = {-1, "order", "s"};
 
122
static const GDBusArgInfo _streams_interface_dbus_arg_info_Messages_limit = {-1, "limit", "i"};
 
123
static const GDBusArgInfo _streams_interface_dbus_arg_info_Messages_result = {-1, "result", "s"};
 
124
static const GDBusArgInfo * const _streams_interface_dbus_arg_info_Messages_in[] = {&_streams_interface_dbus_arg_info_Messages_stream, &_streams_interface_dbus_arg_info_Messages_account, &_streams_interface_dbus_arg_info_Messages_time, &_streams_interface_dbus_arg_info_Messages_transient, &_streams_interface_dbus_arg_info_Messages_recipient, &_streams_interface_dbus_arg_info_Messages_orderby, &_streams_interface_dbus_arg_info_Messages_order, &_streams_interface_dbus_arg_info_Messages_limit, NULL};
 
125
static const GDBusArgInfo * const _streams_interface_dbus_arg_info_Messages_out[] = {&_streams_interface_dbus_arg_info_Messages_result, NULL};
 
126
static const GDBusMethodInfo _streams_interface_dbus_method_info_Messages = {-1, "Messages", (GDBusArgInfo **) (&_streams_interface_dbus_arg_info_Messages_in), (GDBusArgInfo **) (&_streams_interface_dbus_arg_info_Messages_out)};
 
127
static const GDBusMethodInfo * const _streams_interface_dbus_method_info[] = {&_streams_interface_dbus_method_info_Messages, NULL};
 
128
static const GDBusSignalInfo * const _streams_interface_dbus_signal_info[] = {NULL};
 
129
static const GDBusPropertyInfo * const _streams_interface_dbus_property_info[] = {NULL};
 
130
static const GDBusInterfaceInfo _streams_interface_dbus_interface_info = {-1, "com.Gwibber.Streams", (GDBusMethodInfo **) (&_streams_interface_dbus_method_info), (GDBusSignalInfo **) (&_streams_interface_dbus_signal_info), (GDBusPropertyInfo **) (&_streams_interface_dbus_property_info)};
 
131
static const GDBusInterfaceVTable _streams_interface_dbus_interface_vtable = {streams_interface_dbus_interface_method_call, streams_interface_dbus_interface_get_property, streams_interface_dbus_interface_set_property};
 
132
 
 
133
gchar* streams_interface_Messages (StreamsInterface* self, const gchar* stream, const gchar* account, gint time, const gchar* transient, const gchar* recipient, const gchar* orderby, const gchar* order, gint limit, GError** error) {
 
134
        return STREAMS_INTERFACE_GET_INTERFACE (self)->Messages (self, stream, account, time, transient, recipient, orderby, order, limit, error);
 
135
}
 
136
 
 
137
 
 
138
static void streams_interface_base_init (StreamsInterfaceIface * iface) {
 
139
        static gboolean initialized = FALSE;
 
140
        if (!initialized) {
 
141
                initialized = TRUE;
 
142
        }
 
143
}
 
144
 
 
145
 
 
146
GType streams_interface_get_type (void) {
 
147
        static volatile gsize streams_interface_type_id__volatile = 0;
 
148
        if (g_once_init_enter (&streams_interface_type_id__volatile)) {
 
149
                static const GTypeInfo g_define_type_info = { sizeof (StreamsInterfaceIface), (GBaseInitFunc) streams_interface_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
 
150
                GType streams_interface_type_id;
 
151
                streams_interface_type_id = g_type_register_static (G_TYPE_INTERFACE, "StreamsInterface", &g_define_type_info, 0);
 
152
                g_type_interface_add_prerequisite (streams_interface_type_id, G_TYPE_OBJECT);
 
153
                g_type_set_qdata (streams_interface_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) streams_interface_proxy_get_type);
 
154
                g_type_set_qdata (streams_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "com.Gwibber.Streams");
 
155
                g_type_set_qdata (streams_interface_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) streams_interface_register_object);
 
156
                g_once_init_leave (&streams_interface_type_id__volatile, streams_interface_type_id);
 
157
        }
 
158
        return streams_interface_type_id__volatile;
 
159
}
 
160
 
 
161
 
 
162
G_DEFINE_TYPE_EXTENDED (StreamsInterfaceProxy, streams_interface_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_STREAMS_INTERFACE, streams_interface_proxy_streams_interface_interface_init) )
 
163
static void streams_interface_proxy_class_init (StreamsInterfaceProxyClass* klass) {
 
164
        G_DBUS_PROXY_CLASS (klass)->g_signal = streams_interface_proxy_g_signal;
 
165
}
 
166
 
 
167
 
 
168
static void streams_interface_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
 
169
}
 
170
 
 
171
 
 
172
static void streams_interface_proxy_init (StreamsInterfaceProxy* self) {
 
173
}
 
174
 
 
175
 
 
176
static gchar* streams_interface_proxy_Messages (StreamsInterface* self, const gchar* stream, const gchar* account, gint time, const gchar* transient, const gchar* recipient, const gchar* orderby, const gchar* order, gint limit, GError** error) {
 
177
        GDBusMessage *_message;
 
178
        GVariant *_arguments;
 
179
        GVariantBuilder _arguments_builder;
 
180
        GDBusMessage *_reply_message;
 
181
        GVariant *_reply;
 
182
        GVariantIter _reply_iter;
 
183
        gchar* _result;
 
184
        GVariant* _tmp20_;
 
185
        G_IO_ERROR;
 
186
        _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "com.Gwibber.Streams", "Messages");
 
187
        g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
188
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (stream));
 
189
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (account));
 
190
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (time));
 
191
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (transient));
 
192
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (recipient));
 
193
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (orderby));
 
194
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (order));
 
195
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (limit));
 
196
        _arguments = g_variant_builder_end (&_arguments_builder);
 
197
        g_dbus_message_set_body (_message, _arguments);
 
198
        _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
 
199
        g_object_unref (_message);
 
200
        if (!_reply_message) {
 
201
                return NULL;
 
202
        }
 
203
        if (g_dbus_message_to_gerror (_reply_message, error)) {
 
204
                g_object_unref (_reply_message);
 
205
                return NULL;
 
206
        }
 
207
        _reply = g_dbus_message_get_body (_reply_message);
 
208
        g_variant_iter_init (&_reply_iter, _reply);
 
209
        _tmp20_ = g_variant_iter_next_value (&_reply_iter);
 
210
        _result = g_variant_dup_string (_tmp20_, NULL);
 
211
        g_variant_unref (_tmp20_);
 
212
        g_object_unref (_reply_message);
 
213
        return _result;
 
214
}
 
215
 
 
216
 
 
217
static void streams_interface_proxy_streams_interface_interface_init (StreamsInterfaceIface* iface) {
 
218
        iface->Messages = streams_interface_proxy_Messages;
 
219
}
 
220
 
 
221
 
 
222
static void _dbus_streams_interface_Messages (StreamsInterface* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
 
223
        GError* error = NULL;
 
224
        GVariantIter _arguments_iter;
 
225
        gchar* stream = NULL;
 
226
        GVariant* _tmp21_;
 
227
        gchar* account = NULL;
 
228
        GVariant* _tmp22_;
 
229
        gint time = 0;
 
230
        GVariant* _tmp23_;
 
231
        gchar* transient = NULL;
 
232
        GVariant* _tmp24_;
 
233
        gchar* recipient = NULL;
 
234
        GVariant* _tmp25_;
 
235
        gchar* orderby = NULL;
 
236
        GVariant* _tmp26_;
 
237
        gchar* order = NULL;
 
238
        GVariant* _tmp27_;
 
239
        gint limit = 0;
 
240
        GVariant* _tmp28_;
 
241
        GDBusMessage* _reply_message;
 
242
        GVariant* _reply;
 
243
        GVariantBuilder _reply_builder;
 
244
        gchar* result;
 
245
        g_variant_iter_init (&_arguments_iter, parameters);
 
246
        _tmp21_ = g_variant_iter_next_value (&_arguments_iter);
 
247
        stream = g_variant_dup_string (_tmp21_, NULL);
 
248
        g_variant_unref (_tmp21_);
 
249
        _tmp22_ = g_variant_iter_next_value (&_arguments_iter);
 
250
        account = g_variant_dup_string (_tmp22_, NULL);
 
251
        g_variant_unref (_tmp22_);
 
252
        _tmp23_ = g_variant_iter_next_value (&_arguments_iter);
 
253
        time = g_variant_get_int32 (_tmp23_);
 
254
        g_variant_unref (_tmp23_);
 
255
        _tmp24_ = g_variant_iter_next_value (&_arguments_iter);
 
256
        transient = g_variant_dup_string (_tmp24_, NULL);
 
257
        g_variant_unref (_tmp24_);
 
258
        _tmp25_ = g_variant_iter_next_value (&_arguments_iter);
 
259
        recipient = g_variant_dup_string (_tmp25_, NULL);
 
260
        g_variant_unref (_tmp25_);
 
261
        _tmp26_ = g_variant_iter_next_value (&_arguments_iter);
 
262
        orderby = g_variant_dup_string (_tmp26_, NULL);
 
263
        g_variant_unref (_tmp26_);
 
264
        _tmp27_ = g_variant_iter_next_value (&_arguments_iter);
 
265
        order = g_variant_dup_string (_tmp27_, NULL);
 
266
        g_variant_unref (_tmp27_);
 
267
        _tmp28_ = g_variant_iter_next_value (&_arguments_iter);
 
268
        limit = g_variant_get_int32 (_tmp28_);
 
269
        g_variant_unref (_tmp28_);
 
270
        result = streams_interface_Messages (self, stream, account, time, transient, recipient, orderby, order, limit, &error);
 
271
        if (error) {
 
272
                g_dbus_method_invocation_return_gerror (invocation, error);
 
273
                return;
 
274
        }
 
275
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
 
276
        g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
 
277
        g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
 
278
        _g_free0 ( result);
 
279
        _reply = g_variant_builder_end (&_reply_builder);
 
280
        g_dbus_message_set_body (_reply_message, _reply);
 
281
        _g_free0 (stream);
 
282
        _g_free0 (account);
 
283
        _g_free0 (transient);
 
284
        _g_free0 (recipient);
 
285
        _g_free0 (orderby);
 
286
        _g_free0 (order);
 
287
        g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
 
288
        g_object_unref (invocation);
 
289
        g_object_unref (_reply_message);
 
290
}
 
291
 
 
292
 
 
293
static void streams_interface_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
 
294
        gpointer* data;
 
295
        gpointer object;
 
296
        data = user_data;
 
297
        object = data[0];
 
298
        if (strcmp (method_name, "Messages") == 0) {
 
299
                _dbus_streams_interface_Messages (object, parameters, invocation);
 
300
        } else {
 
301
                g_object_unref (invocation);
 
302
        }
 
303
}
 
304
 
 
305
 
 
306
static GVariant* streams_interface_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
 
307
        gpointer* data;
 
308
        gpointer object;
 
309
        data = user_data;
 
310
        object = data[0];
 
311
        return NULL;
 
312
}
 
313
 
 
314
 
 
315
static gboolean streams_interface_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
 
316
        gpointer* data;
 
317
        gpointer object;
 
318
        data = user_data;
 
319
        object = data[0];
 
320
        return FALSE;
 
321
}
 
322
 
 
323
 
 
324
guint streams_interface_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
 
325
        guint result;
 
326
        gpointer *data;
 
327
        data = g_new (gpointer, 3);
 
328
        data[0] = g_object_ref (object);
 
329
        data[1] = g_object_ref (connection);
 
330
        data[2] = g_strdup (path);
 
331
        result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_streams_interface_dbus_interface_info), &_streams_interface_dbus_interface_vtable, data, _streams_interface_unregister_object, error);
 
332
        if (!result) {
 
333
                return 0;
 
334
        }
 
335
        return result;
 
336
}
 
337
 
 
338
 
 
339
static void _streams_interface_unregister_object (gpointer user_data) {
 
340
        gpointer* data;
 
341
        data = user_data;
 
342
        g_object_unref (data[0]);
 
343
        g_object_unref (data[1]);
 
344
        g_free (data[2]);
 
345
        g_free (data);
 
346
}
 
347
 
 
348
 
 
349
static void _gwibber_streams_streams_available_gwibber_utils_available (GwibberUtils* _sender, gboolean up, gpointer self) {
 
350
        gwibber_streams_streams_available (self, up);
 
351
}
 
352
 
 
353
 
 
354
GwibberStreams* gwibber_streams_construct (GType object_type) {
 
355
        GwibberStreams * self = NULL;
 
356
        StreamsInterface* _tmp0_ = NULL;
 
357
        StreamsInterface* _tmp1_;
 
358
        GwibberUtils* _tmp2_ = NULL;
 
359
        GwibberMessages* _tmp3_ = NULL;
 
360
        GwibberService* _tmp4_ = NULL;
 
361
        GError * _inner_error_ = NULL;
 
362
        self = (GwibberStreams*) g_object_new (object_type, NULL);
 
363
        _tmp0_ = g_initable_new (TYPE_STREAMS_INTERFACE_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", GWIBBER_STREAMS_streams_name, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", GWIBBER_STREAMS_streams_path, "g-interface-name", "com.Gwibber.Streams", NULL);
 
364
        _tmp1_ = (StreamsInterface*) _tmp0_;
 
365
        if (_inner_error_ != NULL) {
 
366
                if (_inner_error_->domain == G_IO_ERROR) {
 
367
                        goto __catch24_g_io_error;
 
368
                }
 
369
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
370
                g_clear_error (&_inner_error_);
 
371
                return NULL;
 
372
        }
 
373
        _g_object_unref0 (self->priv->streams_service);
 
374
        self->priv->streams_service = _tmp1_;
 
375
        _tmp2_ = gwibber_utils_new ();
 
376
        _g_object_unref0 (self->priv->utils);
 
377
        self->priv->utils = _tmp2_;
 
378
        gwibber_utils_setup (self->priv->utils, GWIBBER_STREAMS_streams_name, &_inner_error_);
 
379
        if (_inner_error_ != NULL) {
 
380
                if (_inner_error_->domain == G_IO_ERROR) {
 
381
                        goto __catch24_g_io_error;
 
382
                }
 
383
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
384
                g_clear_error (&_inner_error_);
 
385
                return NULL;
 
386
        }
 
387
        g_signal_connect_object (self->priv->utils, "available", (GCallback) _gwibber_streams_streams_available_gwibber_utils_available, self, 0);
 
388
        _tmp3_ = gwibber_messages_new ();
 
389
        _g_object_unref0 (self->priv->messages_service);
 
390
        self->priv->messages_service = _tmp3_;
 
391
        _tmp4_ = gwibber_service_new ();
 
392
        _g_object_unref0 (self->priv->service);
 
393
        self->priv->service = _tmp4_;
 
394
        self->priv->model_refresh_id = (guint) 0;
 
395
        goto __finally24;
 
396
        __catch24_g_io_error:
 
397
        {
 
398
                GError * e;
 
399
                gchar* _tmp5_;
 
400
                gchar* _tmp6_;
 
401
                e = _inner_error_;
 
402
                _inner_error_ = NULL;
 
403
                _tmp5_ = g_strconcat ("Unable to get Gwibber Streams: ", e->message, NULL);
 
404
                _tmp6_ = _tmp5_;
 
405
                g_warning ("streams.vala:65: %s", _tmp6_);
 
406
                _g_free0 (_tmp6_);
 
407
                _g_error_free0 (e);
 
408
        }
 
409
        __finally24:
 
410
        if (_inner_error_ != NULL) {
 
411
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
412
                g_clear_error (&_inner_error_);
 
413
                return NULL;
 
414
        }
 
415
        return self;
 
416
}
 
417
 
 
418
 
 
419
GwibberStreams* gwibber_streams_new (void) {
 
420
        return gwibber_streams_construct (GWIBBER_TYPE_STREAMS);
 
421
}
 
422
 
 
423
 
 
424
/**
 
425
         * com.Gwibber.Streams
 
426
         **/
 
427
gchar* gwibber_streams_messages (GwibberStreams* self, const gchar* stream, const gchar* account, gint time) {
 
428
        gchar* result = NULL;
 
429
        gchar* _tmp0_ = NULL;
 
430
        gchar* _tmp1_;
 
431
        GError * _inner_error_ = NULL;
 
432
        g_return_val_if_fail (self != NULL, NULL);
 
433
        g_return_val_if_fail (stream != NULL, NULL);
 
434
        g_return_val_if_fail (account != NULL, NULL);
 
435
        _tmp0_ = streams_interface_Messages (self->priv->streams_service, stream, account, time, "0", "0", "time", "DESC", 1000, &_inner_error_);
 
436
        _tmp1_ = _tmp0_;
 
437
        if (_inner_error_ != NULL) {
 
438
                if (_inner_error_->domain == G_IO_ERROR) {
 
439
                        goto __catch25_g_io_error;
 
440
                }
 
441
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
442
                g_clear_error (&_inner_error_);
 
443
                return NULL;
 
444
        }
 
445
        result = _tmp1_;
 
446
        return result;
 
447
        goto __finally25;
 
448
        __catch25_g_io_error:
 
449
        {
 
450
                GError * e;
 
451
                gchar* _tmp2_;
 
452
                e = _inner_error_;
 
453
                _inner_error_ = NULL;
 
454
                g_warning ("streams.vala:82: %s", e->message);
 
455
                _tmp2_ = g_strdup ("");
 
456
                result = _tmp2_;
 
457
                _g_error_free0 (e);
 
458
                return result;
 
459
        }
 
460
        __finally25:
 
461
        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
462
        g_clear_error (&_inner_error_);
 
463
        return NULL;
 
464
}
 
465
 
 
466
 
 
467
static gpointer _g_object_ref0 (gpointer self) {
 
468
        return self ? g_object_ref (self) : NULL;
 
469
}
 
470
 
 
471
 
 
472
DeeModel* gwibber_streams_get_stream_filter_model (GwibberStreams* self, DeeModel* model, const gchar* stream) {
 
473
        DeeModel* result = NULL;
 
474
        DeeFilter* stream_filter = NULL;
 
475
        DeeFilterModel* _tmp2_ = NULL;
 
476
        DeeFilterModel* filtered_model;
 
477
        g_return_val_if_fail (self != NULL, NULL);
 
478
        g_return_val_if_fail (model != NULL, NULL);
 
479
        g_return_val_if_fail (stream != NULL, NULL);
 
480
        if (g_strcmp0 (stream, "home") == 0) {
 
481
                DeeModel* _tmp0_;
 
482
                _tmp0_ = _g_object_ref0 (model);
 
483
                result = _tmp0_;
 
484
                _g_free0 (stream_filter);
 
485
                return result;
 
486
        } else {
 
487
                DeeFilter* _tmp1_ = NULL;
 
488
                _tmp1_ = dee_filter_new_for_key_column ((guint) GWIBBER_STREAM_MODEL_COLUMN_STREAM, stream);
 
489
                _g_free0 (stream_filter);
 
490
                stream_filter = _tmp1_;
 
491
        }
 
492
        _tmp2_ = (DeeFilterModel*) dee_filter_model_new (stream_filter, model);
 
493
        filtered_model = _tmp2_;
 
494
        result = (DeeModel*) filtered_model;
 
495
        _g_free0 (stream_filter);
 
496
        return result;
 
497
}
 
498
 
 
499
 
 
500
static void _lambda3_ (const gchar* change, const gchar* data, GwibberStreams* self) {
 
501
        g_return_if_fail (change != NULL);
 
502
        g_return_if_fail (data != NULL);
 
503
        gwibber_streams_on_refresh (self, change, data);
 
504
}
 
505
 
 
506
 
 
507
static void __lambda3__gwibber_messages_message (GwibberMessages* _sender, const gchar* change, const gchar* data, gpointer self) {
 
508
        _lambda3_ (change, data, self);
 
509
}
 
510
 
 
511
 
 
512
static gboolean _lambda5_ (GwibberStreams* self) {
 
513
        gboolean result = FALSE;
 
514
        gwibber_streams_refresh_model (self);
 
515
        result = FALSE;
 
516
        return result;
 
517
}
 
518
 
 
519
 
 
520
static gboolean __lambda5__gsource_func (gpointer self) {
 
521
        gboolean result;
 
522
        result = _lambda5_ (self);
 
523
        return result;
 
524
}
 
525
 
 
526
 
 
527
DeeModel* gwibber_streams_get_stream_model (GwibberStreams* self) {
 
528
        DeeModel* result = NULL;
 
529
        DeeSequenceModel* _tmp0_ = NULL;
 
530
        DeeModel* _tmp1_;
 
531
        g_return_val_if_fail (self != NULL, NULL);
 
532
        _tmp0_ = (DeeSequenceModel*) dee_sequence_model_new ();
 
533
        _g_object_unref0 (self->priv->model);
 
534
        self->priv->model = (DeeModel*) _tmp0_;
 
535
        dee_model_set_schema (self->priv->model, "as", "s", "s", "s", "b", "s", "s", "s", "s", "s", "s", "s", "s", "s", "d", "s", "s", "s", NULL);
 
536
        g_signal_connect_object (self->priv->messages_service, "message", (GCallback) __lambda3__gwibber_messages_message, self, 0);
 
537
        g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda5__gsource_func, g_object_ref (self), g_object_unref);
 
538
        _tmp1_ = _g_object_ref0 (self->priv->model);
 
539
        result = _tmp1_;
 
540
        return result;
 
541
}
 
542
 
 
543
 
 
544
static gboolean _lambda4_ (GwibberStreams* self) {
 
545
        gboolean result = FALSE;
 
546
        gwibber_streams_refresh_model (self);
 
547
        self->priv->model_refresh_id = (guint) 0;
 
548
        result = FALSE;
 
549
        return result;
 
550
}
 
551
 
 
552
 
 
553
static gboolean __lambda4__gsource_func (gpointer self) {
 
554
        gboolean result;
 
555
        result = _lambda4_ (self);
 
556
        return result;
 
557
}
 
558
 
 
559
 
 
560
static void gwibber_streams_on_refresh (GwibberStreams* self, const gchar* change, const gchar* data) {
 
561
        guint _tmp0_;
 
562
        g_return_if_fail (self != NULL);
 
563
        g_return_if_fail (change != NULL);
 
564
        g_return_if_fail (data != NULL);
 
565
        if (self->priv->model_refresh_id != 0) {
 
566
                return;
 
567
        }
 
568
        _tmp0_ = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 10, __lambda4__gsource_func, g_object_ref (self), g_object_unref);
 
569
        self->priv->model_refresh_id = _tmp0_;
 
570
        return;
 
571
}
 
572
 
 
573
 
 
574
static void _g_free0_ (gpointer var) {
 
575
        var = (g_free (var), NULL);
 
576
}
 
577
 
 
578
 
 
579
static void _g_list_free__g_free0_ (GList* self) {
 
580
        g_list_foreach (self, (GFunc) _g_free0_, NULL);
 
581
        g_list_free (self);
 
582
}
 
583
 
 
584
 
 
585
static gpointer _json_array_ref0 (gpointer self) {
 
586
        return self ? json_array_ref (self) : NULL;
 
587
}
 
588
 
 
589
 
 
590
static gpointer _json_object_ref0 (gpointer self) {
 
591
        return self ? json_object_ref (self) : NULL;
 
592
}
 
593
 
 
594
 
 
595
static gchar* string_replace (const gchar* self, const gchar* old, const gchar* replacement) {
 
596
        gchar* result = NULL;
 
597
        gchar* _tmp0_ = NULL;
 
598
        gchar* _tmp1_;
 
599
        GRegex* _tmp2_ = NULL;
 
600
        GRegex* _tmp3_;
 
601
        GRegex* regex;
 
602
        gchar* _tmp4_ = NULL;
 
603
        gchar* _tmp5_;
 
604
        GError * _inner_error_ = NULL;
 
605
        g_return_val_if_fail (self != NULL, NULL);
 
606
        g_return_val_if_fail (old != NULL, NULL);
 
607
        g_return_val_if_fail (replacement != NULL, NULL);
 
608
        _tmp0_ = g_regex_escape_string (old, -1);
 
609
        _tmp1_ = _tmp0_;
 
610
        _tmp2_ = g_regex_new (_tmp1_, 0, 0, &_inner_error_);
 
611
        _tmp3_ = _tmp2_;
 
612
        _g_free0 (_tmp1_);
 
613
        regex = _tmp3_;
 
614
        if (_inner_error_ != NULL) {
 
615
                if (_inner_error_->domain == G_REGEX_ERROR) {
 
616
                        goto __catch26_g_regex_error;
 
617
                }
 
618
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
619
                g_clear_error (&_inner_error_);
 
620
                return NULL;
 
621
        }
 
622
        _tmp4_ = g_regex_replace_literal (regex, self, (gssize) (-1), 0, replacement, 0, &_inner_error_);
 
623
        _tmp5_ = _tmp4_;
 
624
        if (_inner_error_ != NULL) {
 
625
                _g_regex_unref0 (regex);
 
626
                if (_inner_error_->domain == G_REGEX_ERROR) {
 
627
                        goto __catch26_g_regex_error;
 
628
                }
 
629
                _g_regex_unref0 (regex);
 
630
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
631
                g_clear_error (&_inner_error_);
 
632
                return NULL;
 
633
        }
 
634
        result = _tmp5_;
 
635
        _g_regex_unref0 (regex);
 
636
        return result;
 
637
        _g_regex_unref0 (regex);
 
638
        goto __finally26;
 
639
        __catch26_g_regex_error:
 
640
        {
 
641
                GError * e;
 
642
                e = _inner_error_;
 
643
                _inner_error_ = NULL;
 
644
                g_assert_not_reached ();
 
645
                _g_error_free0 (e);
 
646
        }
 
647
        __finally26:
 
648
        if (_inner_error_ != NULL) {
 
649
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
650
                g_clear_error (&_inner_error_);
 
651
                return NULL;
 
652
        }
 
653
}
 
654
 
 
655
 
 
656
static gchar* string_strip (const gchar* self) {
 
657
        gchar* result = NULL;
 
658
        gchar* _tmp0_ = NULL;
 
659
        gchar* _result_;
 
660
        g_return_val_if_fail (self != NULL, NULL);
 
661
        _tmp0_ = g_strdup (self);
 
662
        _result_ = _tmp0_;
 
663
        g_strstrip (_result_);
 
664
        result = _result_;
 
665
        return result;
 
666
}
 
667
 
 
668
 
 
669
static gchar** _variant_get1 (GVariant* value, int* result_length1) {
 
670
        gchar** _tmp91_;
 
671
        int _tmp91__length;
 
672
        int _tmp91__size;
 
673
        int _tmp91__length1;
 
674
        GVariantIter _tmp92_;
 
675
        GVariant* _tmp93_;
 
676
        _tmp91_ = g_new (gchar*, 5);
 
677
        _tmp91__length = 0;
 
678
        _tmp91__size = 4;
 
679
        _tmp91__length1 = 0;
 
680
        g_variant_iter_init (&_tmp92_, value);
 
681
        for (; (_tmp93_ = g_variant_iter_next_value (&_tmp92_)) != NULL; _tmp91__length1++) {
 
682
                if (_tmp91__size == _tmp91__length) {
 
683
                        _tmp91__size = 2 * _tmp91__size;
 
684
                        _tmp91_ = g_renew (gchar*, _tmp91_, _tmp91__size + 1);
 
685
                }
 
686
                _tmp91_[_tmp91__length++] = g_variant_dup_string (_tmp93_, NULL);
 
687
                g_variant_unref (_tmp93_);
 
688
        }
 
689
        *result_length1 = _tmp91__length1;
 
690
        _tmp91_[_tmp91__length] = NULL;
 
691
        return _tmp91_;
 
692
}
 
693
 
 
694
 
 
695
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) {
 
696
        int i;
 
697
        for (i = 0; i < stack_length; i++) {
 
698
                if (g_strcmp0 (stack[i], needle) == 0) {
 
699
                        return TRUE;
 
700
                }
 
701
        }
 
702
        return FALSE;
 
703
}
 
704
 
 
705
 
 
706
static void gwibber_streams_refresh_model (GwibberStreams* self) {
 
707
        GList* streams;
 
708
        gchar* _tmp0_;
 
709
        gchar* _tmp1_;
 
710
        gchar* _tmp2_;
 
711
        gchar* _tmp3_;
 
712
        gchar* _tmp4_;
 
713
        gchar* _tmp5_;
 
714
        gchar* _tmp6_;
 
715
        GError * _inner_error_ = NULL;
 
716
        g_return_if_fail (self != NULL);
 
717
        dee_model_clear (self->priv->model);
 
718
        streams = NULL;
 
719
        _tmp0_ = g_strdup ("messages");
 
720
        streams = g_list_append (streams, _tmp0_);
 
721
        _tmp1_ = g_strdup ("replies");
 
722
        streams = g_list_append (streams, _tmp1_);
 
723
        _tmp2_ = g_strdup ("private");
 
724
        streams = g_list_append (streams, _tmp2_);
 
725
        _tmp3_ = g_strdup ("public");
 
726
        streams = g_list_append (streams, _tmp3_);
 
727
        _tmp4_ = g_strdup ("images");
 
728
        streams = g_list_append (streams, _tmp4_);
 
729
        _tmp5_ = g_strdup ("links");
 
730
        streams = g_list_append (streams, _tmp5_);
 
731
        _tmp6_ = g_strdup ("videos");
 
732
        streams = g_list_append (streams, _tmp6_);
 
733
        {
 
734
                GList* stream_collection;
 
735
                GList* stream_it;
 
736
                stream_collection = streams;
 
737
                for (stream_it = stream_collection; stream_it != NULL; stream_it = stream_it->next) {
 
738
                        gchar* _tmp7_;
 
739
                        gchar* stream;
 
740
                        _tmp7_ = g_strdup ((const gchar*) stream_it->data);
 
741
                        stream = _tmp7_;
 
742
                        {
 
743
                                gchar* _tmp8_ = NULL;
 
744
                                gchar* messages;
 
745
                                JsonParser* _tmp9_ = NULL;
 
746
                                JsonParser* parser;
 
747
                                JsonNode* _tmp10_ = NULL;
 
748
                                JsonArray* _tmp11_ = NULL;
 
749
                                JsonArray* _tmp12_;
 
750
                                JsonArray* nodeArray;
 
751
                                GeeHashMap* _tmp13_ = NULL;
 
752
                                GeeHashMap* seen;
 
753
                                _tmp8_ = gwibber_streams_messages (self, stream, "all", 0);
 
754
                                messages = _tmp8_;
 
755
                                _tmp9_ = json_parser_new ();
 
756
                                parser = _tmp9_;
 
757
                                json_parser_load_from_data (parser, messages, (gssize) (-1), &_inner_error_);
 
758
                                if (_inner_error_ != NULL) {
 
759
                                        _g_object_unref0 (parser);
 
760
                                        _g_free0 (messages);
 
761
                                        _g_free0 (stream);
 
762
                                        __g_list_free__g_free0_0 (streams);
 
763
                                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
764
                                        g_clear_error (&_inner_error_);
 
765
                                        return;
 
766
                                }
 
767
                                _tmp10_ = json_parser_get_root (parser);
 
768
                                _tmp11_ = json_node_get_array (_tmp10_);
 
769
                                _tmp12_ = _json_array_ref0 (_tmp11_);
 
770
                                nodeArray = _tmp12_;
 
771
                                _tmp13_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_POINTER, NULL, NULL, NULL, NULL, NULL);
 
772
                                seen = _tmp13_;
 
773
                                {
 
774
                                        gint i;
 
775
                                        i = 0;
 
776
                                        {
 
777
                                                gboolean _tmp14_;
 
778
                                                _tmp14_ = TRUE;
 
779
                                                while (TRUE) {
 
780
                                                        guint _tmp15_;
 
781
                                                        DeeModelIter* iter;
 
782
                                                        JsonNode* _tmp16_ = NULL;
 
783
                                                        JsonObject* _tmp17_ = NULL;
 
784
                                                        GList* _tmp18_ = NULL;
 
785
                                                        GList* members;
 
786
                                                        JsonNode* _tmp19_ = NULL;
 
787
                                                        JsonObject* _tmp20_ = NULL;
 
788
                                                        const gchar* _tmp21_ = NULL;
 
789
                                                        gchar* _tmp22_;
 
790
                                                        gchar* _account;
 
791
                                                        JsonNode* _tmp23_ = NULL;
 
792
                                                        JsonObject* _tmp24_ = NULL;
 
793
                                                        const gchar* _tmp25_ = NULL;
 
794
                                                        gchar* _tmp26_;
 
795
                                                        gchar* _stream;
 
796
                                                        JsonNode* _tmp27_ = NULL;
 
797
                                                        JsonObject* _tmp28_ = NULL;
 
798
                                                        const gchar* _tmp29_ = NULL;
 
799
                                                        gchar* _tmp30_;
 
800
                                                        gchar* _service;
 
801
                                                        JsonNode* _tmp31_ = NULL;
 
802
                                                        JsonObject* _tmp32_ = NULL;
 
803
                                                        const gchar* _tmp33_ = NULL;
 
804
                                                        gchar* _tmp34_;
 
805
                                                        gchar* _mid;
 
806
                                                        gchar* _tmp35_;
 
807
                                                        gchar* _tmp36_;
 
808
                                                        gchar* _tmp37_;
 
809
                                                        gchar* _tmp38_;
 
810
                                                        gchar* _tmp39_;
 
811
                                                        gchar* _tmp40_;
 
812
                                                        gchar* _tmp41_;
 
813
                                                        gchar* _tmp42_;
 
814
                                                        gchar* _acct;
 
815
                                                        GVariantType* _tmp43_ = NULL;
 
816
                                                        GVariantType* _tmp44_;
 
817
                                                        GVariantBuilder* _tmp45_ = NULL;
 
818
                                                        GVariantBuilder* _tmp46_;
 
819
                                                        GVariantBuilder* builder;
 
820
                                                        JsonNode* _tmp47_ = NULL;
 
821
                                                        JsonObject* _tmp48_ = NULL;
 
822
                                                        JsonObject* _tmp49_ = NULL;
 
823
                                                        JsonObject* _tmp50_;
 
824
                                                        JsonObject* _sender_obj;
 
825
                                                        const gchar* _tmp51_ = NULL;
 
826
                                                        gchar* _tmp52_;
 
827
                                                        gchar* _sender;
 
828
                                                        gchar* _sender_nick;
 
829
                                                        gboolean _tmp53_;
 
830
                                                        gboolean _tmp56_;
 
831
                                                        gboolean _from_me;
 
832
                                                        JsonNode* _tmp57_ = NULL;
 
833
                                                        JsonObject* _tmp58_ = NULL;
 
834
                                                        gdouble _tmp59_;
 
835
                                                        guint _time;
 
836
                                                        JsonNode* _tmp63_ = NULL;
 
837
                                                        JsonObject* _tmp64_ = NULL;
 
838
                                                        const gchar* _tmp65_ = NULL;
 
839
                                                        gchar* _tmp66_;
 
840
                                                        gchar* _text;
 
841
                                                        gchar* _tmp67_;
 
842
                                                        gchar* _textid;
 
843
                                                        gchar* _tmp68_ = NULL;
 
844
                                                        gchar* _tmp69_;
 
845
                                                        gchar** _tmp70_;
 
846
                                                        gchar** _tmp71_ = NULL;
 
847
                                                        gchar** _tmp72_;
 
848
                                                        gchar* _tmp86_ = NULL;
 
849
                                                        gboolean _tmp87_;
 
850
                                                        JsonNode* _tmp96_ = NULL;
 
851
                                                        JsonObject* _tmp97_ = NULL;
 
852
                                                        const gchar* _tmp98_ = NULL;
 
853
                                                        gchar* _tmp99_;
 
854
                                                        gchar* _html;
 
855
                                                        const gchar* _tmp100_ = NULL;
 
856
                                                        gchar* _tmp101_;
 
857
                                                        gchar* _icon;
 
858
                                                        JsonNode* _tmp102_ = NULL;
 
859
                                                        JsonObject* _tmp103_ = NULL;
 
860
                                                        const gchar* _tmp104_ = NULL;
 
861
                                                        gchar* _tmp105_;
 
862
                                                        gchar* _url;
 
863
                                                        gchar* _source;
 
864
                                                        gchar* _reply;
 
865
                                                        gchar* _reply_url;
 
866
                                                        gdouble _likes;
 
867
                                                        gchar* _retweeted_by_nick;
 
868
                                                        gchar* _retweeted_by_name;
 
869
                                                        gchar* _retweeted_by_id;
 
870
                                                        gchar* _tmp138_ = NULL;
 
871
                                                        gchar* _tmp139_ = NULL;
 
872
                                                        gchar* _tmp140_ = NULL;
 
873
                                                        gchar* _tmp141_ = NULL;
 
874
                                                        gchar* _t;
 
875
                                                        GVariant* _tmp142_ = NULL;
 
876
                                                        GVariant* _accounts;
 
877
                                                        gchar* _tmp143_ = NULL;
 
878
                                                        gchar* _tmp144_;
 
879
                                                        DeeModelIter* _tmp145_ = NULL;
 
880
                                                        gint _tmp146_;
 
881
                                                        if (!_tmp14_) {
 
882
                                                                i++;
 
883
                                                        }
 
884
                                                        _tmp14_ = FALSE;
 
885
                                                        _tmp15_ = json_array_get_length (nodeArray);
 
886
                                                        if (!(i < _tmp15_)) {
 
887
                                                                break;
 
888
                                                        }
 
889
                                                        iter = NULL;
 
890
                                                        _tmp16_ = json_array_get_element (nodeArray, (guint) i);
 
891
                                                        _tmp17_ = json_node_get_object (_tmp16_);
 
892
                                                        _tmp18_ = json_object_get_members (_tmp17_);
 
893
                                                        members = _tmp18_;
 
894
                                                        _tmp19_ = json_array_get_element (nodeArray, (guint) i);
 
895
                                                        _tmp20_ = json_node_get_object (_tmp19_);
 
896
                                                        _tmp21_ = json_object_get_string_member (_tmp20_, "account");
 
897
                                                        _tmp22_ = g_strdup (_tmp21_);
 
898
                                                        _account = _tmp22_;
 
899
                                                        _tmp23_ = json_array_get_element (nodeArray, (guint) i);
 
900
                                                        _tmp24_ = json_node_get_object (_tmp23_);
 
901
                                                        _tmp25_ = json_object_get_string_member (_tmp24_, "stream");
 
902
                                                        _tmp26_ = g_strdup (_tmp25_);
 
903
                                                        _stream = _tmp26_;
 
904
                                                        _tmp27_ = json_array_get_element (nodeArray, (guint) i);
 
905
                                                        _tmp28_ = json_node_get_object (_tmp27_);
 
906
                                                        _tmp29_ = json_object_get_string_member (_tmp28_, "service");
 
907
                                                        _tmp30_ = g_strdup (_tmp29_);
 
908
                                                        _service = _tmp30_;
 
909
                                                        _tmp31_ = json_array_get_element (nodeArray, (guint) i);
 
910
                                                        _tmp32_ = json_node_get_object (_tmp31_);
 
911
                                                        _tmp33_ = json_object_get_string_member (_tmp32_, "mid");
 
912
                                                        _tmp34_ = g_strdup (_tmp33_);
 
913
                                                        _mid = _tmp34_;
 
914
                                                        _tmp35_ = g_strconcat (_account, ":", NULL);
 
915
                                                        _tmp36_ = _tmp35_;
 
916
                                                        _tmp37_ = g_strconcat (_tmp36_, _service, NULL);
 
917
                                                        _tmp38_ = _tmp37_;
 
918
                                                        _tmp39_ = g_strconcat (_tmp38_, ":", NULL);
 
919
                                                        _tmp40_ = _tmp39_;
 
920
                                                        _tmp41_ = g_strconcat (_tmp40_, _mid, NULL);
 
921
                                                        _tmp42_ = _tmp41_;
 
922
                                                        _g_free0 (_tmp40_);
 
923
                                                        _g_free0 (_tmp38_);
 
924
                                                        _g_free0 (_tmp36_);
 
925
                                                        _acct = _tmp42_;
 
926
                                                        _tmp43_ = g_variant_type_new ("as");
 
927
                                                        _tmp44_ = _tmp43_;
 
928
                                                        _tmp45_ = g_variant_builder_new (_tmp44_);
 
929
                                                        _tmp46_ = _tmp45_;
 
930
                                                        _g_variant_type_free0 (_tmp44_);
 
931
                                                        builder = _tmp46_;
 
932
                                                        g_variant_builder_add (builder, "s", _acct, NULL);
 
933
                                                        _tmp47_ = json_array_get_element (nodeArray, (guint) i);
 
934
                                                        _tmp48_ = json_node_get_object (_tmp47_);
 
935
                                                        _tmp49_ = json_object_get_object_member (_tmp48_, "sender");
 
936
                                                        _tmp50_ = _json_object_ref0 (_tmp49_);
 
937
                                                        _sender_obj = _tmp50_;
 
938
                                                        _tmp51_ = json_object_get_string_member (_sender_obj, "name");
 
939
                                                        _tmp52_ = g_strdup (_tmp51_);
 
940
                                                        _sender = _tmp52_;
 
941
                                                        _sender_nick = NULL;
 
942
                                                        _tmp53_ = json_object_has_member (_sender_obj, "nick");
 
943
                                                        if (_tmp53_) {
 
944
                                                                const gchar* _tmp54_ = NULL;
 
945
                                                                gchar* _tmp55_;
 
946
                                                                _tmp54_ = json_object_get_string_member (_sender_obj, "nick");
 
947
                                                                _tmp55_ = g_strdup (_tmp54_);
 
948
                                                                _g_free0 (_sender_nick);
 
949
                                                                _sender_nick = _tmp55_;
 
950
                                                        }
 
951
                                                        _tmp56_ = json_object_get_boolean_member (_sender_obj, "is_me");
 
952
                                                        _from_me = _tmp56_;
 
953
                                                        _tmp57_ = json_array_get_element (nodeArray, (guint) i);
 
954
                                                        _tmp58_ = json_node_get_object (_tmp57_);
 
955
                                                        _tmp59_ = json_object_get_double_member (_tmp58_, "time");
 
956
                                                        _time = (guint) _tmp59_;
 
957
                                                        if (_time < 1) {
 
958
                                                                JsonNode* _tmp60_ = NULL;
 
959
                                                                JsonObject* _tmp61_ = NULL;
 
960
                                                                gint64 _tmp62_;
 
961
                                                                _tmp60_ = json_array_get_element (nodeArray, (guint) i);
 
962
                                                                _tmp61_ = json_node_get_object (_tmp60_);
 
963
                                                                _tmp62_ = json_object_get_int_member (_tmp61_, "time");
 
964
                                                                _time = (guint) _tmp62_;
 
965
                                                        }
 
966
                                                        _tmp63_ = json_array_get_element (nodeArray, (guint) i);
 
967
                                                        _tmp64_ = json_node_get_object (_tmp63_);
 
968
                                                        _tmp65_ = json_object_get_string_member (_tmp64_, "text");
 
969
                                                        _tmp66_ = g_strdup (_tmp65_);
 
970
                                                        _text = _tmp66_;
 
971
                                                        _tmp67_ = g_strdup ("");
 
972
                                                        _textid = _tmp67_;
 
973
                                                        _tmp68_ = string_replace (_text, ".", "");
 
974
                                                        _tmp69_ = _tmp68_;
 
975
                                                        _tmp71_ = _tmp70_ = g_strsplit (_tmp69_, " ", 0);
 
976
                                                        _tmp72_ = _tmp71_;
 
977
                                                        _g_free0 (_tmp69_);
 
978
                                                        {
 
979
                                                                gchar** x_collection;
 
980
                                                                int x_collection_length1;
 
981
                                                                int x_it;
 
982
                                                                x_collection = _tmp72_;
 
983
                                                                x_collection_length1 = _vala_array_length (_tmp70_);
 
984
                                                                for (x_it = 0; x_it < _vala_array_length (_tmp70_); x_it = x_it + 1) {
 
985
                                                                        gchar* _tmp73_;
 
986
                                                                        gchar* x;
 
987
                                                                        _tmp73_ = g_strdup (x_collection[x_it]);
 
988
                                                                        x = _tmp73_;
 
989
                                                                        {
 
990
                                                                                gboolean _tmp74_ = FALSE;
 
991
                                                                                gboolean _tmp75_ = FALSE;
 
992
                                                                                gboolean _tmp76_ = FALSE;
 
993
                                                                                gboolean _tmp77_ = FALSE;
 
994
                                                                                gboolean _tmp78_;
 
995
                                                                                _tmp78_ = g_str_has_prefix (x, "http://");
 
996
                                                                                if (!_tmp78_) {
 
997
                                                                                        gboolean _tmp79_;
 
998
                                                                                        _tmp79_ = g_str_has_prefix (x, "https://");
 
999
                                                                                        _tmp77_ = !_tmp79_;
 
1000
                                                                                } else {
 
1001
                                                                                        _tmp77_ = FALSE;
 
1002
                                                                                }
 
1003
                                                                                if (_tmp77_) {
 
1004
                                                                                        gboolean _tmp80_;
 
1005
                                                                                        _tmp80_ = g_str_has_prefix (x, "gwibber:/");
 
1006
                                                                                        _tmp76_ = !_tmp80_;
 
1007
                                                                                } else {
 
1008
                                                                                        _tmp76_ = FALSE;
 
1009
                                                                                }
 
1010
                                                                                if (_tmp76_) {
 
1011
                                                                                        gboolean _tmp81_;
 
1012
                                                                                        _tmp81_ = g_str_has_prefix (x, "#");
 
1013
                                                                                        _tmp75_ = !_tmp81_;
 
1014
                                                                                } else {
 
1015
                                                                                        _tmp75_ = FALSE;
 
1016
                                                                                }
 
1017
                                                                                if (_tmp75_) {
 
1018
                                                                                        gboolean _tmp82_;
 
1019
                                                                                        _tmp82_ = g_str_has_prefix (x, "!");
 
1020
                                                                                        _tmp74_ = !_tmp82_;
 
1021
                                                                                } else {
 
1022
                                                                                        _tmp74_ = FALSE;
 
1023
                                                                                }
 
1024
                                                                                if (_tmp74_) {
 
1025
                                                                                        gchar* _tmp83_;
 
1026
                                                                                        gchar* _tmp84_;
 
1027
                                                                                        gchar* _tmp85_;
 
1028
                                                                                        _tmp83_ = g_strconcat (x, " ", NULL);
 
1029
                                                                                        _tmp84_ = _tmp83_;
 
1030
                                                                                        _tmp85_ = g_strconcat (_textid, _tmp84_, NULL);
 
1031
                                                                                        _g_free0 (_textid);
 
1032
                                                                                        _textid = _tmp85_;
 
1033
                                                                                        _g_free0 (_tmp84_);
 
1034
                                                                                }
 
1035
                                                                                _g_free0 (x);
 
1036
                                                                        }
 
1037
                                                                }
 
1038
                                                                x_collection = (_vala_array_free (x_collection, x_collection_length1, (GDestroyNotify) g_free), NULL);
 
1039
                                                        }
 
1040
                                                        _tmp86_ = string_strip (_textid);
 
1041
                                                        _g_free0 (_textid);
 
1042
                                                        _textid = _tmp86_;
 
1043
                                                        _tmp87_ = gee_abstract_map_has_key ((GeeAbstractMap*) seen, _textid);
 
1044
                                                        if (_tmp87_) {
 
1045
                                                                gpointer _tmp88_ = NULL;
 
1046
                                                                GVariant* _tmp89_ = NULL;
 
1047
                                                                gint _tmp90_;
 
1048
                                                                gchar** _accounts_array;
 
1049
                                                                gint _accounts_array_length1;
 
1050
                                                                gint __accounts_array_size_;
 
1051
                                                                _tmp88_ = gee_abstract_map_get ((GeeAbstractMap*) seen, _textid);
 
1052
                                                                iter = (DeeModelIter*) _tmp88_;
 
1053
                                                                _tmp89_ = dee_model_get_value (self->priv->model, iter, (guint) GWIBBER_STREAM_MODEL_COLUMN_ACCOUNTS);
 
1054
                                                                _accounts_array = _variant_get1 (_tmp89_, &_tmp90_);
 
1055
                                                                _accounts_array_length1 = _tmp90_;
 
1056
                                                                __accounts_array_size_ = _tmp90_;
 
1057
                                                                if (!_vala_string_array_contains (_accounts_array, _accounts_array_length1, _acct)) {
 
1058
                                                                        GVariant* _tmp95_ = NULL;
 
1059
                                                                        GVariant* _accounts;
 
1060
                                                                        {
 
1061
                                                                                gchar** a_collection;
 
1062
                                                                                int a_collection_length1;
 
1063
                                                                                int a_it;
 
1064
                                                                                a_collection = _accounts_array;
 
1065
                                                                                a_collection_length1 = _accounts_array_length1;
 
1066
                                                                                for (a_it = 0; a_it < _accounts_array_length1; a_it = a_it + 1) {
 
1067
                                                                                        gchar* _tmp94_;
 
1068
                                                                                        gchar* a;
 
1069
                                                                                        _tmp94_ = g_strdup (a_collection[a_it]);
 
1070
                                                                                        a = _tmp94_;
 
1071
                                                                                        {
 
1072
                                                                                                g_variant_builder_add (builder, "s", a, NULL);
 
1073
                                                                                                _g_free0 (a);
 
1074
                                                                                        }
 
1075
                                                                                }
 
1076
                                                                        }
 
1077
                                                                        _tmp95_ = g_variant_new ("as", builder, NULL);
 
1078
                                                                        _accounts = g_variant_ref_sink (_tmp95_);
 
1079
                                                                        dee_model_set_value (self->priv->model, iter, (guint) GWIBBER_STREAM_MODEL_COLUMN_ACCOUNTS, _accounts);
 
1080
                                                                        _g_variant_unref0 (_accounts);
 
1081
                                                                }
 
1082
                                                                _accounts_array = (_vala_array_free (_accounts_array, _accounts_array_length1, (GDestroyNotify) g_free), NULL);
 
1083
                                                                _g_free0 (_textid);
 
1084
                                                                _g_free0 (_text);
 
1085
                                                                _g_free0 (_sender_nick);
 
1086
                                                                _g_free0 (_sender);
 
1087
                                                                _json_object_unref0 (_sender_obj);
 
1088
                                                                _g_variant_builder_unref0 (builder);
 
1089
                                                                _g_free0 (_acct);
 
1090
                                                                _g_free0 (_mid);
 
1091
                                                                _g_free0 (_service);
 
1092
                                                                _g_free0 (_stream);
 
1093
                                                                _g_free0 (_account);
 
1094
                                                                _g_list_free0 (members);
 
1095
                                                                continue;
 
1096
                                                        }
 
1097
                                                        _tmp96_ = json_array_get_element (nodeArray, (guint) i);
 
1098
                                                        _tmp97_ = json_node_get_object (_tmp96_);
 
1099
                                                        _tmp98_ = json_object_get_string_member (_tmp97_, "content");
 
1100
                                                        _tmp99_ = g_strdup (_tmp98_);
 
1101
                                                        _html = _tmp99_;
 
1102
                                                        _tmp100_ = json_object_get_string_member (_sender_obj, "image");
 
1103
                                                        _tmp101_ = g_strdup (_tmp100_);
 
1104
                                                        _icon = _tmp101_;
 
1105
                                                        _tmp102_ = json_array_get_element (nodeArray, (guint) i);
 
1106
                                                        _tmp103_ = json_node_get_object (_tmp102_);
 
1107
                                                        _tmp104_ = json_object_get_string_member (_tmp103_, "url");
 
1108
                                                        _tmp105_ = g_strdup (_tmp104_);
 
1109
                                                        _url = _tmp105_;
 
1110
                                                        _source = NULL;
 
1111
                                                        _reply = NULL;
 
1112
                                                        _reply_url = NULL;
 
1113
                                                        _likes = (gdouble) 0;
 
1114
                                                        _retweeted_by_nick = NULL;
 
1115
                                                        _retweeted_by_name = NULL;
 
1116
                                                        _retweeted_by_id = NULL;
 
1117
                                                        {
 
1118
                                                                GList* member_collection;
 
1119
                                                                GList* member_it;
 
1120
                                                                member_collection = members;
 
1121
                                                                for (member_it = member_collection; member_it != NULL; member_it = member_it->next) {
 
1122
                                                                        gchar* _tmp106_;
 
1123
                                                                        gchar* member;
 
1124
                                                                        _tmp106_ = g_strdup ((const gchar*) member_it->data);
 
1125
                                                                        member = _tmp106_;
 
1126
                                                                        {
 
1127
                                                                                if (g_strcmp0 (member, "retweeted_by") == 0) {
 
1128
                                                                                        JsonNode* _tmp107_ = NULL;
 
1129
                                                                                        JsonObject* _tmp108_ = NULL;
 
1130
                                                                                        JsonObject* _tmp109_ = NULL;
 
1131
                                                                                        JsonObject* _tmp110_;
 
1132
                                                                                        JsonObject* _retweet_obj;
 
1133
                                                                                        const gchar* _tmp111_ = NULL;
 
1134
                                                                                        gchar* _tmp112_;
 
1135
                                                                                        const gchar* _tmp113_ = NULL;
 
1136
                                                                                        gchar* _tmp114_;
 
1137
                                                                                        gint64 _tmp115_;
 
1138
                                                                                        gchar* _tmp116_ = NULL;
 
1139
                                                                                        _tmp107_ = json_array_get_element (nodeArray, (guint) i);
 
1140
                                                                                        _tmp108_ = json_node_get_object (_tmp107_);
 
1141
                                                                                        _tmp109_ = json_object_get_object_member (_tmp108_, member);
 
1142
                                                                                        _tmp110_ = _json_object_ref0 (_tmp109_);
 
1143
                                                                                        _retweet_obj = _tmp110_;
 
1144
                                                                                        _tmp111_ = json_object_get_string_member (_retweet_obj, "nick");
 
1145
                                                                                        _tmp112_ = g_strdup (_tmp111_);
 
1146
                                                                                        _g_free0 (_retweeted_by_nick);
 
1147
                                                                                        _retweeted_by_nick = _tmp112_;
 
1148
                                                                                        _tmp113_ = json_object_get_string_member (_retweet_obj, "name");
 
1149
                                                                                        _tmp114_ = g_strdup (_tmp113_);
 
1150
                                                                                        _g_free0 (_retweeted_by_name);
 
1151
                                                                                        _retweeted_by_name = _tmp114_;
 
1152
                                                                                        _tmp115_ = json_object_get_int_member (_retweet_obj, "id");
 
1153
                                                                                        _tmp116_ = g_strdup_printf ("%" G_GINT64_FORMAT, _tmp115_);
 
1154
                                                                                        _g_free0 (_retweeted_by_id);
 
1155
                                                                                        _retweeted_by_id = _tmp116_;
 
1156
                                                                                        _json_object_unref0 (_retweet_obj);
 
1157
                                                                                }
 
1158
                                                                                if (g_strcmp0 (member, "source") == 0) {
 
1159
                                                                                        JsonNode* _tmp117_ = NULL;
 
1160
                                                                                        JsonObject* _tmp118_ = NULL;
 
1161
                                                                                        const gchar* _tmp119_ = NULL;
 
1162
                                                                                        gchar* _tmp120_;
 
1163
                                                                                        _tmp117_ = json_array_get_element (nodeArray, (guint) i);
 
1164
                                                                                        _tmp118_ = json_node_get_object (_tmp117_);
 
1165
                                                                                        _tmp119_ = json_object_get_string_member (_tmp118_, "source");
 
1166
                                                                                        _tmp120_ = g_strdup (_tmp119_);
 
1167
                                                                                        _g_free0 (_source);
 
1168
                                                                                        _source = _tmp120_;
 
1169
                                                                                        if (_source != NULL) {
 
1170
                                                                                                gchar* _tmp121_ = NULL;
 
1171
                                                                                                _tmp121_ = string_replace (_source, "rel=\"nofollow\"", "");
 
1172
                                                                                                _g_free0 (_source);
 
1173
                                                                                                _source = _tmp121_;
 
1174
                                                                                        }
 
1175
                                                                                }
 
1176
                                                                                if (g_strcmp0 (member, "reply") == 0) {
 
1177
                                                                                        JsonNode* _tmp122_ = NULL;
 
1178
                                                                                        JsonObject* _tmp123_ = NULL;
 
1179
                                                                                        JsonObject* _tmp124_ = NULL;
 
1180
                                                                                        JsonObject* _tmp125_;
 
1181
                                                                                        JsonObject* _reply_obj;
 
1182
                                                                                        const gchar* _tmp126_ = NULL;
 
1183
                                                                                        gchar* _tmp127_;
 
1184
                                                                                        const gchar* _tmp128_ = NULL;
 
1185
                                                                                        gchar* _tmp129_;
 
1186
                                                                                        _tmp122_ = json_array_get_element (nodeArray, (guint) i);
 
1187
                                                                                        _tmp123_ = json_node_get_object (_tmp122_);
 
1188
                                                                                        _tmp124_ = json_object_get_object_member (_tmp123_, "reply");
 
1189
                                                                                        _tmp125_ = _json_object_ref0 (_tmp124_);
 
1190
                                                                                        _reply_obj = _tmp125_;
 
1191
                                                                                        _tmp126_ = json_object_get_string_member (_reply_obj, "nick");
 
1192
                                                                                        _tmp127_ = g_strdup (_tmp126_);
 
1193
                                                                                        _g_free0 (_reply);
 
1194
                                                                                        _reply = _tmp127_;
 
1195
                                                                                        _tmp128_ = json_object_get_string_member (_reply_obj, "url");
 
1196
                                                                                        _tmp129_ = g_strdup (_tmp128_);
 
1197
                                                                                        _g_free0 (_reply_url);
 
1198
                                                                                        _reply_url = _tmp129_;
 
1199
                                                                                        _json_object_unref0 (_reply_obj);
 
1200
                                                                                }
 
1201
                                                                                if (g_strcmp0 (member, "likes") == 0) {
 
1202
                                                                                        JsonNode* _tmp130_ = NULL;
 
1203
                                                                                        JsonObject* _tmp131_ = NULL;
 
1204
                                                                                        JsonObject* _tmp132_ = NULL;
 
1205
                                                                                        JsonObject* _tmp133_;
 
1206
                                                                                        JsonObject* _likes_obj;
 
1207
                                                                                        gint64 _tmp134_;
 
1208
                                                                                        _tmp130_ = json_array_get_element (nodeArray, (guint) i);
 
1209
                                                                                        _tmp131_ = json_node_get_object (_tmp130_);
 
1210
                                                                                        _tmp132_ = json_object_get_object_member (_tmp131_, "likes");
 
1211
                                                                                        _tmp133_ = _json_object_ref0 (_tmp132_);
 
1212
                                                                                        _likes_obj = _tmp133_;
 
1213
                                                                                        _tmp134_ = json_object_get_int_member (_likes_obj, "count");
 
1214
                                                                                        _likes = (gdouble) _tmp134_;
 
1215
                                                                                        _json_object_unref0 (_likes_obj);
 
1216
                                                                                }
 
1217
                                                                                if (g_strcmp0 (member, "favorited") == 0) {
 
1218
                                                                                        JsonNode* _tmp135_ = NULL;
 
1219
                                                                                        JsonObject* _tmp136_ = NULL;
 
1220
                                                                                        gboolean _tmp137_;
 
1221
                                                                                        _tmp135_ = json_array_get_element (nodeArray, (guint) i);
 
1222
                                                                                        _tmp136_ = json_node_get_object (_tmp135_);
 
1223
                                                                                        _tmp137_ = json_object_get_boolean_member (_tmp136_, "favorited");
 
1224
                                                                                        if (_tmp137_) {
 
1225
                                                                                                _likes = (gdouble) (-1);
 
1226
                                                                                        }
 
1227
                                                                                }
 
1228
                                                                                _g_free0 (member);
 
1229
                                                                        }
 
1230
                                                                }
 
1231
                                                        }
 
1232
                                                        _tmp138_ = string_replace (_html, "&", "&amp;");
 
1233
                                                        _g_free0 (_html);
 
1234
                                                        _html = _tmp138_;
 
1235
                                                        _tmp139_ = string_replace (_html, "class=\"nick\"", "");
 
1236
                                                        _g_free0 (_html);
 
1237
                                                        _html = _tmp139_;
 
1238
                                                        _tmp140_ = string_replace (_html, "class=\"hash\"", "");
 
1239
                                                        _g_free0 (_html);
 
1240
                                                        _html = _tmp140_;
 
1241
                                                        _tmp141_ = gwibber_utils_generate_time_string (self->priv->utils, _time);
 
1242
                                                        _t = _tmp141_;
 
1243
                                                        _tmp142_ = g_variant_new ("as", builder, NULL);
 
1244
                                                        _accounts = g_variant_ref_sink (_tmp142_);
 
1245
                                                        _tmp143_ = g_strdup_printf ("%u", _time);
 
1246
                                                        _tmp144_ = _tmp143_;
 
1247
                                                        _tmp145_ = dee_model_append (self->priv->model, _accounts, _stream, _sender, _sender_nick, _from_me, _tmp144_, _text, _html, _icon, _url, _source, _t, _reply, _reply_url, _likes, _retweeted_by_nick, _retweeted_by_name, _retweeted_by_id, NULL);
 
1248
                                                        iter = _tmp145_;
 
1249
                                                        _g_free0 (_tmp144_);
 
1250
                                                        _tmp146_ = strlen (_textid);
 
1251
                                                        if (_tmp146_ > 1) {
 
1252
                                                                gee_abstract_map_set ((GeeAbstractMap*) seen, _textid, iter);
 
1253
                                                        }
 
1254
                                                        _g_variant_unref0 (_accounts);
 
1255
                                                        _g_free0 (_t);
 
1256
                                                        _g_free0 (_retweeted_by_id);
 
1257
                                                        _g_free0 (_retweeted_by_name);
 
1258
                                                        _g_free0 (_retweeted_by_nick);
 
1259
                                                        _g_free0 (_reply_url);
 
1260
                                                        _g_free0 (_reply);
 
1261
                                                        _g_free0 (_source);
 
1262
                                                        _g_free0 (_url);
 
1263
                                                        _g_free0 (_icon);
 
1264
                                                        _g_free0 (_html);
 
1265
                                                        _g_free0 (_textid);
 
1266
                                                        _g_free0 (_text);
 
1267
                                                        _g_free0 (_sender_nick);
 
1268
                                                        _g_free0 (_sender);
 
1269
                                                        _json_object_unref0 (_sender_obj);
 
1270
                                                        _g_variant_builder_unref0 (builder);
 
1271
                                                        _g_free0 (_acct);
 
1272
                                                        _g_free0 (_mid);
 
1273
                                                        _g_free0 (_service);
 
1274
                                                        _g_free0 (_stream);
 
1275
                                                        _g_free0 (_account);
 
1276
                                                        _g_list_free0 (members);
 
1277
                                                }
 
1278
                                        }
 
1279
                                }
 
1280
                                _g_object_unref0 (seen);
 
1281
                                _json_array_unref0 (nodeArray);
 
1282
                                _g_object_unref0 (parser);
 
1283
                                _g_free0 (messages);
 
1284
                                _g_free0 (stream);
 
1285
                        }
 
1286
                }
 
1287
        }
 
1288
        __g_list_free__g_free0_0 (streams);
 
1289
}
 
1290
 
 
1291
 
 
1292
void gwibber_streams_streams_available (GwibberStreams* self, gboolean is_up) {
 
1293
        g_return_if_fail (self != NULL);
 
1294
        g_signal_emit_by_name (self, "is-available", is_up);
 
1295
}
 
1296
 
 
1297
 
 
1298
static void gwibber_streams_class_init (GwibberStreamsClass * klass) {
 
1299
        gwibber_streams_parent_class = g_type_class_peek_parent (klass);
 
1300
        g_type_class_add_private (klass, sizeof (GwibberStreamsPrivate));
 
1301
        G_OBJECT_CLASS (klass)->finalize = gwibber_streams_finalize;
 
1302
        /** 
 
1303
                    Streams::is_available:
 
1304
                    @arg0: The current state
 
1305
        
 
1306
                    Emitted when com.Gwibber.Streams availability state changes
 
1307
        */
 
1308
        g_signal_new ("is_available", GWIBBER_TYPE_STREAMS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
 
1309
}
 
1310
 
 
1311
 
 
1312
static void gwibber_streams_instance_init (GwibberStreams * self) {
 
1313
        self->priv = GWIBBER_STREAMS_GET_PRIVATE (self);
 
1314
}
 
1315
 
 
1316
 
 
1317
static void gwibber_streams_finalize (GObject* obj) {
 
1318
        GwibberStreams * self;
 
1319
        self = GWIBBER_STREAMS (obj);
 
1320
        _g_object_unref0 (self->priv->streams_service);
 
1321
        _g_object_unref0 (self->priv->service);
 
1322
        _g_object_unref0 (self->priv->utils);
 
1323
        _g_object_unref0 (self->priv->messages_service);
 
1324
        _g_object_unref0 (self->priv->model);
 
1325
        G_OBJECT_CLASS (gwibber_streams_parent_class)->finalize (obj);
 
1326
}
 
1327
 
 
1328
 
 
1329
GType gwibber_streams_get_type (void) {
 
1330
        static volatile gsize gwibber_streams_type_id__volatile = 0;
 
1331
        if (g_once_init_enter (&gwibber_streams_type_id__volatile)) {
 
1332
                static const GTypeInfo g_define_type_info = { sizeof (GwibberStreamsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gwibber_streams_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GwibberStreams), 0, (GInstanceInitFunc) gwibber_streams_instance_init, NULL };
 
1333
                GType gwibber_streams_type_id;
 
1334
                gwibber_streams_type_id = g_type_register_static (G_TYPE_OBJECT, "GwibberStreams", &g_define_type_info, 0);
 
1335
                g_once_init_leave (&gwibber_streams_type_id__volatile, gwibber_streams_type_id);
 
1336
        }
 
1337
        return gwibber_streams_type_id__volatile;
 
1338
}
 
1339
 
 
1340
 
 
1341
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
1342
        if ((array != NULL) && (destroy_func != NULL)) {
 
1343
                int i;
 
1344
                for (i = 0; i < array_length; i = i + 1) {
 
1345
                        if (((gpointer*) array)[i] != NULL) {
 
1346
                                destroy_func (((gpointer*) array)[i]);
 
1347
                        }
 
1348
                }
 
1349
        }
 
1350
}
 
1351
 
 
1352
 
 
1353
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
1354
        _vala_array_destroy (array, array_length, destroy_func);
 
1355
        g_free (array);
 
1356
}
 
1357
 
 
1358
 
 
1359
static gint _vala_array_length (gpointer array) {
 
1360
        int length;
 
1361
        length = 0;
 
1362
        if (array) {
 
1363
                while (((gpointer*) array)[length]) {
 
1364
                        length++;
 
1365
                }
 
1366
        }
 
1367
        return length;
 
1368
}
 
1369
 
 
1370
 
 
1371