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