summaryrefslogtreecommitdiff
path: root/libgaim/plugins/perl/common/Status.xs
blob: 02ae4b2b4b65b15e5a5b4bb90449ea401a22712d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
#include "module.h"

/* TODO

void
gaim_status_type_add_attrs(status_type, id, name, value, gaim_status_type_add_attrs)
	Gaim::StatusType status_type
	const char *id
	const char *name
	Gaim::Value value
	...

Gaim::StatusType
gaim_status_type_new_with_attrs(primitive, id, name, saveable, user_settable, independent, attr_id, attr_name, attr_value, gaim_status_type_new_with_attrs)
	Gaim::StatusPrimitive primitive
	const char *id
	const char *name
	gboolean saveable
	gboolean user_settable
	gboolean independent
	const char *attr_id
	const char *attr_name
	Gaim::Value attr_value
	...

*/

/* These break on faceprint's amd64 box
void
gaim_status_type_add_attrs_vargs(status_type, args)
	Gaim::StatusType status_type
	va_list args

void
gaim_status_set_active_with_attrs(status, active, args)
	Gaim::Status status
	gboolean active
	va_list args

	*/

MODULE = Gaim::Status  PACKAGE = Gaim::Presence  PREFIX = gaim_presence_
PROTOTYPES: ENABLE

void
gaim_presence_add_list(presence, source_list)
	Gaim::Presence presence
	SV *source_list
PREINIT:
	GList *t_GL;
	int i, t_len;
PPCODE:
	t_GL = NULL;
	t_len = av_len((AV *)SvRV(source_list));

	for (i = 0; i < t_len; i++) {
		STRLEN t_sl;
		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(source_list), i, 0), t_sl));
	}
	gaim_presence_add_list(presence, t_GL);

void
gaim_presence_add_status(presence, status)
	Gaim::Presence presence
	Gaim::Status status

gint
gaim_presence_compare(presence1, presence2)
	Gaim::Presence presence1
	Gaim::Presence presence2

void
gaim_presence_destroy(presence)
	Gaim::Presence presence

Gaim::Account
gaim_presence_get_account(presence)
	Gaim::Presence presence

Gaim::Status
gaim_presence_get_active_status(presence)
	Gaim::Presence presence

void
gaim_presence_get_buddies(presence)
	Gaim::Presence presence
PREINIT:
	const GList *l;
PPCODE:
	for (l = gaim_presence_get_buddies(presence); l != NULL; l = l->next) {
		XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data, "Gaim::BuddyList::Buddy")));
	}

const char *
gaim_presence_get_chat_user(presence)
	Gaim::Presence presence

Gaim::PresenceContext
gaim_presence_get_context(presence)
	Gaim::Presence presence

Gaim::Conversation
gaim_presence_get_conversation(presence)
	Gaim::Presence presence

time_t
gaim_presence_get_idle_time(presence)
	Gaim::Presence presence

time_t
gaim_presence_get_login_time(presence)
	Gaim::Presence presence

Gaim::Status
gaim_presence_get_status(presence, status_id)
	Gaim::Presence presence
	const char *status_id

void
gaim_presence_get_statuses(presence)
	Gaim::Presence presence
PREINIT:
	const GList *l;
PPCODE:
	for (l = gaim_presence_get_statuses(presence); l != NULL; l = l->next) {
		XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data, "Gaim::Status")));
	}

gboolean
gaim_presence_is_available(presence)
	Gaim::Presence presence

gboolean
gaim_presence_is_idle(presence)
	Gaim::Presence presence

gboolean
gaim_presence_is_online(presence)
	Gaim::Presence presence

gboolean
gaim_presence_is_status_active(presence, status_id)
	Gaim::Presence presence
	const char *status_id

gboolean
gaim_presence_is_status_primitive_active(presence, primitive)
	Gaim::Presence presence
	Gaim::StatusPrimitive primitive

Gaim::Presence
gaim_presence_new(context)
	Gaim::PresenceContext context

Gaim::Presence
gaim_presence_new_for_account(account)
	Gaim::Account account

Gaim::Presence
gaim_presence_new_for_buddy(buddy)
	Gaim::BuddyList::Buddy buddy

Gaim::Presence
gaim_presence_new_for_conv(conv)
	Gaim::Conversation conv

void
gaim_presence_remove_buddy(presence, buddy)
	Gaim::Presence presence
	Gaim::BuddyList::Buddy buddy

void
gaim_presence_set_idle(presence, idle, idle_time)
	Gaim::Presence presence
	gboolean idle
	time_t idle_time

void
gaim_presence_set_login_time(presence, login_time)
	Gaim::Presence presence
	time_t login_time

void
gaim_presence_set_status_active(presence, status_id, active)
	Gaim::Presence presence
	const char *status_id
	gboolean active

void
gaim_presence_switch_status(presence, status_id)
	Gaim::Presence presence
	const char *status_id

MODULE = Gaim::Status  PACKAGE = Gaim::Primitive  PREFIX = gaim_primitive_
PROTOTYPES: ENABLE

const char *
gaim_primitive_get_id_from_type(type)
	Gaim::StatusPrimitive type

const char *
gaim_primitive_get_name_from_type(type)
	Gaim::StatusPrimitive type

Gaim::StatusPrimitive
gaim_primitive_get_type_from_id(id)
	const char *id

MODULE = Gaim::Status  PACKAGE = Gaim::StatusAttr PREFIX = gaim_status_attr_
PROTOTYPES: ENABLE

void
gaim_status_attr_destroy(attr)
	Gaim::StatusAttr attr

const char *
gaim_status_attr_get_id(attr)
	Gaim::StatusAttr attr

const char *
gaim_status_attr_get_name(attr)
	Gaim::StatusAttr attr

Gaim::Value
gaim_status_attr_get_value(attr)
	Gaim::StatusAttr attr

Gaim::StatusAttr
gaim_status_attr_new(id, name, value_type)
	const char *id
	const char *name
	Gaim::Value value_type

MODULE = Gaim::Status  PACKAGE = Gaim::Status  PREFIX = gaim_status_
PROTOTYPES: ENABLE

gint
gaim_status_compare(status1, status2)
	Gaim::Status status1
	Gaim::Status status2

void
gaim_status_destroy(status)
	Gaim::Status status

gboolean
gaim_status_get_attr_boolean(status, id)
	Gaim::Status status
	const char *id

int
gaim_status_get_attr_int(status, id)
	Gaim::Status status
	const char *id

const char *
gaim_status_get_attr_string(status, id)
	Gaim::Status status
	const char *id

Gaim::Value
gaim_status_get_attr_value(status, id)
	Gaim::Status status
	const char *id

Gaim::Handle
gaim_status_get_handle()

const char *
gaim_status_get_id(status)
	Gaim::Status status

const char *
gaim_status_get_name(status)
	Gaim::Status status

Gaim::Presence
gaim_status_get_presence(status)
	Gaim::Status status

Gaim::StatusType
gaim_status_get_type(status)
	Gaim::Status status

gboolean
gaim_status_is_active(status)
	Gaim::Status status

gboolean
gaim_status_is_available(status)
	Gaim::Status status

gboolean
gaim_status_is_exclusive(status)
	Gaim::Status status

gboolean
gaim_status_is_independent(status)
	Gaim::Status status

gboolean
gaim_status_is_online(status)
	Gaim::Status status

Gaim::Status
gaim_status_new(status_type, presence)
	Gaim::StatusType status_type
	Gaim::Presence presence

void
gaim_status_set_active(status, active)
	Gaim::Status status
	gboolean active

void
gaim_status_set_attr_boolean(status, id, value)
	Gaim::Status status
	const char *id
	gboolean value

void
gaim_status_set_attr_string(status, id, value)
	Gaim::Status status
	const char *id
	const char *value

void
gaim_status_init()

void
gaim_status_uninit()

MODULE = Gaim::Status  PACKAGE = Gaim::StatusType  PREFIX = gaim_status_type_
PROTOTYPES: ENABLE

void
gaim_status_type_add_attr(status_type, id, name, value)
	Gaim::StatusType status_type
	const char *id
	const char *name
	Gaim::Value value

void
gaim_status_type_destroy(status_type)
	Gaim::StatusType status_type

Gaim::StatusType
gaim_status_type_find_with_id(status_types, id)
	SV *status_types
	const char *id
PREINIT:
/* XXX Check that this function actually works, I think it might need a */
/* status_type as it's first argument to work as $status_type->find_with_id */
/* properly. */
	GList *t_GL;
	int i, t_len;
CODE:
	t_GL = NULL;
	t_len = av_len((AV *)SvRV(status_types));

	for (i = 0; i < t_len; i++) {
		STRLEN t_sl;
		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(status_types), i, 0), t_sl));
	}
	RETVAL = (GaimStatusType *)gaim_status_type_find_with_id(t_GL, id);
OUTPUT:
	RETVAL

Gaim::StatusAttr
gaim_status_type_get_attr(status_type, id)
	Gaim::StatusType status_type
	const char *id

void
gaim_status_type_get_attrs(status_type)
	Gaim::StatusType status_type
PREINIT:
	const GList *l;
PPCODE:
	for (l = gaim_status_type_get_attrs(status_type); l != NULL; l = l->next) {
		XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data, "Gaim::StatusAttr")));
	}

const char *
gaim_status_type_get_id(status_type)
	Gaim::StatusType status_type

const char *
gaim_status_type_get_name(status_type)
	Gaim::StatusType status_type

const char *
gaim_status_type_get_primary_attr(status_type)
	Gaim::StatusType status_type

Gaim::StatusPrimitive
gaim_status_type_get_primitive(status_type)
	Gaim::StatusType status_type

gboolean
gaim_status_type_is_available(status_type)
	Gaim::StatusType status_type

gboolean
gaim_status_type_is_exclusive(status_type)
	Gaim::StatusType status_type

gboolean
gaim_status_type_is_independent(status_type)
	Gaim::StatusType status_type

gboolean
gaim_status_type_is_saveable(status_type)
	Gaim::StatusType status_type

gboolean
gaim_status_type_is_user_settable(status_type)
	Gaim::StatusType status_type

Gaim::StatusType
gaim_status_type_new(primitive, id, name, user_settable)
	Gaim::StatusPrimitive primitive
	const char *id
	const char *name
	gboolean user_settable

Gaim::StatusType
gaim_status_type_new_full(primitive, id, name, saveable, user_settable, independent)
	Gaim::StatusPrimitive primitive
	const char *id
	const char *name
	gboolean saveable
	gboolean user_settable
	gboolean independent

void
gaim_status_type_set_primary_attr(status_type, attr_id)
	Gaim::StatusType status_type
	const char *attr_id