Mercurial > pidgin.yaz
annotate src/status.c @ 10302:581de78cf809
[gaim-migrate @ 11487]
Rename main.c to gtkmain.c
Change POTFILES.in to reflect the new file names
Update the po's so they use the new file names
Update the po's to use the correct line numbers (or whatever make dist does)
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 02 Dec 2004 23:48:48 +0000 |
parents | 393f85d9f8dd |
children | 2a132b73a6e6 |
rev | line source |
---|---|
9944 | 1 /** |
10067 | 2 * @file status.c Status API |
9944 | 3 * @ingroup core |
4 * | |
6065 | 5 * gaim |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
9944 | 10 * |
6065 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
9949 | 25 #include "internal.h" |
6065 | 26 |
9949 | 27 #include "blist.h" |
28 #include "debug.h" | |
29 #include "prefs.h" | |
6065 | 30 #include "status.h" |
31 #include "util.h" | |
32 | |
9949 | 33 /** |
34 * A type of status. | |
35 */ | |
36 struct _GaimStatusType | |
37 { | |
38 GaimStatusPrimitive primitive; | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6321
diff
changeset
|
39 |
9949 | 40 char *id; |
41 char *name; | |
42 char *primary_attr_id; | |
43 | |
44 gboolean saveable; | |
45 gboolean user_settable; | |
46 gboolean independent; | |
47 | |
48 GList *attrs; | |
49 }; | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6321
diff
changeset
|
50 |
9949 | 51 /** |
52 * A status attribute. | |
53 */ | |
54 struct _GaimStatusAttr | |
55 { | |
56 char *id; | |
57 char *name; | |
58 GaimValue *value_type; | |
59 }; | |
6065 | 60 |
9949 | 61 /** |
62 * A list of statuses. | |
63 */ | |
64 struct _GaimPresence | |
65 { | |
66 GaimPresenceContext context; | |
67 | |
68 gboolean idle; | |
69 time_t idle_time; | |
10006 | 70 time_t login_time; |
9949 | 71 |
72 unsigned int warning_level; | |
6065 | 73 |
9949 | 74 GList *statuses; |
75 GHashTable *status_table; | |
76 | |
77 GaimStatus *active_status; | |
6065 | 78 |
9949 | 79 union |
80 { | |
81 GaimAccount *account; | |
82 | |
83 struct | |
84 { | |
85 GaimConversation *conv; | |
86 char *user; | |
87 | |
88 } chat; | |
6065 | 89 |
9949 | 90 struct |
91 { | |
92 GaimAccount *account; | |
93 char *name; | |
94 size_t ref_count; | |
95 GList *buddies; | |
96 | |
97 } buddy; | |
98 | |
99 } u; | |
100 }; | |
101 | |
102 /** | |
103 * An active status. | |
104 */ | |
105 struct _GaimStatus | |
6065 | 106 { |
9949 | 107 GaimStatusType *type; |
108 GaimPresence *presence; | |
109 | |
110 const char *title; | |
6065 | 111 |
9949 | 112 gboolean active; |
6065 | 113 |
9949 | 114 GHashTable *attr_values; |
115 }; | |
6065 | 116 |
117 typedef struct | |
118 { | |
9949 | 119 GaimAccount *account; |
120 char *name; | |
121 } GaimStatusBuddyKey; | |
122 | |
123 | |
124 #if 0 | |
125 static GList *stored_statuses = NULL; | |
126 | |
127 /* | |
128 * XXX This stuff should be removed in a few versions. It stores the | |
129 * old v1 status stuff so we can write it later. We don't write out | |
130 * the new status stuff, though. These should all die soon, as the | |
131 * old status.xml was created before the new status system's design | |
132 * was created. | |
133 * | |
134 * -- ChipX86 | |
135 */ | |
136 typedef struct | |
137 { | |
138 char *name; | |
139 char *state; | |
140 char *message; | |
141 | |
142 } GaimStatusV1Info; | |
143 | |
144 static GList *v1_statuses = NULL; | |
145 #endif | |
146 | |
147 | |
148 static int primitive_scores[] = | |
149 { | |
150 0, /* unset */ | |
151 -500, /* offline */ | |
152 0, /* online */ | |
153 100, /* available */ | |
154 -75, /* unavailable */ | |
155 -50, /* hidden */ | |
156 -100, /* away */ | |
157 -200 /* extended away */ | |
158 -10, /* idle, special case. */ | |
159 -5 /* idle time, special case. */ | |
160 }; | |
161 | |
162 static GHashTable *buddy_presences = NULL; | |
163 | |
164 #define SCORE_IDLE 5 | |
165 #define SCORE_IDLE_TIME 6 | |
166 | |
167 /************************************************************************** | |
168 * GaimStatusType API | |
169 **************************************************************************/ | |
170 GaimStatusType * | |
171 gaim_status_type_new_full(GaimStatusPrimitive primitive, const char *id, | |
10009 | 172 const char *name, gboolean saveable, |
173 gboolean user_settable, gboolean independent) | |
9949 | 174 { |
175 GaimStatusType *status_type; | |
176 | |
177 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL); | |
178 g_return_val_if_fail(id != NULL, NULL); | |
179 g_return_val_if_fail(name != NULL, NULL); | |
180 | |
181 status_type = g_new0(GaimStatusType, 1); | |
182 | |
183 status_type->primitive = primitive; | |
184 status_type->id = g_strdup(id); | |
185 status_type->name = g_strdup(name); | |
186 status_type->saveable = saveable; | |
187 status_type->user_settable = user_settable; | |
188 status_type->independent = independent; | |
189 | |
190 return status_type; | |
191 } | |
192 | |
193 GaimStatusType * | |
194 gaim_status_type_new(GaimStatusPrimitive primitive, const char *id, | |
10009 | 195 const char *name, gboolean user_settable) |
9949 | 196 { |
197 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL); | |
198 g_return_val_if_fail(id != NULL, NULL); | |
199 g_return_val_if_fail(name != NULL, NULL); | |
200 | |
201 return gaim_status_type_new_full(primitive, id, name, FALSE, | |
202 user_settable, FALSE); | |
203 } | |
204 | |
205 GaimStatusType * | |
206 gaim_status_type_new_with_attrs(GaimStatusPrimitive primitive, | |
207 const char *id, const char *name, | |
208 gboolean saveable, gboolean user_settable, | |
209 gboolean independent, const char *attr_id, | |
210 const char *attr_name, GaimValue *attr_value, | |
211 ...) | |
212 { | |
213 GaimStatusType *status_type; | |
214 va_list args; | |
215 | |
216 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL); | |
217 g_return_val_if_fail(id != NULL, NULL); | |
218 g_return_val_if_fail(name != NULL, NULL); | |
10012 | 219 g_return_val_if_fail(attr_id != NULL, NULL); |
9949 | 220 g_return_val_if_fail(attr_name != NULL, NULL); |
221 g_return_val_if_fail(attr_value != NULL, NULL); | |
222 | |
223 status_type = gaim_status_type_new_full(primitive, id, name, saveable, | |
224 user_settable, independent); | |
225 | |
10010 | 226 /* Add the first attribute */ |
9949 | 227 gaim_status_type_add_attr(status_type, attr_id, attr_name, attr_value); |
228 | |
229 va_start(args, attr_value); | |
230 gaim_status_type_add_attrs_vargs(status_type, args); | |
231 va_end(args); | |
232 | |
233 return status_type; | |
234 } | |
235 | |
236 void | |
237 gaim_status_type_destroy(GaimStatusType *status_type) | |
238 { | |
239 GList *l; | |
240 | |
241 g_return_if_fail(status_type != NULL); | |
242 | |
243 g_free(status_type->id); | |
244 g_free(status_type->name); | |
245 | |
246 if (status_type->primary_attr_id != NULL) | |
247 g_free(status_type->primary_attr_id); | |
248 | |
249 if (status_type->attrs != NULL) | |
250 { | |
251 for (l = status_type->attrs; l != NULL; l = l->next) | |
252 gaim_status_attr_destroy((GaimStatusAttr *)l->data); | |
253 | |
254 g_list_free(status_type->attrs); | |
255 } | |
256 | |
257 g_free(status_type); | |
258 } | |
259 | |
260 void | |
261 gaim_status_type_set_primary_attr(GaimStatusType *status_type, const char *id) | |
262 { | |
263 g_return_if_fail(status_type != NULL); | |
264 | |
265 if (status_type->primary_attr_id != NULL) | |
266 g_free(status_type->primary_attr_id); | |
267 | |
268 status_type->primary_attr_id = (id == NULL ? NULL : g_strdup(id)); | |
269 } | |
270 | |
271 void | |
10197 | 272 gaim_status_type_add_attr(GaimStatusType *status_type, const char *id, |
9949 | 273 const char *name, GaimValue *value) |
274 { | |
275 GaimStatusAttr *attr; | |
276 | |
277 g_return_if_fail(status_type != NULL); | |
278 g_return_if_fail(id != NULL); | |
279 g_return_if_fail(name != NULL); | |
280 g_return_if_fail(value != NULL); | |
281 | |
282 attr = gaim_status_attr_new(id, name, value); | |
283 | |
284 status_type->attrs = g_list_append(status_type->attrs, attr); | |
285 } | |
286 | |
287 void | |
288 gaim_status_type_add_attrs_vargs(GaimStatusType *status_type, va_list args) | |
289 { | |
290 const char *id, *name; | |
291 GaimValue *value; | |
292 | |
293 g_return_if_fail(status_type != NULL); | |
294 | |
295 while ((id = va_arg(args, const char *)) != NULL) | |
296 { | |
297 name = va_arg(args, const char *); | |
298 g_return_if_fail(name != NULL); | |
299 | |
300 value = va_arg(args, GaimValue *); | |
301 g_return_if_fail(value != NULL); | |
6065 | 302 |
9949 | 303 gaim_status_type_add_attr(status_type, id, name, value); |
304 } | |
305 } | |
306 | |
10010 | 307 void |
308 gaim_status_type_add_attrs(GaimStatusType *status_type, const char *id, | |
309 const char *name, GaimValue *value, ...) | |
310 { | |
311 va_list args; | |
312 | |
313 g_return_if_fail(status_type != NULL); | |
314 g_return_if_fail(id != NULL); | |
315 g_return_if_fail(name != NULL); | |
316 g_return_if_fail(value != NULL); | |
317 | |
318 /* Add the first attribute */ | |
319 gaim_status_type_add_attr(status_type, id, name, value); | |
320 | |
321 va_start(args, value); | |
322 gaim_status_type_add_attrs_vargs(status_type, args); | |
323 va_end(args); | |
324 } | |
325 | |
9949 | 326 GaimStatusPrimitive |
327 gaim_status_type_get_primitive(const GaimStatusType *status_type) | |
328 { | |
329 g_return_val_if_fail(status_type != NULL, GAIM_STATUS_UNSET); | |
330 | |
331 return status_type->primitive; | |
332 } | |
333 | |
334 const char * | |
335 gaim_status_type_get_id(const GaimStatusType *status_type) | |
336 { | |
337 g_return_val_if_fail(status_type != NULL, NULL); | |
338 | |
339 return status_type->id; | |
340 } | |
341 | |
342 const char * | |
343 gaim_status_type_get_name(const GaimStatusType *status_type) | |
344 { | |
345 g_return_val_if_fail(status_type != NULL, NULL); | |
346 | |
347 return status_type->name; | |
348 } | |
349 | |
350 gboolean | |
351 gaim_status_type_is_saveable(const GaimStatusType *status_type) | |
352 { | |
353 g_return_val_if_fail(status_type != NULL, FALSE); | |
354 | |
355 return status_type->saveable; | |
356 } | |
357 | |
358 gboolean | |
359 gaim_status_type_is_user_settable(const GaimStatusType *status_type) | |
360 { | |
361 g_return_val_if_fail(status_type != NULL, FALSE); | |
362 | |
363 return status_type->user_settable; | |
364 } | |
365 | |
366 gboolean | |
367 gaim_status_type_is_independent(const GaimStatusType *status_type) | |
368 { | |
369 g_return_val_if_fail(status_type != NULL, FALSE); | |
370 | |
371 return status_type->independent; | |
372 } | |
373 | |
374 gboolean | |
10067 | 375 gaim_status_type_is_exclusive(const GaimStatusType *status_type) |
376 { | |
377 g_return_val_if_fail(status_type != NULL, FALSE); | |
378 | |
379 return !status_type->independent; | |
380 } | |
381 | |
382 gboolean | |
9949 | 383 gaim_status_type_is_available(const GaimStatusType *status_type) |
384 { | |
385 GaimStatusPrimitive primitive; | |
386 | |
387 g_return_val_if_fail(status_type != NULL, FALSE); | |
388 | |
389 primitive = gaim_status_type_get_primitive(status_type); | |
390 | |
391 return (primitive == GAIM_STATUS_AVAILABLE || | |
392 primitive == GAIM_STATUS_HIDDEN); | |
393 } | |
394 | |
395 const char * | |
396 gaim_status_type_get_primary_attr(const GaimStatusType *status_type) | |
397 { | |
398 g_return_val_if_fail(status_type != NULL, NULL); | |
399 | |
400 return status_type->primary_attr_id; | |
401 } | |
402 | |
403 GaimStatusAttr * | |
404 gaim_status_type_get_attr(const GaimStatusType *status_type, const char *id) | |
405 { | |
406 GList *l; | |
407 | |
408 g_return_val_if_fail(status_type != NULL, NULL); | |
409 g_return_val_if_fail(id != NULL, NULL); | |
410 | |
411 for (l = status_type->attrs; l != NULL; l = l->next) | |
412 { | |
413 GaimStatusAttr *attr = (GaimStatusAttr *)l->data; | |
414 | |
415 if (!strcmp(gaim_status_attr_get_id(attr), id)) | |
416 return attr; | |
417 } | |
418 | |
419 return NULL; | |
420 } | |
421 | |
422 const GList * | |
423 gaim_status_type_get_attrs(const GaimStatusType *status_type) | |
424 { | |
425 g_return_val_if_fail(status_type != NULL, NULL); | |
426 | |
427 return status_type->attrs; | |
428 } | |
429 | |
430 | |
431 /************************************************************************** | |
432 * GaimStatusAttr API | |
433 **************************************************************************/ | |
434 GaimStatusAttr * | |
435 gaim_status_attr_new(const char *id, const char *name, GaimValue *value_type) | |
436 { | |
437 GaimStatusAttr *attr; | |
438 | |
439 g_return_val_if_fail(id != NULL, NULL); | |
440 g_return_val_if_fail(name != NULL, NULL); | |
441 g_return_val_if_fail(value_type != NULL, NULL); | |
442 | |
443 attr = g_new0(GaimStatusAttr, 1); | |
444 | |
445 attr->id = g_strdup(id); | |
446 attr->name = g_strdup(name); | |
447 attr->value_type = value_type; | |
448 | |
449 return attr; | |
450 } | |
451 | |
452 void | |
453 gaim_status_attr_destroy(GaimStatusAttr *attr) | |
454 { | |
455 g_return_if_fail(attr != NULL); | |
456 | |
457 g_free(attr->id); | |
458 g_free(attr->name); | |
459 | |
460 gaim_value_destroy(attr->value_type); | |
461 | |
462 g_free(attr); | |
463 } | |
464 | |
465 const char * | |
466 gaim_status_attr_get_id(const GaimStatusAttr *attr) | |
467 { | |
468 g_return_val_if_fail(attr != NULL, NULL); | |
469 | |
470 return attr->id; | |
471 } | |
472 | |
473 const char * | |
474 gaim_status_attr_get_name(const GaimStatusAttr *attr) | |
475 { | |
476 g_return_val_if_fail(attr != NULL, NULL); | |
477 | |
478 return attr->name; | |
479 } | |
480 | |
481 GaimValue * | |
482 gaim_status_attr_get_value_type(const GaimStatusAttr *attr) | |
483 { | |
484 g_return_val_if_fail(attr != NULL, NULL); | |
485 | |
486 return attr->value_type; | |
487 } | |
488 | |
489 | |
490 /************************************************************************** | |
491 * GaimStatus API | |
492 **************************************************************************/ | |
493 GaimStatus * | |
494 gaim_status_new(GaimStatusType *status_type, GaimPresence *presence) | |
495 { | |
496 GaimStatus *status; | |
497 const GList *l; | |
498 | |
499 g_return_val_if_fail(status_type != NULL, NULL); | |
500 g_return_val_if_fail(presence != NULL, NULL); | |
501 | |
502 status = g_new0(GaimStatus, 1); | |
503 | |
504 status->type = status_type; | |
505 status->presence = presence; | |
506 | |
507 status->attr_values = | |
508 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, | |
509 (GDestroyNotify)gaim_value_destroy); | |
510 | |
511 for (l = gaim_status_type_get_attrs(status_type); l != NULL; l = l->next) | |
512 { | |
513 GaimStatusAttr *attr = (GaimStatusAttr *)l->data; | |
514 GaimValue *value = gaim_status_attr_get_value_type(attr); | |
515 GaimValue *new_value = gaim_value_dup(value); | |
516 | |
517 g_hash_table_insert(status->attr_values, | |
10197 | 518 g_strdup(gaim_status_attr_get_id(attr)), |
519 new_value); | |
9949 | 520 } |
521 | |
522 return status; | |
523 } | |
524 | |
525 void | |
526 gaim_status_destroy(GaimStatus *status) | |
527 { | |
528 g_return_if_fail(status != NULL); | |
529 | |
530 gaim_status_set_active(status, FALSE); | |
531 | |
532 g_hash_table_destroy(status->attr_values); | |
533 | |
534 g_free(status); | |
535 } | |
6065 | 536 |
537 static void | |
9949 | 538 notify_buddy_status_update(GaimBuddy *buddy, GaimPresence *presence, |
539 GaimStatus *old_status, GaimStatus *new_status) | |
540 { | |
541 GaimBlistUiOps *ops = gaim_blist_get_ui_ops(); | |
542 | |
543 if (gaim_prefs_get_bool("/core/logging/log_system") && | |
544 gaim_prefs_get_bool("/core/logging/log_away_state")) | |
545 { | |
546 time_t current_time = time(NULL); | |
547 const char *buddy_alias = gaim_buddy_get_alias(buddy); | |
548 char *tmp = NULL; | |
549 | |
550 if (!gaim_status_is_available(old_status) && | |
551 gaim_status_is_available(new_status)) | |
552 { | |
553 tmp = g_strdup_printf(_("%s came back"), buddy_alias); | |
554 } | |
555 else if (gaim_status_is_available(old_status) && | |
556 !gaim_status_is_available(new_status)) | |
557 { | |
558 tmp = g_strdup_printf(_("%s went away"), buddy_alias); | |
559 } | |
560 | |
561 if (tmp != NULL) | |
562 { | |
563 GaimLog *log = gaim_account_get_log(buddy->account); | |
564 | |
565 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, buddy_alias, | |
566 current_time, tmp); | |
567 g_free(tmp); | |
568 } | |
569 } | |
570 | |
10012 | 571 |
572 | |
573 if (ops != NULL && ops->update != NULL) | |
574 ops->update(gaim_get_blist(), (GaimBlistNode*)buddy); | |
9949 | 575 } |
576 | |
577 static void | |
578 notify_status_update(GaimPresence *presence, GaimStatus *old_status, | |
10176
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
579 GaimStatus *new_status) |
6065 | 580 { |
9949 | 581 GaimPresenceContext context = gaim_presence_get_context(presence); |
582 | |
583 if (context == GAIM_PRESENCE_CONTEXT_ACCOUNT) | |
584 { | |
10176
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
585 GaimAccount *account = gaim_presence_get_account(presence); |
9949 | 586 GaimAccountUiOps *ops = gaim_accounts_get_ui_ops(); |
587 | |
10176
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
588 if (gaim_account_is_connected(account)) |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
589 { |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
590 GaimPluginProtocolInfo *prpl_info = NULL; |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
591 GaimPlugin *prpl; |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
592 |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
593 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
594 |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
595 if (prpl != NULL) |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
596 { |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
597 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
598 |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
599 if (prpl_info != NULL && prpl_info->set_status != NULL) |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
600 prpl_info->set_status(account, new_status); |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
601 } |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
602 } |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
603 |
9949 | 604 if (ops != NULL && ops->status_changed != NULL) |
605 { | |
10176
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
606 ops->status_changed(account, new_status); |
9949 | 607 } |
608 } | |
609 else if (context == GAIM_PRESENCE_CONTEXT_CONV) | |
610 { | |
611 /* TODO */ | |
612 #if 0 | |
613 GaimConversationUiOps *ops; | |
614 GaimConversation *conv; | |
615 | |
616 conv = gaim_status_get_conversation(new_status); | |
617 #endif | |
618 } | |
619 else if (context == GAIM_PRESENCE_CONTEXT_BUDDY) | |
620 { | |
621 const GList *l; | |
622 | |
623 for (l = gaim_presence_get_buddies(presence); l != NULL; l = l->next) | |
624 { | |
625 notify_buddy_status_update((GaimBuddy *)l->data, presence, | |
626 old_status, new_status); | |
627 } | |
628 } | |
629 } | |
630 | |
10204 | 631 static void |
632 status_has_changed(GaimStatus *status) | |
9949 | 633 { |
634 GaimPresence *presence; | |
635 GaimStatus *old_status; | |
636 | |
637 presence = gaim_status_get_presence(status); | |
638 old_status = gaim_presence_get_active_status(presence); | |
639 | |
10204 | 640 /* |
641 * If this status is exclusive, then we must be setting it to "active." | |
642 * Since we are setting it to active, we want to set the currently | |
643 * active status to "inactive." | |
644 */ | |
645 if (gaim_status_is_exclusive(status)) | |
9949 | 646 { |
647 const GList *l; | |
648 | |
10006 | 649 for (l = gaim_presence_get_statuses(presence); l != NULL; l = l->next) |
9949 | 650 { |
10056
b566449d45f8
[gaim-migrate @ 11021]
Luke Schierer <lschiere@pidgin.im>
parents:
10052
diff
changeset
|
651 GaimStatus *temp_status = l->data; |
9949 | 652 |
10204 | 653 if (temp_status == status) |
654 continue; | |
9949 | 655 |
10204 | 656 if (gaim_status_is_independent(temp_status)) |
9949 | 657 continue; |
658 | |
659 if (gaim_status_is_active(temp_status)) | |
660 { | |
661 /* | |
10204 | 662 * Since we don't want infinite recursion, we have to set |
663 * the active variable ourself instead of calling | |
664 * gaim_status_set_active(). | |
9949 | 665 */ |
666 temp_status->active = FALSE; | |
667 | |
668 notify_status_update(presence, old_status, temp_status); | |
669 | |
670 break; | |
671 } | |
672 } | |
673 } | |
674 | |
10204 | 675 notify_status_update(presence, old_status, status); |
676 } | |
677 | |
678 void | |
679 gaim_status_set_active(GaimStatus *status, gboolean active) | |
680 { | |
681 if (!active && gaim_status_is_exclusive(status)) | |
682 { | |
683 gaim_debug_error("status", | |
684 "Cannot deactivate an exclusive status (%s).\n", | |
685 gaim_status_get_id(status)); | |
686 return; | |
687 } | |
688 | |
689 g_return_if_fail(status != NULL); | |
690 | |
691 if (status->active == active) | |
692 return; | |
693 | |
694 status->active = active; | |
695 | |
696 status_has_changed(status); | |
697 } | |
698 | |
699 void | |
700 gaim_status_set_active_with_attrs(GaimStatus *status, gboolean active, va_list args) | |
701 { | |
702 gboolean changed = FALSE; | |
703 const gchar *id; | |
704 | |
705 if (!active && gaim_status_is_exclusive(status)) | |
706 { | |
707 gaim_debug_error("status", | |
708 "Cannot deactivate an exclusive status (%s).\n", | |
709 gaim_status_get_id(status)); | |
710 return; | |
711 } | |
712 | |
713 g_return_if_fail(status != NULL); | |
714 | |
715 if (status->active != active) | |
716 changed = TRUE; | |
717 | |
9949 | 718 status->active = active; |
6065 | 719 |
10204 | 720 /* Set any attributes */ |
721 while ((id = va_arg(args, const char *)) != NULL) | |
722 { | |
723 GaimValue *value; | |
724 value = gaim_status_get_attr_value(status, id); | |
725 if (value->type == GAIM_TYPE_STRING) | |
726 { | |
727 const gchar *string_data = va_arg(args, const char *); | |
728 if (((string_data == NULL) && (value->data.string_data == NULL)) || | |
729 ((string_data != NULL) && (value->data.string_data != NULL) && | |
730 !strcmp(string_data, value->data.string_data))) | |
731 { | |
732 continue; | |
733 } | |
734 gaim_status_set_attr_string(status, id, string_data); | |
735 changed = TRUE; | |
736 } | |
737 else if (value->type == GAIM_TYPE_INT) | |
738 { | |
739 int int_data = va_arg(args, int); | |
740 if (int_data == value->data.int_data) | |
741 continue; | |
742 gaim_status_set_attr_int(status, id, int_data); | |
743 changed = TRUE; | |
744 } | |
745 else if (value->type == GAIM_TYPE_BOOLEAN) | |
746 { | |
747 gboolean boolean_data = va_arg(args, gboolean); | |
748 if (boolean_data == value->data.boolean_data) | |
749 continue; | |
750 gaim_status_set_attr_int(status, id, boolean_data); | |
751 changed = TRUE; | |
752 } | |
753 else | |
754 { | |
755 /* We don't know what the data is--skip over it */ | |
756 va_arg(args, void *); | |
757 } | |
758 } | |
759 | |
760 if (!changed) | |
761 return; | |
762 | |
763 status_has_changed(status); | |
9949 | 764 } |
765 | |
766 void | |
767 gaim_status_set_attr_boolean(GaimStatus *status, const char *id, | |
768 gboolean value) | |
769 { | |
770 GaimStatusType *status_type; | |
771 GaimValue *attr_value; | |
772 | |
773 g_return_if_fail(status != NULL); | |
774 g_return_if_fail(id != NULL); | |
775 | |
776 status_type = gaim_status_get_type(status); | |
777 | |
10197 | 778 /* Make sure this attribute exists and is the correct type. */ |
779 attr_value = gaim_status_get_attr_value(status, id); | |
780 g_return_if_fail(attr_value != NULL); | |
9949 | 781 g_return_if_fail(gaim_value_get_type(attr_value) == GAIM_TYPE_BOOLEAN); |
782 | |
783 gaim_value_set_boolean(attr_value, value); | |
784 } | |
785 | |
786 void | |
787 gaim_status_set_attr_int(GaimStatus *status, const char *id, int value) | |
788 { | |
789 GaimStatusType *status_type; | |
790 GaimValue *attr_value; | |
791 | |
792 g_return_if_fail(status != NULL); | |
793 g_return_if_fail(id != NULL); | |
794 | |
795 status_type = gaim_status_get_type(status); | |
796 | |
10197 | 797 /* Make sure this attribute exists and is the correct type. */ |
798 attr_value = gaim_status_get_attr_value(status, id); | |
799 g_return_if_fail(attr_value != NULL); | |
9949 | 800 g_return_if_fail(gaim_value_get_type(attr_value) == GAIM_TYPE_INT); |
801 | |
802 gaim_value_set_int(attr_value, value); | |
6065 | 803 } |
804 | |
9949 | 805 void |
806 gaim_status_set_attr_string(GaimStatus *status, const char *id, | |
807 const char *value) | |
808 { | |
809 GaimStatusType *status_type; | |
810 GaimValue *attr_value; | |
811 | |
812 g_return_if_fail(status != NULL); | |
813 g_return_if_fail(id != NULL); | |
814 | |
815 status_type = gaim_status_get_type(status); | |
816 | |
10197 | 817 /* Make sure this attribute exists and is the correct type. */ |
10196 | 818 attr_value = gaim_status_get_attr_value(status, id); |
10197 | 819 g_return_if_fail(attr_value != NULL); |
9949 | 820 g_return_if_fail(gaim_value_get_type(attr_value) == GAIM_TYPE_STRING); |
821 | |
822 gaim_value_set_string(attr_value, value); | |
823 } | |
824 | |
825 GaimStatusType * | |
826 gaim_status_get_type(const GaimStatus *status) | |
827 { | |
828 g_return_val_if_fail(status != NULL, NULL); | |
829 | |
830 return status->type; | |
831 } | |
832 | |
833 GaimPresence * | |
834 gaim_status_get_presence(const GaimStatus *status) | |
6065 | 835 { |
9949 | 836 g_return_val_if_fail(status != NULL, NULL); |
837 | |
838 return status->presence; | |
839 } | |
840 | |
841 const char * | |
842 gaim_status_get_id(const GaimStatus *status) | |
843 { | |
844 g_return_val_if_fail(status != NULL, NULL); | |
845 | |
846 return gaim_status_type_get_id(gaim_status_get_type(status)); | |
847 } | |
848 | |
849 const char * | |
850 gaim_status_get_name(const GaimStatus *status) | |
851 { | |
852 g_return_val_if_fail(status != NULL, NULL); | |
853 | |
854 return gaim_status_type_get_name(gaim_status_get_type(status)); | |
855 } | |
856 | |
857 gboolean | |
858 gaim_status_is_independent(const GaimStatus *status) | |
859 { | |
860 g_return_val_if_fail(status != NULL, FALSE); | |
861 | |
862 return gaim_status_type_is_independent(gaim_status_get_type(status)); | |
863 } | |
864 | |
865 gboolean | |
10067 | 866 gaim_status_is_exclusive(const GaimStatus *status) |
867 { | |
868 g_return_val_if_fail(status != NULL, FALSE); | |
869 | |
870 return gaim_status_type_is_exclusive(gaim_status_get_type(status)); | |
871 } | |
872 | |
873 gboolean | |
9949 | 874 gaim_status_is_available(const GaimStatus *status) |
875 { | |
876 g_return_val_if_fail(status != NULL, FALSE); | |
877 | |
878 return gaim_status_type_is_available(gaim_status_get_type(status)); | |
879 } | |
6216 | 880 |
9949 | 881 gboolean |
882 gaim_status_is_active(const GaimStatus *status) | |
883 { | |
884 g_return_val_if_fail(status != NULL, FALSE); | |
885 | |
886 return status->active; | |
887 } | |
888 | |
10040
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
889 gboolean |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
890 gaim_status_is_online(const GaimStatus *status) |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
891 { |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
892 GaimStatusPrimitive primitive; |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
893 |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
894 g_return_val_if_fail( status != NULL, FALSE); |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
895 |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
896 primitive = gaim_status_type_get_primitive(gaim_status_get_type(status)); |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
897 |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
898 return (primitive != GAIM_STATUS_UNSET && |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
899 primitive != GAIM_STATUS_OFFLINE); |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
900 } |
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
901 |
9949 | 902 GaimValue * |
903 gaim_status_get_attr_value(const GaimStatus *status, const char *id) | |
904 { | |
905 GaimStatusType *status_type; | |
906 GaimStatusAttr *attr; | |
907 | |
908 g_return_val_if_fail(status != NULL, NULL); | |
909 g_return_val_if_fail(id != NULL, NULL); | |
910 | |
911 status_type = gaim_status_get_type(status); | |
912 | |
913 /* Make sure this attribute exists. */ | |
914 attr = gaim_status_type_get_attr(status_type, id); | |
915 g_return_val_if_fail(attr != NULL, NULL); | |
916 | |
917 return (GaimValue *)g_hash_table_lookup(status->attr_values, id); | |
918 } | |
919 | |
920 gboolean | |
921 gaim_status_get_attr_boolean(const GaimStatus *status, const char *id) | |
922 { | |
923 const GaimValue *value; | |
924 | |
925 g_return_val_if_fail(status != NULL, FALSE); | |
926 g_return_val_if_fail(id != NULL, FALSE); | |
927 | |
928 if ((value = gaim_status_get_attr_value(status, id)) == NULL) | |
929 return FALSE; | |
930 | |
10197 | 931 g_return_val_if_fail(gaim_value_get_type(value) == GAIM_TYPE_BOOLEAN, FALSE); |
9949 | 932 |
933 return gaim_value_get_boolean(value); | |
934 } | |
935 | |
936 int | |
937 gaim_status_get_attr_int(const GaimStatus *status, const char *id) | |
938 { | |
939 const GaimValue *value; | |
940 | |
941 g_return_val_if_fail(status != NULL, FALSE); | |
942 g_return_val_if_fail(id != NULL, FALSE); | |
943 | |
944 if ((value = gaim_status_get_attr_value(status, id)) == NULL) | |
945 return FALSE; | |
946 | |
947 g_return_val_if_fail(gaim_value_get_type(value) == GAIM_TYPE_INT, 0); | |
948 | |
949 return gaim_value_get_int(value); | |
950 } | |
951 | |
952 const char * | |
953 gaim_status_get_attr_string(const GaimStatus *status, const char *id) | |
954 { | |
955 const GaimValue *value; | |
956 | |
957 g_return_val_if_fail(status != NULL, FALSE); | |
958 g_return_val_if_fail(id != NULL, FALSE); | |
959 | |
960 if ((value = gaim_status_get_attr_value(status, id)) == NULL) | |
961 return FALSE; | |
962 | |
963 g_return_val_if_fail(gaim_value_get_type(value) == GAIM_TYPE_STRING, NULL); | |
964 | |
965 return gaim_value_get_string(value); | |
966 } | |
967 | |
968 gint | |
969 gaim_status_compare(const GaimStatus *status1, const GaimStatus *status2) | |
970 { | |
971 GaimStatusType *type1, *type2; | |
972 int score1 = 0, score2 = 0; | |
6065 | 973 |
9949 | 974 if ((status1 == NULL && status2 == NULL) || |
975 (status1 == status2)) | |
976 { | |
977 return 0; | |
978 } | |
979 else if (status1 == NULL) | |
980 return 1; | |
981 else if (status2 == NULL) | |
982 return -1; | |
983 | |
984 type1 = gaim_status_get_type(status1); | |
985 type2 = gaim_status_get_type(status2); | |
986 | |
987 if (gaim_status_is_active(status1)) | |
988 score1 = primitive_scores[gaim_status_type_get_primitive(type1)]; | |
989 | |
990 if (gaim_status_is_active(status2)) | |
991 score2 = primitive_scores[gaim_status_type_get_primitive(type2)]; | |
992 | |
993 if (score1 > score2) | |
994 return -1; | |
995 else if (score1 < score2) | |
996 return 1; | |
997 | |
998 return 0; | |
999 } | |
1000 | |
1001 | |
1002 /************************************************************************** | |
1003 * GaimPresence API | |
1004 **************************************************************************/ | |
1005 GaimPresence * | |
1006 gaim_presence_new(GaimPresenceContext context) | |
1007 { | |
1008 GaimPresence *presence; | |
1009 | |
1010 g_return_val_if_fail(context != GAIM_PRESENCE_CONTEXT_UNSET, NULL); | |
1011 | |
1012 presence = g_new0(GaimPresence, 1); | |
1013 | |
1014 presence->context = context; | |
1015 | |
1016 presence->status_table = | |
10009 | 1017 g_hash_table_new_full(g_str_hash, g_str_equal, |
1018 g_free, (GFreeFunc)gaim_status_destroy); | |
9949 | 1019 |
1020 return presence; | |
1021 } | |
1022 | |
1023 GaimPresence * | |
1024 gaim_presence_new_for_account(GaimAccount *account) | |
1025 { | |
10012 | 1026 GaimPresence *presence = NULL; |
9949 | 1027 g_return_val_if_fail(account != NULL, NULL); |
1028 | |
1029 presence = gaim_presence_new(GAIM_PRESENCE_CONTEXT_ACCOUNT); | |
1030 presence->u.account = account; | |
10006 | 1031 presence->statuses = gaim_prpl_get_statuses(account, presence); |
9949 | 1032 |
1033 return presence; | |
1034 } | |
1035 | |
1036 GaimPresence * | |
1037 gaim_presence_new_for_conv(GaimConversation *conv) | |
1038 { | |
1039 GaimPresence *presence; | |
1040 | |
1041 g_return_val_if_fail(conv != NULL, NULL); | |
1042 | |
1043 presence = gaim_presence_new(GAIM_PRESENCE_CONTEXT_CONV); | |
1044 presence->u.chat.conv = conv; | |
10006 | 1045 /* presence->statuses = gaim_prpl_get_statuses(conv->account, presence); ? */ |
9949 | 1046 |
1047 return presence; | |
1048 } | |
6216 | 1049 |
9949 | 1050 GaimPresence * |
1051 gaim_presence_new_for_buddy(GaimBuddy *buddy) | |
1052 { | |
1053 GaimPresence *presence; | |
1054 GaimStatusBuddyKey *key; | |
10006 | 1055 GaimAccount *account; |
9949 | 1056 |
1057 g_return_val_if_fail(buddy != NULL, NULL); | |
10012 | 1058 account = buddy->account; |
9949 | 1059 |
10006 | 1060 account = buddy->account; |
1061 | |
9949 | 1062 key = g_new0(GaimStatusBuddyKey, 1); |
1063 key->account = buddy->account; | |
1064 key->name = g_strdup(buddy->name); | |
10006 | 1065 |
1066 presence = g_hash_table_lookup(buddy_presences, key); | |
1067 if (presence == NULL) | |
9949 | 1068 { |
1069 presence = gaim_presence_new(GAIM_PRESENCE_CONTEXT_BUDDY); | |
1070 | |
1071 presence->u.buddy.name = g_strdup(buddy->name); | |
1072 presence->u.buddy.account = buddy->account; | |
10006 | 1073 presence->statuses = gaim_prpl_get_statuses(buddy->account, presence); |
9949 | 1074 |
1075 g_hash_table_insert(buddy_presences, key, presence); | |
1076 } | |
1077 else | |
1078 { | |
1079 g_free(key->name); | |
1080 g_free(key); | |
1081 } | |
1082 | |
1083 presence->u.buddy.ref_count++; | |
1084 presence->u.buddy.buddies = g_list_append(presence->u.buddy.buddies, | |
1085 buddy); | |
1086 | |
1087 return presence; | |
1088 } | |
1089 | |
1090 void | |
1091 gaim_presence_destroy(GaimPresence *presence) | |
1092 { | |
1093 g_return_if_fail(presence != NULL); | |
6216 | 1094 |
9949 | 1095 if (gaim_presence_get_context(presence) == GAIM_PRESENCE_CONTEXT_BUDDY) |
1096 { | |
1097 GaimStatusBuddyKey key; | |
1098 | |
1099 presence->u.buddy.ref_count--; | |
1100 | |
10077 | 1101 if(presence->u.buddy.ref_count != 0) |
1102 return; | |
9949 | 1103 |
1104 key.account = presence->u.buddy.account; | |
1105 key.name = presence->u.buddy.name; | |
1106 | |
1107 g_hash_table_remove(buddy_presences, &key); | |
1108 | |
1109 if (presence->u.buddy.name != NULL) | |
1110 g_free(presence->u.buddy.name); | |
1111 } | |
1112 else if (gaim_presence_get_context(presence) == GAIM_PRESENCE_CONTEXT_CONV) | |
1113 { | |
1114 if (presence->u.chat.user != NULL) | |
1115 g_free(presence->u.chat.user); | |
1116 } | |
1117 | |
1118 if (presence->statuses != NULL) | |
1119 g_list_free(presence->statuses); | |
1120 | |
1121 g_hash_table_destroy(presence->status_table); | |
1122 | |
1123 g_free(presence); | |
1124 } | |
1125 | |
1126 void | |
1127 gaim_presence_remove_buddy(GaimPresence *presence, GaimBuddy *buddy) | |
1128 { | |
1129 g_return_if_fail(presence != NULL); | |
1130 g_return_if_fail(buddy != NULL); | |
1131 g_return_if_fail(gaim_presence_get_context(presence) == | |
1132 GAIM_PRESENCE_CONTEXT_BUDDY); | |
1133 | |
1134 if (g_list_find(presence->u.buddy.buddies, buddy) != NULL) | |
1135 { | |
1136 presence->u.buddy.buddies = g_list_remove(presence->u.buddy.buddies, | |
1137 buddy); | |
1138 presence->u.buddy.ref_count--; | |
1139 } | |
6065 | 1140 } |
1141 | |
9949 | 1142 void |
1143 gaim_presence_add_status(GaimPresence *presence, GaimStatus *status) | |
1144 { | |
1145 g_return_if_fail(presence != NULL); | |
1146 g_return_if_fail(status != NULL); | |
1147 | |
1148 presence->statuses = g_list_append(presence->statuses, status); | |
1149 | |
1150 g_hash_table_insert(presence->status_table, | |
1151 g_strdup(gaim_status_get_id(status)), status); | |
1152 } | |
1153 | |
1154 void | |
1155 gaim_presence_add_presence(GaimPresence *presence, const GList *source_list) | |
1156 { | |
1157 const GList *l; | |
1158 | |
1159 g_return_if_fail(presence != NULL); | |
1160 g_return_if_fail(source_list != NULL); | |
1161 | |
1162 for (l = source_list; l != NULL; l = l->next) | |
1163 gaim_presence_add_status(presence, (GaimStatus *)l->data); | |
1164 } | |
1165 | |
10153 | 1166 /* |
1167 * TODO: Should we g_return_if_fail(active == status_id->active); ? | |
1168 * | |
1169 * TODO: If a buddy signed on or off, should we do any of the following? | |
1170 * (Note: We definitely need to do some of this somewhere, I'm just | |
1171 * not sure if here is the correct place.) | |
1172 * | |
1173 * char *tmp = g_strdup_printf(_("%s logged in."), alias); | |
1174 * gaim_conversation_write(c, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
1175 * g_free(tmp); | |
1176 * | |
1177 * GaimLog *log = gaim_account_get_log(account); | |
1178 * char *tmp = g_strdup_printf(_("%s signed on"), alias); | |
1179 * gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name), current_time, tmp); | |
1180 * g_free(tmp); | |
1181 * | |
1182 * gaim_sound_play_event(GAIM_SOUND_BUDDY_ARRIVE); | |
1183 * | |
1184 * char *tmp = g_strdup_printf(_("%s logged out."), alias); | |
1185 * gaim_conversation_write(c, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
1186 * g_free(tmp); | |
1187 * | |
1188 * char *tmp = g_strdup_printf(_("%s signed off"), alias); | |
1189 * gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name), current_time, tmp); | |
1190 * g_free(tmp); | |
1191 * | |
1192 * serv_got_typing_stopped(gc, name); | |
1193 * | |
1194 * gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE); | |
1195 * | |
1196 * gaim_conversation_update(c, GAIM_CONV_UPDATE_AWAY); | |
1197 * | |
1198 */ | |
9949 | 1199 void |
1200 gaim_presence_set_status_active(GaimPresence *presence, const char *status_id, | |
1201 gboolean active) | |
1202 { | |
1203 GaimStatus *status; | |
1204 | |
1205 g_return_if_fail(presence != NULL); | |
1206 g_return_if_fail(status_id != NULL); | |
1207 | |
1208 status = gaim_presence_get_status(presence, status_id); | |
1209 | |
1210 g_return_if_fail(status != NULL); | |
1211 | |
10067 | 1212 if (gaim_status_is_exclusive(status)) |
9949 | 1213 { |
1214 if (!active) | |
1215 { | |
1216 gaim_debug_warning("status", | |
1217 "Attempted to set a non-independent status " | |
1218 "(%s) inactive. Only independent statuses " | |
1219 "can be specifically marked inactive.", | |
1220 status_id); | |
1221 | |
1222 return; | |
1223 } | |
1224 | |
10052 | 1225 } else if (presence->active_status != NULL) { |
1226 gaim_status_set_active(presence->active_status, FALSE); | |
9949 | 1227 |
1228 } | |
1229 | |
1230 gaim_status_set_active(status, active); | |
10052 | 1231 presence->active_status = status; |
9949 | 1232 } |
1233 | |
1234 void | |
1235 gaim_presence_switch_status(GaimPresence *presence, const char *status_id) | |
1236 { | |
1237 GaimStatus *status; | |
1238 | |
1239 g_return_if_fail(presence != NULL); | |
1240 g_return_if_fail(status_id != NULL); | |
1241 | |
1242 status = gaim_presence_get_status(presence, status_id); | |
1243 | |
1244 g_return_if_fail(status != NULL); | |
1245 | |
1246 if (gaim_status_is_independent(status)) | |
1247 return; | |
1248 | |
1249 if (presence->active_status != NULL) | |
1250 gaim_status_set_active(presence->active_status, FALSE); | |
1251 | |
1252 gaim_status_set_active(status, TRUE); | |
1253 } | |
1254 | |
1255 static void | |
1256 update_buddy_idle(GaimBuddy *buddy, GaimPresence *presence, | |
1257 time_t current_time, gboolean old_idle, gboolean idle) | |
1258 { | |
1259 GaimBlistUiOps *ops = gaim_get_blist()->ui_ops; | |
1260 | |
1261 if (!old_idle && idle) | |
1262 { | |
1263 gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle", buddy); | |
1264 | |
1265 if (gaim_prefs_get_bool("/core/logging/log_system") && | |
1266 gaim_prefs_get_bool("/core/logging/log_idle_state")) | |
1267 { | |
1268 GaimLog *log = gaim_account_get_log(buddy->account); | |
1269 char *tmp = g_strdup_printf(_("%s became idle"), | |
1270 gaim_buddy_get_alias(buddy)); | |
1271 | |
1272 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, | |
1273 gaim_buddy_get_alias(buddy), current_time, tmp); | |
1274 g_free(tmp); | |
1275 } | |
1276 } | |
1277 else if (old_idle && !idle) | |
1278 { | |
1279 gaim_signal_emit(gaim_blist_get_handle(), "buddy-unidle", buddy); | |
1280 | |
1281 if (gaim_prefs_get_bool("/core/logging/log_system") && | |
1282 gaim_prefs_get_bool("/core/logging/log_idle_state")) | |
1283 { | |
1284 GaimLog *log = gaim_account_get_log(buddy->account); | |
1285 char *tmp = g_strdup_printf(_("%s became unidle"), | |
1286 gaim_buddy_get_alias(buddy)); | |
1287 | |
1288 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, | |
1289 gaim_buddy_get_alias(buddy), current_time, tmp); | |
1290 g_free(tmp); | |
1291 } | |
1292 } | |
1293 | |
1294 gaim_contact_compute_priority_buddy(gaim_buddy_get_contact(buddy)); | |
1295 | |
1296 if (ops != NULL && ops->update != NULL) | |
1297 ops->update(gaim_get_blist(), (GaimBlistNode *)buddy); | |
1298 } | |
1299 | |
1300 void | |
1301 gaim_presence_set_idle(GaimPresence *presence, gboolean idle, time_t idle_time) | |
1302 { | |
1303 gboolean old_idle; | |
1304 | |
1305 g_return_if_fail(presence != NULL); | |
1306 | |
1307 if (presence->idle == idle && presence->idle_time == idle_time) | |
1308 return; | |
1309 | |
1310 old_idle = presence->idle; | |
1311 presence->idle = idle; | |
1312 presence->idle_time = (idle ? idle_time : 0); | |
1313 | |
1314 if (gaim_presence_get_context(presence) == GAIM_PRESENCE_CONTEXT_BUDDY) | |
1315 { | |
1316 const GList *l; | |
1317 time_t current_time = time(NULL); | |
1318 | |
1319 for (l = gaim_presence_get_buddies(presence); l != NULL; l = l->next) | |
1320 { | |
1321 update_buddy_idle((GaimBuddy *)l->data, presence, current_time, | |
1322 old_idle, idle); | |
1323 } | |
1324 } | |
1325 } | |
1326 | |
1327 void | |
10006 | 1328 gaim_presence_set_login_time(GaimPresence *presence, time_t login_time) |
1329 { | |
1330 g_return_if_fail(presence != NULL); | |
1331 | |
1332 if (presence->login_time == login_time) | |
1333 return; | |
1334 | |
1335 presence->login_time = login_time; | |
1336 } | |
1337 | |
1338 void | |
9949 | 1339 gaim_presence_set_warning_level(GaimPresence *presence, unsigned int level) |
6065 | 1340 { |
9949 | 1341 g_return_if_fail(presence != NULL); |
1342 g_return_if_fail(level <= 100); | |
1343 | |
1344 if (presence->warning_level == level) | |
1345 return; | |
1346 | |
1347 presence->warning_level = level; | |
1348 | |
1349 if (gaim_presence_get_context(presence) == GAIM_PRESENCE_CONTEXT_BUDDY) | |
1350 { | |
1351 GaimBlistUiOps *ops = gaim_get_blist()->ui_ops; | |
1352 | |
1353 if (ops != NULL && ops->update != NULL) | |
1354 { | |
1355 const GList *l; | |
1356 | |
1357 for (l = gaim_presence_get_buddies(presence); | |
1358 l != NULL; | |
1359 l = l->next) | |
1360 { | |
1361 ops->update(gaim_get_blist(), (GaimBlistNode *)l->data); | |
1362 } | |
1363 } | |
1364 } | |
1365 } | |
1366 | |
1367 GaimPresenceContext | |
1368 gaim_presence_get_context(const GaimPresence *presence) | |
1369 { | |
1370 g_return_val_if_fail(presence != NULL, GAIM_PRESENCE_CONTEXT_UNSET); | |
1371 | |
1372 return presence->context; | |
1373 } | |
1374 | |
1375 GaimAccount * | |
1376 gaim_presence_get_account(const GaimPresence *presence) | |
1377 { | |
1378 GaimPresenceContext context; | |
1379 | |
1380 g_return_val_if_fail(presence != NULL, NULL); | |
1381 | |
1382 context = gaim_presence_get_context(presence); | |
1383 | |
1384 g_return_val_if_fail(context == GAIM_PRESENCE_CONTEXT_ACCOUNT || | |
1385 context == GAIM_PRESENCE_CONTEXT_BUDDY, NULL); | |
1386 | |
1387 return presence->u.account; | |
1388 } | |
1389 | |
1390 GaimConversation * | |
1391 gaim_presence_get_conversation(const GaimPresence *presence) | |
1392 { | |
1393 g_return_val_if_fail(presence != NULL, NULL); | |
1394 g_return_val_if_fail(gaim_presence_get_context(presence) == | |
1395 GAIM_PRESENCE_CONTEXT_CONV, NULL); | |
1396 | |
1397 return presence->u.chat.conv; | |
1398 } | |
1399 | |
1400 const char * | |
1401 gaim_presence_get_chat_user(const GaimPresence *presence) | |
1402 { | |
1403 g_return_val_if_fail(presence != NULL, NULL); | |
1404 g_return_val_if_fail(gaim_presence_get_context(presence) == | |
1405 GAIM_PRESENCE_CONTEXT_CONV, NULL); | |
1406 | |
1407 return presence->u.chat.user; | |
1408 } | |
1409 | |
1410 const GList * | |
1411 gaim_presence_get_buddies(const GaimPresence *presence) | |
1412 { | |
1413 g_return_val_if_fail(presence != NULL, NULL); | |
1414 g_return_val_if_fail(gaim_presence_get_context(presence) == | |
1415 GAIM_PRESENCE_CONTEXT_BUDDY, NULL); | |
1416 | |
1417 return presence->u.buddy.buddies; | |
1418 } | |
1419 | |
1420 const GList * | |
1421 gaim_presence_get_statuses(const GaimPresence *presence) | |
1422 { | |
1423 g_return_val_if_fail(presence != NULL, NULL); | |
1424 | |
1425 return presence->statuses; | |
1426 } | |
1427 | |
1428 GaimStatus * | |
1429 gaim_presence_get_status(const GaimPresence *presence, const char *status_id) | |
1430 { | |
1431 GaimStatus *status; | |
10006 | 1432 const GList *l = NULL; |
9949 | 1433 |
1434 g_return_val_if_fail(presence != NULL, NULL); | |
1435 g_return_val_if_fail(status_id != NULL, NULL); | |
1436 | |
10006 | 1437 /* What's the purpose of this hash table? */ |
10012 | 1438 status = (GaimStatus *)g_hash_table_lookup(presence->status_table, |
10006 | 1439 status_id); |
10012 | 1440 |
10006 | 1441 if (status == NULL) { |
10012 | 1442 for (l = gaim_presence_get_statuses(presence); |
10006 | 1443 l != NULL && status == NULL; l = l->next) |
1444 { | |
1445 GaimStatus *temp_status = l->data; | |
10012 | 1446 |
10006 | 1447 if (!strcmp(status_id, gaim_status_get_id(temp_status))) |
1448 status = temp_status; | |
1449 } | |
1450 | |
1451 if (status != NULL) | |
1452 g_hash_table_insert(presence->status_table, | |
1453 g_strdup(gaim_status_get_id(status)), status); | |
10012 | 1454 } |
9949 | 1455 |
1456 return status; | |
1457 } | |
1458 | |
1459 GaimStatus * | |
1460 gaim_presence_get_active_status(const GaimPresence *presence) | |
1461 { | |
1462 g_return_val_if_fail(presence != NULL, NULL); | |
1463 | |
1464 return presence->active_status; | |
1465 } | |
1466 | |
1467 gboolean | |
1468 gaim_presence_is_available(const GaimPresence *presence) | |
1469 { | |
1470 GaimStatus *status; | |
1471 | |
1472 g_return_val_if_fail(presence != NULL, FALSE); | |
1473 | |
1474 status = gaim_presence_get_active_status(presence); | |
1475 | |
1476 return ((status != NULL && gaim_status_is_available(status)) && | |
1477 !gaim_presence_is_idle(presence)); | |
1478 } | |
1479 | |
1480 gboolean | |
1481 gaim_presence_is_online(const GaimPresence *presence) | |
1482 { | |
1483 GaimStatus *status; | |
1484 | |
1485 g_return_val_if_fail(presence != NULL, FALSE); | |
1486 | |
1487 if ((status = gaim_presence_get_active_status(presence)) == NULL) | |
1488 return FALSE; | |
1489 | |
10040
81059dce3aed
[gaim-migrate @ 10999]
Luke Schierer <lschiere@pidgin.im>
parents:
10013
diff
changeset
|
1490 return gaim_status_is_online(status); |
9949 | 1491 } |
1492 | |
1493 gboolean | |
1494 gaim_presence_is_status_active(const GaimPresence *presence, | |
1495 const char *status_id) | |
1496 { | |
1497 GaimStatus *status; | |
1498 | |
1499 g_return_val_if_fail(presence != NULL, FALSE); | |
1500 g_return_val_if_fail(status_id != NULL, FALSE); | |
1501 | |
1502 status = gaim_presence_get_status(presence, status_id); | |
1503 | |
1504 return (status != NULL && gaim_status_is_active(status)); | |
1505 } | |
1506 | |
1507 gboolean | |
1508 gaim_presence_is_status_primitive_active(const GaimPresence *presence, | |
1509 GaimStatusPrimitive primitive) | |
1510 { | |
1511 GaimStatus *status; | |
1512 GaimStatusType *status_type; | |
1513 | |
1514 g_return_val_if_fail(presence != NULL, FALSE); | |
1515 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, FALSE); | |
1516 | |
1517 status = gaim_presence_get_active_status(presence); | |
1518 status_type = gaim_status_get_type(status); | |
1519 | |
1520 if (gaim_status_type_get_primitive(status_type) == primitive) | |
1521 return TRUE; | |
6065 | 1522 |
1523 return FALSE; | |
1524 } | |
1525 | |
9949 | 1526 gboolean |
1527 gaim_presence_is_idle(const GaimPresence *presence) | |
6065 | 1528 { |
9949 | 1529 g_return_val_if_fail(presence != NULL, FALSE); |
1530 | |
1531 return presence->idle; | |
6065 | 1532 } |
1533 | |
9949 | 1534 time_t |
1535 gaim_presence_get_idle_time(const GaimPresence *presence) | |
6065 | 1536 { |
9949 | 1537 g_return_val_if_fail(presence != NULL, 0); |
6065 | 1538 |
9949 | 1539 return presence->idle_time; |
1540 } | |
6065 | 1541 |
9949 | 1542 unsigned int |
1543 gaim_presence_get_warning_level(const GaimPresence *presence) | |
1544 { | |
1545 g_return_val_if_fail(presence != NULL, 0); | |
6216 | 1546 |
9949 | 1547 return presence->warning_level; |
6065 | 1548 } |
1549 | |
9949 | 1550 gint |
1551 gaim_presence_compare(const GaimPresence *presence1, | |
1552 const GaimPresence *presence2) | |
6065 | 1553 { |
9949 | 1554 gboolean idle1, idle2; |
1555 size_t idle_time_1, idle_time_2; | |
1556 int score1 = 0, score2 = 0; | |
1557 const GList *l; | |
6065 | 1558 |
9949 | 1559 if ((presence1 == NULL && presence2 == NULL) || (presence1 == presence2)) |
1560 return 0; | |
1561 else if (presence1 == NULL) | |
10151
d83e6f2125b1
[gaim-migrate @ 11228]
Christian Hammond <chipx86@chipx86.com>
parents:
10087
diff
changeset
|
1562 return 1; |
9949 | 1563 else if (presence2 == NULL) |
10151
d83e6f2125b1
[gaim-migrate @ 11228]
Christian Hammond <chipx86@chipx86.com>
parents:
10087
diff
changeset
|
1564 return -1; |
6065 | 1565 |
9949 | 1566 /* Compute the score of the first set of statuses. */ |
1567 for (l = gaim_presence_get_statuses(presence1); l != NULL; l = l->next) | |
1568 { | |
1569 GaimStatus *status = (GaimStatus *)l->data; | |
1570 GaimStatusType *type = gaim_status_get_type(status); | |
6065 | 1571 |
9949 | 1572 if (gaim_status_is_active(status)) |
1573 score1 += primitive_scores[gaim_status_type_get_primitive(type)]; | |
6065 | 1574 } |
1575 | |
9949 | 1576 /* Compute the score of the second set of statuses. */ |
10151
d83e6f2125b1
[gaim-migrate @ 11228]
Christian Hammond <chipx86@chipx86.com>
parents:
10087
diff
changeset
|
1577 for (l = gaim_presence_get_statuses(presence2); l != NULL; l = l->next) |
9949 | 1578 { |
1579 GaimStatus *status = (GaimStatus *)l->data; | |
1580 GaimStatusType *type = gaim_status_get_type(status); | |
6065 | 1581 |
9949 | 1582 if (gaim_status_is_active(status)) |
1583 score2 += primitive_scores[gaim_status_type_get_primitive(type)]; | |
6065 | 1584 } |
1585 | |
9949 | 1586 idle1 = gaim_presence_is_idle(presence1); |
1587 idle2 = gaim_presence_is_idle(presence2); | |
6065 | 1588 |
9949 | 1589 if (idle1) |
1590 score1 += primitive_scores[SCORE_IDLE]; | |
6065 | 1591 |
9949 | 1592 if (idle2) |
1593 score2 += primitive_scores[SCORE_IDLE]; | |
6065 | 1594 |
9949 | 1595 idle_time_1 = gaim_presence_get_idle_time(presence1); |
1596 idle_time_2 = gaim_presence_get_idle_time(presence2); | |
6065 | 1597 |
9949 | 1598 if (idle_time_1 > idle_time_2) |
1599 score1 += primitive_scores[SCORE_IDLE_TIME]; | |
1600 else if (idle_time_1 < idle_time_2) | |
1601 score2 += primitive_scores[SCORE_IDLE_TIME]; | |
6065 | 1602 |
9949 | 1603 if (score1 < score2) |
1604 return 1; | |
1605 else if (score1 > score2) | |
1606 return -1; | |
1607 | |
1608 return 0; | |
1609 } | |
1610 | |
6065 | 1611 |
9949 | 1612 /************************************************************************** |
1613 * Status subsystem | |
1614 **************************************************************************/ | |
1615 static void | |
1616 score_pref_changed_cb(const char *name, GaimPrefType type, gpointer value, | |
1617 gpointer data) | |
1618 { | |
1619 int index = GPOINTER_TO_INT(data); | |
6065 | 1620 |
9949 | 1621 primitive_scores[index] = GPOINTER_TO_INT(value); |
6065 | 1622 } |
1623 | |
10012 | 1624 guint |
10006 | 1625 gaim_buddy_presences_hash(gconstpointer key) |
1626 { | |
10012 | 1627 const GaimStatusBuddyKey *me = key; |
1628 guint ret; | |
1629 char *str; | |
1630 | |
1631 str = g_strdup_printf("%p%s", me->account, me->name); | |
1632 ret = g_str_hash(str); | |
1633 g_free(str); | |
1634 | |
1635 return ret; | |
10006 | 1636 } |
1637 | |
10012 | 1638 gboolean |
10006 | 1639 gaim_buddy_presences_equal(gconstpointer a, gconstpointer b) |
1640 { | |
1641 GaimStatusBuddyKey *key_a = (GaimStatusBuddyKey *)a; | |
1642 GaimStatusBuddyKey *key_b = (GaimStatusBuddyKey *)b; | |
1643 | |
10012 | 1644 if(key_a->account == key_b->account && |
1645 !strcmp(key_a->name, key_b->name)) | |
10006 | 1646 return TRUE; |
1647 else | |
1648 return FALSE; | |
1649 } | |
1650 | |
10176
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1651 const GList * |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1652 gaim_statuses_get_stored(void) |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1653 { |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1654 return NULL; |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1655 } |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1656 |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1657 GaimStatus * |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1658 gaim_statuses_find_stored(const GaimStatusType *status_type, const char *id) |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1659 { |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1660 return NULL; |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1661 } |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1662 |
10087 | 1663 void * |
1664 gaim_statuses_get_handle() { | |
1665 static int handle; | |
1666 | |
1667 return &handle; | |
1668 } | |
1669 | |
9949 | 1670 void |
1671 gaim_statuses_init(void) | |
6065 | 1672 { |
10087 | 1673 void *handle = gaim_statuses_get_handle; |
1674 | |
9949 | 1675 gaim_prefs_add_none("/core/status"); |
1676 gaim_prefs_add_none("/core/status/scores"); | |
6065 | 1677 |
9949 | 1678 gaim_prefs_add_int("/core/status/scores/offline", |
1679 primitive_scores[GAIM_STATUS_OFFLINE]); | |
1680 gaim_prefs_add_int("/core/status/scores/available", | |
1681 primitive_scores[GAIM_STATUS_AVAILABLE]); | |
1682 gaim_prefs_add_int("/core/status/scores/hidden", | |
1683 primitive_scores[GAIM_STATUS_HIDDEN]); | |
1684 gaim_prefs_add_int("/core/status/scores/away", | |
1685 primitive_scores[GAIM_STATUS_AWAY]); | |
1686 gaim_prefs_add_int("/core/status/scores/extended_away", | |
1687 primitive_scores[GAIM_STATUS_EXTENDED_AWAY]); | |
1688 gaim_prefs_add_int("/core/status/scores/idle", | |
1689 primitive_scores[SCORE_IDLE]); | |
6065 | 1690 |
10087 | 1691 gaim_prefs_connect_callback(handle, "/core/status/scores/offline", |
9949 | 1692 score_pref_changed_cb, |
1693 GINT_TO_POINTER(GAIM_STATUS_OFFLINE)); | |
10087 | 1694 gaim_prefs_connect_callback(handle, "/core/status/scores/available", |
9949 | 1695 score_pref_changed_cb, |
1696 GINT_TO_POINTER(GAIM_STATUS_AVAILABLE)); | |
10087 | 1697 gaim_prefs_connect_callback(handle, "/core/status/scores/hidden", |
9949 | 1698 score_pref_changed_cb, |
1699 GINT_TO_POINTER(GAIM_STATUS_HIDDEN)); | |
10087 | 1700 gaim_prefs_connect_callback(handle, "/core/status/scores/away", |
9949 | 1701 score_pref_changed_cb, |
1702 GINT_TO_POINTER(GAIM_STATUS_AWAY)); | |
10087 | 1703 gaim_prefs_connect_callback(handle, "/core/status/scores/extended_away", |
9949 | 1704 score_pref_changed_cb, |
1705 GINT_TO_POINTER(GAIM_STATUS_EXTENDED_AWAY)); | |
10087 | 1706 gaim_prefs_connect_callback(handle, "/core/status/scores/idle", |
9949 | 1707 score_pref_changed_cb, |
1708 GINT_TO_POINTER(SCORE_IDLE)); | |
10006 | 1709 |
1710 buddy_presences = g_hash_table_new(gaim_buddy_presences_hash, | |
1711 gaim_buddy_presences_equal); | |
9949 | 1712 } |
6065 | 1713 |
9949 | 1714 void |
1715 gaim_statuses_uninit(void) | |
1716 { | |
10176
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1717 if (buddy_presences != NULL) |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1718 { |
10077 | 1719 g_hash_table_destroy(buddy_presences); |
10176
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1720 |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1721 buddy_presences = NULL; |
0109f3a518d2
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
1722 } |
9949 | 1723 } |
6065 | 1724 |
9949 | 1725 void |
1726 gaim_statuses_sync(void) | |
1727 { | |
6065 | 1728 } |
9949 | 1729 |
1730 void | |
1731 gaim_statuses_load(void) | |
1732 { | |
1733 } |