Mercurial > pidgin
annotate libpurple/blist.c @ 30818:ead7b8c19725
Fix integration between Switchboard and SBConn. by setting public some functions on both sides. Regresion introduced in 99802eb80a7acd
author | masca@cpw.pidgin.im |
---|---|
date | Sat, 19 Jun 2010 23:55:16 +0000 |
parents | e26af064fe8c |
children | 4076f53cdd84 73b005a20d06 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15822 | 2 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19404
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 */ |
24350
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
23 #define _PURPLE_BLIST_C_ |
24333
d81104908a4e
use some additional preproc logic to avoid copying the structs directly into the implementation files
Gary Kramlich <grim@reaperworld.com>
parents:
24314
diff
changeset
|
24 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "blist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "conversation.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "dbus-maybe.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "privacy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "server.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "signals.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "value.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "xmlnode.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 |
15822 | 40 static PurpleBlistUiOps *blist_ui_ops = NULL; |
41 | |
42 static PurpleBuddyList *purplebuddylist = NULL; | |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
43 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
44 /** |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
45 * A hash table used for efficient lookups of buddies by name. |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
46 * PurpleAccount* => GHashTable*, with the inner hash table being |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
47 * struct _purple_hbuddy => PurpleBuddy* |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
48 */ |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
49 static GHashTable *buddies_cache = NULL; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
50 |
27569
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
51 /** |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
52 * A hash table used for efficient lookups of groups by name. |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
53 * UTF-8 collate-key => PurpleGroup*. |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
54 */ |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
55 static GHashTable *groups_cache = NULL; |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
56 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 static guint save_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 static gboolean blist_loaded = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 /********************************************************************* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 * Private utility functions * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 *********************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 |
15822 | 64 static PurpleBlistNode *purple_blist_get_last_sibling(PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 { |
15822 | 66 PurpleBlistNode *n = node; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 if (!n) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 while (n->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 n = n->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 return n; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 |
15822 | 74 static PurpleBlistNode *purple_blist_get_last_child(PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 if (!node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 return NULL; |
15822 | 78 return purple_blist_get_last_sibling(node->child); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 struct _list_account_buddies { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 GSList *list; |
15822 | 83 PurpleAccount *account; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 |
15822 | 86 struct _purple_hbuddy { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 char *name; |
15822 | 88 PurpleAccount *account; |
89 PurpleBlistNode *group; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 |
27503 | 92 /* This function must not use purple_normalize */ |
15822 | 93 static guint _purple_blist_hbuddy_hash(struct _purple_hbuddy *hb) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 { |
27592
c868575ded5d
Better hash function for the PurpleBuddy lookup hashtables.
Paul Aurich <paul@darkrain42.org>
parents:
27584
diff
changeset
|
95 return g_str_hash(hb->name) ^ g_direct_hash(hb->group) ^ g_direct_hash(hb->account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 |
27503 | 98 /* This function must not use purple_normalize */ |
15822 | 99 static guint _purple_blist_hbuddy_equal(struct _purple_hbuddy *hb1, struct _purple_hbuddy *hb2) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 { |
27584
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
101 return (hb1->group == hb2->group && |
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
102 hb1->account == hb2->account && |
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
103 g_str_equal(hb1->name, hb2->name)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 |
15822 | 106 static void _purple_blist_hbuddy_free_key(struct _purple_hbuddy *hb) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 g_free(hb->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 g_free(hb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
112 static void |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
113 purple_blist_buddies_cache_add_account(PurpleAccount *account) |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
114 { |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
115 GHashTable *account_buddies = g_hash_table_new_full((GHashFunc)_purple_blist_hbuddy_hash, |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
116 (GEqualFunc)_purple_blist_hbuddy_equal, |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
117 (GDestroyNotify)_purple_blist_hbuddy_free_key, NULL); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
118 g_hash_table_insert(buddies_cache, account, account_buddies); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
119 } |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
120 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
121 static void |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
122 purple_blist_buddies_cache_remove_account(const PurpleAccount *account) |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
123 { |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
124 g_hash_table_remove(buddies_cache, account); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
125 } |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
126 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 /********************************************************************* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 * Writing to disk * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 *********************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 value_to_xmlnode(gpointer key, gpointer hvalue, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 const char *name; |
15822 | 136 PurpleValue *value; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 xmlnode *node, *child; |
26885
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26819
diff
changeset
|
138 char buf[21]; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 name = (const char *)key; |
15822 | 141 value = (PurpleValue *)hvalue; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 node = (xmlnode *)user_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 g_return_if_fail(value != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 child = xmlnode_new_child(node, "setting"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 xmlnode_set_attrib(child, "name", name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 |
15822 | 149 if (purple_value_get_type(value) == PURPLE_TYPE_INT) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 xmlnode_set_attrib(child, "type", "int"); |
26885
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26819
diff
changeset
|
151 g_snprintf(buf, sizeof(buf), "%d", purple_value_get_int(value)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 xmlnode_insert_data(child, buf, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 } |
15822 | 154 else if (purple_value_get_type(value) == PURPLE_TYPE_STRING) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 xmlnode_set_attrib(child, "type", "string"); |
15822 | 156 xmlnode_insert_data(child, purple_value_get_string(value), -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 } |
15822 | 158 else if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 xmlnode_set_attrib(child, "type", "bool"); |
26885
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26819
diff
changeset
|
160 g_snprintf(buf, sizeof(buf), "%d", purple_value_get_boolean(value)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 xmlnode_insert_data(child, buf, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 chat_component_to_xmlnode(gpointer key, gpointer value, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 const char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 const char *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 xmlnode *node, *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 name = (const char *)key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 data = (const char *)value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 node = (xmlnode *)user_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 g_return_if_fail(data != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 child = xmlnode_new_child(node, "component"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 xmlnode_set_attrib(child, "name", name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 xmlnode_insert_data(child, data, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 static xmlnode * |
15822 | 184 buddy_to_xmlnode(PurpleBlistNode *bnode) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 xmlnode *node, *child; |
15822 | 187 PurpleBuddy *buddy; |
188 | |
189 buddy = (PurpleBuddy *)bnode; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 node = xmlnode_new("buddy"); |
15822 | 192 xmlnode_set_attrib(node, "account", purple_account_get_username(buddy->account)); |
193 xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(buddy->account)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 child = xmlnode_new_child(node, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 xmlnode_insert_data(child, buddy->name, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 if (buddy->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 child = xmlnode_new_child(node, "alias"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 xmlnode_insert_data(child, buddy->alias, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 /* Write buddy settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 g_hash_table_foreach(buddy->node.settings, value_to_xmlnode, node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 static xmlnode * |
15822 | 211 contact_to_xmlnode(PurpleBlistNode *cnode) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 xmlnode *node, *child; |
15822 | 214 PurpleContact *contact; |
215 PurpleBlistNode *bnode; | |
216 | |
217 contact = (PurpleContact *)cnode; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 node = xmlnode_new("contact"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 if (contact->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 xmlnode_set_attrib(node, "alias", contact->alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 /* Write buddies */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 { |
15822 | 229 if (!PURPLE_BLIST_NODE_SHOULD_SAVE(bnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 continue; |
15822 | 231 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 child = buddy_to_xmlnode(bnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 xmlnode_insert_child(node, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 /* Write contact settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 g_hash_table_foreach(cnode->settings, value_to_xmlnode, node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 static xmlnode * |
15822 | 245 chat_to_xmlnode(PurpleBlistNode *cnode) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 xmlnode *node, *child; |
15822 | 248 PurpleChat *chat; |
249 | |
250 chat = (PurpleChat *)cnode; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 node = xmlnode_new("chat"); |
15822 | 253 xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(chat->account)); |
254 xmlnode_set_attrib(node, "account", purple_account_get_username(chat->account)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 if (chat->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 child = xmlnode_new_child(node, "alias"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 xmlnode_insert_data(child, chat->alias, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 /* Write chat components */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 g_hash_table_foreach(chat->components, chat_component_to_xmlnode, node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 /* Write chat settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 g_hash_table_foreach(chat->node.settings, value_to_xmlnode, node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 static xmlnode * |
15822 | 272 group_to_xmlnode(PurpleBlistNode *gnode) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 xmlnode *node, *child; |
15822 | 275 PurpleGroup *group; |
276 PurpleBlistNode *cnode; | |
277 | |
278 group = (PurpleGroup *)gnode; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 node = xmlnode_new("group"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 xmlnode_set_attrib(node, "name", group->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 /* Write settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 g_hash_table_foreach(group->node.settings, value_to_xmlnode, node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 /* Write contacts and chats */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 { |
15822 | 289 if (!PURPLE_BLIST_NODE_SHOULD_SAVE(cnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 continue; |
15822 | 291 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 child = contact_to_xmlnode(cnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 xmlnode_insert_child(node, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 } |
15822 | 296 else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 child = chat_to_xmlnode(cnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 xmlnode_insert_child(node, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 static xmlnode * |
15822 | 307 accountprivacy_to_xmlnode(PurpleAccount *account) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 xmlnode *node, *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 GSList *cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 char buf[10]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 node = xmlnode_new("account"); |
15822 | 314 xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); |
315 xmlnode_set_attrib(node, "name", purple_account_get_username(account)); | |
26885
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26819
diff
changeset
|
316 g_snprintf(buf, sizeof(buf), "%d", account->perm_deny); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 xmlnode_set_attrib(node, "mode", buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 for (cur = account->permit; cur; cur = cur->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 child = xmlnode_new_child(node, "permit"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 xmlnode_insert_data(child, cur->data, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 for (cur = account->deny; cur; cur = cur->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 child = xmlnode_new_child(node, "block"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 xmlnode_insert_data(child, cur->data, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 static xmlnode * |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21716
diff
changeset
|
335 blist_to_xmlnode(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 xmlnode *node, *child, *grandchild; |
15822 | 338 PurpleBlistNode *gnode; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
339 GList *cur; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 |
15822 | 341 node = xmlnode_new("purple"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 xmlnode_set_attrib(node, "version", "1.0"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 /* Write groups */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 child = xmlnode_new_child(node, "blist"); |
15822 | 346 for (gnode = purplebuddylist->root; gnode != NULL; gnode = gnode->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 { |
15822 | 348 if (!PURPLE_BLIST_NODE_SHOULD_SAVE(gnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 continue; |
15822 | 350 if (PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 grandchild = group_to_xmlnode(gnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 xmlnode_insert_child(child, grandchild); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 /* Write privacy settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 child = xmlnode_new_child(node, "privacy"); |
15822 | 359 for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 grandchild = accountprivacy_to_xmlnode(cur->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 xmlnode_insert_child(child, grandchild); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 static void |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21716
diff
changeset
|
369 purple_blist_sync(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 char *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 if (!blist_loaded) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 { |
15822 | 376 purple_debug_error("blist", "Attempted to save buddy list before it " |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 "was read!\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 node = blist_to_xmlnode(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 data = xmlnode_to_formatted_str(node, NULL); |
15822 | 383 purple_util_write_data_to_file("blist.xml", data, -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 xmlnode_free(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 save_cb(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 { |
15822 | 391 purple_blist_sync(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 save_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
396 static void |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
397 _purple_blist_schedule_save() |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 if (save_timer == 0) |
18006
f2d8658b3a86
merge of '62e9d17cd37551991c5040ce6ca48e6d7578dde3'
Richard Laager <rlaager@wiktel.com>
parents:
16798
diff
changeset
|
400 save_timer = purple_timeout_add_seconds(5, save_cb, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
403 static void |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
404 purple_blist_save_account(PurpleAccount *account) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
405 { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
406 #if 1 |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
407 _purple_blist_schedule_save(); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
408 #else |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
409 if (account != NULL) { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
410 /* Save the buddies and privacy data for this account */ |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
411 } else { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
412 /* Save all buddies and privacy data */ |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
413 } |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
414 #endif |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
415 } |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
416 |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
417 static void |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
418 purple_blist_save_node(PurpleBlistNode *node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
419 { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
420 _purple_blist_schedule_save(); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
421 } |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
422 |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
423 void purple_blist_schedule_save() |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
424 { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
425 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
426 |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
427 /* Save everything */ |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
428 if (ops && ops->save_account) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
429 ops->save_account(NULL); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
430 } |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
431 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 /********************************************************************* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 * Reading from disk * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 *********************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 static void |
15822 | 438 parse_setting(PurpleBlistNode *node, xmlnode *setting) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 const char *name = xmlnode_get_attrib(setting, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 const char *type = xmlnode_get_attrib(setting, "type"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 char *value = xmlnode_get_data(setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 if (!value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
447 if (!type || purple_strequal(type, "string")) |
15822 | 448 purple_blist_node_set_string(node, name, value); |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
449 else if (purple_strequal(type, "bool")) |
15822 | 450 purple_blist_node_set_bool(node, name, atoi(value)); |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
451 else if (purple_strequal(type, "int")) |
15822 | 452 purple_blist_node_set_int(node, name, atoi(value)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 g_free(value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 static void |
15822 | 458 parse_buddy(PurpleGroup *group, PurpleContact *contact, xmlnode *bnode) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 { |
15822 | 460 PurpleAccount *account; |
461 PurpleBuddy *buddy; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 char *name = NULL, *alias = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 const char *acct_name, *proto, *protocol; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 xmlnode *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 acct_name = xmlnode_get_attrib(bnode, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 protocol = xmlnode_get_attrib(bnode, "protocol"); |
15822 | 468 protocol = _purple_oscar_convert(acct_name, protocol); /* XXX: Remove */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 proto = xmlnode_get_attrib(bnode, "proto"); |
15822 | 470 proto = _purple_oscar_convert(acct_name, proto); /* XXX: Remove */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 if (!acct_name || (!proto && !protocol)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 |
15822 | 475 account = purple_accounts_find(acct_name, proto ? proto : protocol); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 if (!account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 if ((x = xmlnode_get_child(bnode, "name"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 name = xmlnode_get_data(x); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 if (!name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 if ((x = xmlnode_get_child(bnode, "alias"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 alias = xmlnode_get_data(x); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 |
15822 | 489 buddy = purple_buddy_new(account, name, alias); |
490 purple_blist_add_buddy(buddy, contact, group, | |
491 purple_blist_get_last_child((PurpleBlistNode*)contact)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 for (x = xmlnode_get_child(bnode, "setting"); x; x = xmlnode_get_next_twin(x)) { |
15822 | 494 parse_setting((PurpleBlistNode*)buddy, x); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 g_free(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 g_free(alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 static void |
15822 | 502 parse_contact(PurpleGroup *group, xmlnode *cnode) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 { |
15822 | 504 PurpleContact *contact = purple_contact_new(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 xmlnode *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 const char *alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 |
15822 | 508 purple_blist_add_contact(contact, group, |
509 purple_blist_get_last_child((PurpleBlistNode*)group)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 if ((alias = xmlnode_get_attrib(cnode, "alias"))) { |
24350
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
512 purple_blist_alias_contact(contact, alias); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 for (x = cnode->child; x; x = x->next) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 if (x->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 continue; |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
518 if (purple_strequal(x->name, "buddy")) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 parse_buddy(group, contact, x); |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
520 else if (purple_strequal(x->name, "setting")) |
15822 | 521 parse_setting((PurpleBlistNode*)contact, x); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 /* if the contact is empty, don't keep it around. it causes problems */ |
15822 | 525 if (!((PurpleBlistNode*)contact)->child) |
526 purple_blist_remove_contact(contact); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 static void |
15822 | 530 parse_chat(PurpleGroup *group, xmlnode *cnode) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 { |
15822 | 532 PurpleChat *chat; |
533 PurpleAccount *account; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 const char *acct_name, *proto, *protocol; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 xmlnode *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 char *alias = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 GHashTable *components; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 acct_name = xmlnode_get_attrib(cnode, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 protocol = xmlnode_get_attrib(cnode, "protocol"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 proto = xmlnode_get_attrib(cnode, "proto"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 if (!acct_name || (!proto && !protocol)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 |
15822 | 546 account = purple_accounts_find(acct_name, proto ? proto : protocol); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 if (!account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 if ((x = xmlnode_get_child(cnode, "alias"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 alias = xmlnode_get_data(x); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 for (x = xmlnode_get_child(cnode, "component"); x; x = xmlnode_get_next_twin(x)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 const char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 char *value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 name = xmlnode_get_attrib(x, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 value = xmlnode_get_data(x); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 g_hash_table_replace(components, g_strdup(name), value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 |
15822 | 565 chat = purple_chat_new(account, alias, components); |
566 purple_blist_add_chat(chat, group, | |
567 purple_blist_get_last_child((PurpleBlistNode*)group)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 for (x = xmlnode_get_child(cnode, "setting"); x; x = xmlnode_get_next_twin(x)) { |
15822 | 570 parse_setting((PurpleBlistNode*)chat, x); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 g_free(alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 parse_group(xmlnode *groupnode) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 const char *name = xmlnode_get_attrib(groupnode, "name"); |
15822 | 580 PurpleGroup *group; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 xmlnode *cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 if (!name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 name = _("Buddies"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 |
15822 | 586 group = purple_group_new(name); |
587 purple_blist_add_group(group, | |
588 purple_blist_get_last_sibling(purplebuddylist->root)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 for (cnode = groupnode->child; cnode; cnode = cnode->next) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 if (cnode->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 continue; |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
593 if (purple_strequal(cnode->name, "setting")) |
15822 | 594 parse_setting((PurpleBlistNode*)group, cnode); |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
595 else if (purple_strequal(cnode->name, "contact") || |
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
596 purple_strequal(cnode->name, "person")) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 parse_contact(group, cnode); |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
598 else if (purple_strequal(cnode->name, "chat")) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 parse_chat(group, cnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 /* TODO: Make static and rename to load_blist */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 void |
15822 | 605 purple_blist_load() |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 { |
15822 | 607 xmlnode *purple, *blist, *privacy; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 blist_loaded = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 |
15822 | 611 purple = purple_util_read_xml_from_file("blist.xml", _("buddy list")); |
612 | |
613 if (purple == NULL) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 |
15822 | 616 blist = xmlnode_get_child(purple, "blist"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 if (blist) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 xmlnode *groupnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 for (groupnode = xmlnode_get_child(blist, "group"); groupnode != NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 groupnode = xmlnode_get_next_twin(groupnode)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 parse_group(groupnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 |
15822 | 625 privacy = xmlnode_get_child(purple, "privacy"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 if (privacy) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 xmlnode *anode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 for (anode = privacy->child; anode; anode = anode->next) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 xmlnode *x; |
15822 | 630 PurpleAccount *account; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 int imode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 const char *acct_name, *proto, *mode, *protocol; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 acct_name = xmlnode_get_attrib(anode, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 protocol = xmlnode_get_attrib(anode, "protocol"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 proto = xmlnode_get_attrib(anode, "proto"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 mode = xmlnode_get_attrib(anode, "mode"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 if (!acct_name || (!proto && !protocol) || !mode) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 |
15822 | 642 account = purple_accounts_find(acct_name, proto ? proto : protocol); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 if (!account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 imode = atoi(mode); |
15822 | 648 account->perm_deny = (imode != 0 ? imode : PURPLE_PRIVACY_ALLOW_ALL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 for (x = anode->child; x; x = x->next) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 if (x->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
655 if (purple_strequal(x->name, "permit")) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 name = xmlnode_get_data(x); |
15822 | 657 purple_privacy_permit_add(account, name, TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 g_free(name); |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25890
diff
changeset
|
659 } else if (purple_strequal(x->name, "block")) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 name = xmlnode_get_data(x); |
15822 | 661 purple_privacy_deny_add(account, name, TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 g_free(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 |
15822 | 668 xmlnode_free(purple); |
16373
c9b4ff420140
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
669 |
c9b4ff420140
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
670 /* This tells the buddy icon code to do its thing. */ |
16631
f9c369b4291c
Fix up the private function calls to be prefixed with an underscore.
Richard Laager <rlaager@wiktel.com>
parents:
16510
diff
changeset
|
671 _purple_buddy_icons_blist_loaded_cb(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 /********************************************************************* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 * Stuff * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 *********************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 static void |
15822 | 680 purple_contact_compute_priority_buddy(PurpleContact *contact) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 { |
15822 | 682 PurpleBlistNode *bnode; |
683 PurpleBuddy *new_priority = NULL; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 g_return_if_fail(contact != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 contact->priority = NULL; |
15822 | 688 for (bnode = ((PurpleBlistNode*)contact)->child; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 bnode != NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 bnode = bnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 { |
15822 | 692 PurpleBuddy *buddy; |
693 | |
694 if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 |
15822 | 697 buddy = (PurpleBuddy*)bnode; |
20633
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
698 if (new_priority == NULL) |
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
699 { |
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
700 new_priority = buddy; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 continue; |
20633
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
702 } |
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
703 |
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
704 if (purple_account_is_connected(buddy->account)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 { |
22180
2579d93849bb
When computing priority buddies for a contact, a buddy on an online account will always have a higher priority over a buddy on an offline account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22169
diff
changeset
|
706 int cmp = 1; |
2579d93849bb
When computing priority buddies for a contact, a buddy on an online account will always have a higher priority over a buddy on an offline account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22169
diff
changeset
|
707 if (purple_account_is_connected(new_priority->account)) |
2579d93849bb
When computing priority buddies for a contact, a buddy on an online account will always have a higher priority over a buddy on an offline account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22169
diff
changeset
|
708 cmp = purple_presence_compare(purple_buddy_get_presence(new_priority), |
2579d93849bb
When computing priority buddies for a contact, a buddy on an online account will always have a higher priority over a buddy on an offline account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22169
diff
changeset
|
709 purple_buddy_get_presence(buddy)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 if (cmp > 0 || (cmp == 0 && |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15822
diff
changeset
|
712 purple_prefs_get_bool("/purple/contact/last_match"))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 new_priority = buddy; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 contact->priority = new_priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 contact->priority_valid = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 /***************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 * Public API functions * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 *****************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 |
15822 | 728 PurpleBuddyList *purple_blist_new() |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 { |
15822 | 730 PurpleBlistUiOps *ui_ops; |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
731 GList *account; |
15822 | 732 PurpleBuddyList *gbl = g_new0(PurpleBuddyList, 1); |
733 PURPLE_DBUS_REGISTER_POINTER(gbl, PurpleBuddyList); | |
734 | |
735 ui_ops = purple_blist_get_ui_ops(); | |
736 | |
737 gbl->buddies = g_hash_table_new_full((GHashFunc)_purple_blist_hbuddy_hash, | |
738 (GEqualFunc)_purple_blist_hbuddy_equal, | |
739 (GDestroyNotify)_purple_blist_hbuddy_free_key, NULL); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
741 buddies_cache = g_hash_table_new_full(g_direct_hash, g_direct_equal, |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
742 NULL, (GDestroyNotify)g_hash_table_destroy); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
743 |
27569
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
744 groups_cache = g_hash_table_new_full((GHashFunc)g_str_hash, |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
745 (GEqualFunc)g_str_equal, |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
746 (GDestroyNotify)g_free, NULL); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
747 |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
748 for (account = purple_accounts_get_all(); account != NULL; account = account->next) |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
749 { |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
750 purple_blist_buddies_cache_add_account(account->data); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
751 } |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
752 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 if (ui_ops != NULL && ui_ops->new_list != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 ui_ops->new_list(gbl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 return gbl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 void |
15822 | 760 purple_set_blist(PurpleBuddyList *list) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 { |
15822 | 762 purplebuddylist = list; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 |
15822 | 765 PurpleBuddyList * |
766 purple_get_blist() | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 { |
15822 | 768 return purplebuddylist; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 |
15822 | 771 PurpleBlistNode * |
772 purple_blist_get_root() | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 { |
15822 | 774 return purplebuddylist ? purplebuddylist->root : NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 |
26538
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
777 static void |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
778 append_buddy(gpointer key, gpointer value, gpointer user_data) |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
779 { |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
780 GSList **list = user_data; |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
781 *list = g_slist_prepend(*list, value); |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
782 } |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
783 |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
784 GSList * |
25806 | 785 purple_blist_get_buddies() |
786 { | |
26538
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
787 GSList *buddies = NULL; |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
788 |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
789 if (!purplebuddylist) |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
790 return NULL; |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
791 |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
792 g_hash_table_foreach(purplebuddylist->buddies, append_buddy, &buddies); |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26527
diff
changeset
|
793 return buddies; |
25806 | 794 } |
795 | |
25821
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
796 void * |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
797 purple_blist_get_ui_data() |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
798 { |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
799 return purplebuddylist->ui_data; |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
800 } |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
801 |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
802 void |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
803 purple_blist_set_ui_data(void *ui_data) |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
804 { |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
805 purplebuddylist->ui_data = ui_data; |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
806 } |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
807 |
15822 | 808 void purple_blist_show() |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 { |
15822 | 810 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
812 if (ops && ops->show) |
15822 | 813 ops->show(purplebuddylist); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 |
15822 | 816 void purple_blist_destroy() |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
817 { |
15822 | 818 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
819 | |
820 purple_debug(PURPLE_DEBUG_INFO, "blist", "Destroying\n"); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 if (ops && ops->destroy) |
15822 | 823 ops->destroy(purplebuddylist); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 |
15822 | 826 void purple_blist_set_visible(gboolean show) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 { |
15822 | 828 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 if (ops && ops->set_visible) |
15822 | 831 ops->set_visible(purplebuddylist, show); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 |
15822 | 834 static PurpleBlistNode *get_next_node(PurpleBlistNode *node, gboolean godeep) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 if (node == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 if (godeep && node->child) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 return node->child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 return node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 return get_next_node(node->parent, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 |
15822 | 848 PurpleBlistNode *purple_blist_node_next(PurpleBlistNode *node, gboolean offline) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 { |
15822 | 850 PurpleBlistNode *ret = node; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 if (offline) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 return get_next_node(ret, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 do |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 ret = get_next_node(ret, TRUE); |
15822 | 857 } while (ret && PURPLE_BLIST_NODE_IS_BUDDY(ret) && |
858 !purple_account_is_connected(purple_buddy_get_account((PurpleBuddy *)ret))); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
863 PurpleBlistNode *purple_blist_node_get_parent(PurpleBlistNode *node) |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
864 { |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
865 return node ? node->parent : NULL; |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
866 } |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
867 |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
868 PurpleBlistNode *purple_blist_node_get_first_child(PurpleBlistNode *node) |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
869 { |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
870 return node ? node->child : NULL; |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
871 } |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
872 |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
873 PurpleBlistNode *purple_blist_node_get_sibling_next(PurpleBlistNode *node) |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
874 { |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
875 return node? node->next : NULL; |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
876 } |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
877 |
22212
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22180
diff
changeset
|
878 PurpleBlistNode *purple_blist_node_get_sibling_prev(PurpleBlistNode *node) |
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22180
diff
changeset
|
879 { |
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22180
diff
changeset
|
880 return node? node->prev : NULL; |
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22180
diff
changeset
|
881 } |
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22180
diff
changeset
|
882 |
25821
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
883 void * |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
884 purple_blist_node_get_ui_data(const PurpleBlistNode *node) |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
885 { |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
886 g_return_val_if_fail(node, NULL); |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
887 |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
888 return node->ui_data; |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
889 } |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
890 |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
891 void |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
892 purple_blist_node_set_ui_data(PurpleBlistNode *node, void *ui_data) { |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
893 g_return_if_fail(node); |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
894 |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
895 node->ui_data = ui_data; |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
896 } |
2b8c85f74ede
Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents:
25806
diff
changeset
|
897 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 void |
15822 | 899 purple_blist_update_buddy_status(PurpleBuddy *buddy, PurpleStatus *old_status) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 { |
15822 | 901 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
902 PurplePresence *presence; | |
903 PurpleStatus *status; | |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
904 PurpleBlistNode *cnode; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
905 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 |
15822 | 908 presence = purple_buddy_get_presence(buddy); |
909 status = purple_presence_get_active_status(presence); | |
910 | |
911 purple_debug_info("blist", "Updating buddy status for %s (%s)\n", | |
912 buddy->name, purple_account_get_protocol_name(buddy->account)); | |
913 | |
914 if (purple_status_is_online(status) && | |
915 !purple_status_is_online(old_status)) { | |
916 | |
917 purple_signal_emit(purple_blist_get_handle(), "buddy-signed-on", buddy); | |
918 | |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
919 cnode = buddy->node.parent; |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
920 if (++(PURPLE_CONTACT(cnode)->online) == 1) |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
921 PURPLE_GROUP(cnode->parent)->online++; |
15822 | 922 } else if (!purple_status_is_online(status) && |
923 purple_status_is_online(old_status)) { | |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
924 |
15822 | 925 purple_blist_node_set_int(&buddy->node, "last_seen", time(NULL)); |
926 purple_signal_emit(purple_blist_get_handle(), "buddy-signed-off", buddy); | |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
927 |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
928 cnode = buddy->node.parent; |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
929 if (--(PURPLE_CONTACT(cnode)->online) == 0) |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
930 PURPLE_GROUP(cnode->parent)->online--; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 } else { |
15822 | 932 purple_signal_emit(purple_blist_get_handle(), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 "buddy-status-changed", buddy, old_status, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 status); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
936 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 * This function used to only call the following two functions if one of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 * the above signals had been triggered, but that's not good, because |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 * if someone's away message changes and they don't go from away to back |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 * to away then no signal is triggered. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
942 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
943 * It's a safe assumption that SOMETHING called this function. PROBABLY |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
944 * because something, somewhere changed. Calling the stuff below |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
945 * certainly won't hurt anything. Unless you're on a K6-2 300. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 */ |
15822 | 947 purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
948 if (ops && ops->update) |
15822 | 949 ops->update(purplebuddylist, (PurpleBlistNode *)buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 |
23115
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22694
diff
changeset
|
952 void |
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22694
diff
changeset
|
953 purple_blist_update_node_icon(PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 { |
15822 | 955 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 |
23115
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22694
diff
changeset
|
957 g_return_if_fail(node != NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 if (ops && ops->update) |
23115
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22694
diff
changeset
|
960 ops->update(purplebuddylist, node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
961 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 |
23115
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22694
diff
changeset
|
963 void |
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22694
diff
changeset
|
964 purple_blist_update_buddy_icon(PurpleBuddy *buddy) |
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22694
diff
changeset
|
965 { |
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22694
diff
changeset
|
966 purple_blist_update_node_icon((PurpleBlistNode *)buddy); |
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22694
diff
changeset
|
967 } |
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22694
diff
changeset
|
968 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 * TODO: Maybe remove the call to this from server.c and call it |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 * from oscar.c and toc.c instead? |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 */ |
15822 | 973 void purple_blist_rename_buddy(PurpleBuddy *buddy, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
974 { |
15822 | 975 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
976 struct _purple_hbuddy *hb, *hb2; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
977 GHashTable *account_buddies; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 |
15822 | 981 hb = g_new(struct _purple_hbuddy, 1); |
27584
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
982 hb->name = (gchar *)purple_normalize(buddy->account, buddy->name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 hb->account = buddy->account; |
15822 | 984 hb->group = ((PurpleBlistNode *)buddy)->parent->parent; |
985 g_hash_table_remove(purplebuddylist->buddies, hb); | |
27584
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
986 |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
987 account_buddies = g_hash_table_lookup(buddies_cache, buddy->account); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
988 g_hash_table_remove(account_buddies, hb); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
989 |
15822 | 990 hb->name = g_strdup(purple_normalize(buddy->account, name)); |
991 g_hash_table_replace(purplebuddylist->buddies, hb, buddy); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
992 |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
993 hb2 = g_new(struct _purple_hbuddy, 1); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
994 hb2->name = g_strdup(hb->name); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
995 hb2->account = buddy->account; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
996 hb2->group = ((PurpleBlistNode *)buddy)->parent->parent; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
997 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
998 g_hash_table_replace(account_buddies, hb2, buddy); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
999 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1000 g_free(buddy->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1001 buddy->name = g_strdup(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1002 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1003 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1004 ops->save_node((PurpleBlistNode *) buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1005 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1006 if (ops && ops->update) |
15822 | 1007 ops->update(purplebuddylist, (PurpleBlistNode *)buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1008 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1009 |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1010 static gboolean |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1011 purple_strings_are_different(const char *one, const char *two) |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1012 { |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1013 return !((one && two && g_utf8_collate(one, two) == 0) || |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1014 ((one == NULL || *one == '\0') && (two == NULL || *two == '\0'))); |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1015 } |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1016 |
15822 | 1017 void purple_blist_alias_contact(PurpleContact *contact, const char *alias) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1018 { |
15822 | 1019 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1020 PurpleConversation *conv; | |
1021 PurpleBlistNode *bnode; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1022 char *old_alias; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1023 char *new_alias = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1024 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1025 g_return_if_fail(contact != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1026 |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1027 if ((alias != NULL) && (*alias != '\0')) |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1028 new_alias = purple_utf8_strip_unprintables(alias); |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1029 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1030 if (!purple_strings_are_different(contact->alias, new_alias)) { |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1031 g_free(new_alias); |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1032 return; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1033 } |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1034 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 old_alias = contact->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1037 if ((new_alias != NULL) && (*new_alias != '\0')) |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1038 contact->alias = new_alias; |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1039 else { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1040 contact->alias = NULL; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1041 g_free(new_alias); /* could be "\0" */ |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1042 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1044 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1045 ops->save_node((PurpleBlistNode*) contact); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1046 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 if (ops && ops->update) |
15822 | 1048 ops->update(purplebuddylist, (PurpleBlistNode *)contact); |
1049 | |
1050 for(bnode = ((PurpleBlistNode *)contact)->child; bnode != NULL; bnode = bnode->next) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1051 { |
15822 | 1052 PurpleBuddy *buddy = (PurpleBuddy *)bnode; |
1053 | |
1054 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 buddy->account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1056 if (conv) |
15822 | 1057 purple_conversation_autoset_title(conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1058 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 |
15822 | 1060 purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 contact, old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 g_free(old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 |
15822 | 1065 void purple_blist_alias_chat(PurpleChat *chat, const char *alias) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 { |
15822 | 1067 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 char *old_alias; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1069 char *new_alias = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1070 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1071 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1073 if ((alias != NULL) && (*alias != '\0')) |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1074 new_alias = purple_utf8_strip_unprintables(alias); |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1075 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1076 if (!purple_strings_are_different(chat->alias, new_alias)) { |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1077 g_free(new_alias); |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1078 return; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1079 } |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1080 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 old_alias = chat->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1083 if ((new_alias != NULL) && (*new_alias != '\0')) |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1084 chat->alias = new_alias; |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1085 else { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 chat->alias = NULL; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1087 g_free(new_alias); /* could be "\0" */ |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1088 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1090 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1091 ops->save_node((PurpleBlistNode*) chat); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1092 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 if (ops && ops->update) |
15822 | 1094 ops->update(purplebuddylist, (PurpleBlistNode *)chat); |
1095 | |
1096 purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 chat, old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1098 g_free(old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1099 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1100 |
15822 | 1101 void purple_blist_alias_buddy(PurpleBuddy *buddy, const char *alias) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1102 { |
15822 | 1103 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1104 PurpleConversation *conv; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1105 char *old_alias; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1106 char *new_alias = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1107 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1108 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1109 |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1110 if ((alias != NULL) && (*alias != '\0')) |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1111 new_alias = purple_utf8_strip_unprintables(alias); |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1112 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1113 if (!purple_strings_are_different(buddy->alias, new_alias)) { |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1114 g_free(new_alias); |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1115 return; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1116 } |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1117 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1118 old_alias = buddy->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1119 |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1120 if ((new_alias != NULL) && (*new_alias != '\0')) |
28173
f7bb03f0518e
La la la, oops. HanzZ pointed this (leak) out.
Paul Aurich <paul@darkrain42.org>
parents:
27705
diff
changeset
|
1121 buddy->alias = new_alias; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1122 else { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1123 buddy->alias = NULL; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1124 g_free(new_alias); /* could be "\0" */ |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1125 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1126 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1127 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1128 ops->save_node((PurpleBlistNode*) buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1129 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1130 if (ops && ops->update) |
15822 | 1131 ops->update(purplebuddylist, (PurpleBlistNode *)buddy); |
1132 | |
1133 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 buddy->account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1135 if (conv) |
15822 | 1136 purple_conversation_autoset_title(conv); |
1137 | |
1138 purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1139 buddy, old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1140 g_free(old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1142 |
15822 | 1143 void purple_blist_server_alias_buddy(PurpleBuddy *buddy, const char *alias) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1144 { |
15822 | 1145 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1146 PurpleConversation *conv; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 char *old_alias; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1148 char *new_alias = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1149 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1152 if ((alias != NULL) && (*alias != '\0') && g_utf8_validate(alias, -1, NULL)) |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1153 new_alias = purple_utf8_strip_unprintables(alias); |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1154 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1155 if (!purple_strings_are_different(buddy->server_alias, new_alias)) { |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1156 g_free(new_alias); |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1157 return; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1158 } |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1159 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1160 old_alias = buddy->server_alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1161 |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1162 if ((new_alias != NULL) && (*new_alias != '\0')) |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1163 buddy->server_alias = new_alias; |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1164 else { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1165 buddy->server_alias = NULL; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1166 g_free(new_alias); /* could be "\0"; */ |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1167 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1169 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1170 ops->save_node((PurpleBlistNode*) buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1171 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1172 if (ops && ops->update) |
15822 | 1173 ops->update(purplebuddylist, (PurpleBlistNode *)buddy); |
1174 | |
1175 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 buddy->account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1177 if (conv) |
15822 | 1178 purple_conversation_autoset_title(conv); |
1179 | |
1180 purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1181 buddy, old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 g_free(old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1183 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1185 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1186 * TODO: If merging, prompt the user if they want to merge. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1187 */ |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1188 void purple_blist_rename_group(PurpleGroup *source, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 { |
15822 | 1190 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1191 PurpleGroup *dest; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 gchar *old_name; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1193 gchar *new_name; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 GList *moved_buddies = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 GSList *accts; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1197 g_return_if_fail(source != NULL); |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1198 g_return_if_fail(name != NULL); |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1199 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1200 new_name = purple_utf8_strip_unprintables(name); |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1201 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1202 if (*new_name == '\0' || purple_strequal(new_name, source->name)) { |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1203 g_free(new_name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1204 return; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1205 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1206 |
15822 | 1207 dest = purple_find_group(new_name); |
24865 | 1208 if (dest != NULL && purple_utf8_strcasecmp(source->name, dest->name) != 0) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1209 /* We're merging two groups */ |
15822 | 1210 PurpleBlistNode *prev, *child, *next; |
1211 | |
1212 prev = purple_blist_get_last_child((PurpleBlistNode*)dest); | |
1213 child = ((PurpleBlistNode*)source)->child; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1214 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1215 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 * TODO: This seems like a dumb way to do this... why not just |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1217 * append all children from the old group to the end of the new |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1218 * one? PRPLs might be expecting to receive an add_buddy() for |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1219 * each moved buddy... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1220 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1221 while (child) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1222 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1223 next = child->next; |
15822 | 1224 if (PURPLE_BLIST_NODE_IS_CONTACT(child)) { |
1225 PurpleBlistNode *bnode; | |
1226 purple_blist_add_contact((PurpleContact *)child, dest, prev); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1227 for (bnode = child->child; bnode != NULL; bnode = bnode->next) { |
15822 | 1228 purple_blist_add_buddy((PurpleBuddy *)bnode, (PurpleContact *)child, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1229 NULL, bnode->prev); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1230 moved_buddies = g_list_append(moved_buddies, bnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1231 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 prev = child; |
15822 | 1233 } else if (PURPLE_BLIST_NODE_IS_CHAT(child)) { |
1234 purple_blist_add_chat((PurpleChat *)child, dest, prev); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1235 prev = child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1236 } else { |
15822 | 1237 purple_debug(PURPLE_DEBUG_ERROR, "blist", |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1238 "Unknown child type in group %s\n", source->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1240 child = next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1241 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 /* Make a copy of the old group name and then delete the old group */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1244 old_name = g_strdup(source->name); |
15822 | 1245 purple_blist_remove_group(source); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 source = dest; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1247 g_free(new_name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1248 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 /* A simple rename */ |
15822 | 1250 PurpleBlistNode *cnode, *bnode; |
27569
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
1251 gchar* key; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1252 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 /* Build a GList of all buddies in this group */ |
15822 | 1254 for (cnode = ((PurpleBlistNode *)source)->child; cnode != NULL; cnode = cnode->next) { |
1255 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1256 for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 moved_buddies = g_list_append(moved_buddies, bnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1258 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1259 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1260 old_name = source->name; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1261 source->name = new_name; |
27569
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
1262 |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
1263 key = g_utf8_collate_key(old_name, -1); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
1264 g_hash_table_remove(groups_cache, key); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
1265 g_free(key); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
1266 |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
1267 key = g_utf8_collate_key(new_name, -1); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
1268 g_hash_table_insert(groups_cache, key, source); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1269 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1270 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1271 /* Save our changes */ |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1272 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1273 ops->save_node((PurpleBlistNode*) source); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1274 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1275 /* Update the UI */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1276 if (ops && ops->update) |
15822 | 1277 ops->update(purplebuddylist, (PurpleBlistNode*)source); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1278 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1279 /* Notify all PRPLs */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1280 /* TODO: Is this condition needed? Seems like it would always be TRUE */ |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1281 if(old_name && !purple_strequal(source->name, old_name)) { |
15822 | 1282 for (accts = purple_group_get_accounts(source); accts; accts = g_slist_remove(accts, accts->data)) { |
1283 PurpleAccount *account = accts->data; | |
22262
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22219
diff
changeset
|
1284 PurpleConnection *gc = NULL; |
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22219
diff
changeset
|
1285 PurplePlugin *prpl = NULL; |
15822 | 1286 PurplePluginProtocolInfo *prpl_info = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1287 GList *l = NULL, *buddies = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1288 |
22262
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22219
diff
changeset
|
1289 gc = purple_account_get_connection(account); |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25907
diff
changeset
|
1290 |
22262
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22219
diff
changeset
|
1291 if(gc) |
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22219
diff
changeset
|
1292 prpl = purple_connection_get_prpl(gc); |
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22219
diff
changeset
|
1293 |
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22219
diff
changeset
|
1294 if(gc && prpl) |
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22219
diff
changeset
|
1295 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1296 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1297 if(!prpl_info) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1298 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1299 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1300 for(l = moved_buddies; l; l = l->next) { |
15822 | 1301 PurpleBuddy *buddy = (PurpleBuddy *)l->data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1302 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1303 if(buddy && buddy->account == account) |
15822 | 1304 buddies = g_list_append(buddies, (PurpleBlistNode *)buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1305 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1306 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1307 if(prpl_info->rename_group) { |
22262
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22219
diff
changeset
|
1308 prpl_info->rename_group(gc, old_name, source, buddies); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1309 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1310 GList *cur, *groups = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1311 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1312 /* Make a list of what the groups each buddy is in */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1313 for(cur = buddies; cur; cur = cur->next) { |
15822 | 1314 PurpleBlistNode *node = (PurpleBlistNode *)cur->data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1315 groups = g_list_prepend(groups, node->parent->parent); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1316 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1317 |
15822 | 1318 purple_account_remove_buddies(account, buddies, groups); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1319 g_list_free(groups); |
15822 | 1320 purple_account_add_buddies(account, buddies); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1321 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1322 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1323 g_list_free(buddies); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1324 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1325 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1326 g_list_free(moved_buddies); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1327 g_free(old_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1328 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1329 |
15822 | 1330 static void purple_blist_node_initialize_settings(PurpleBlistNode *node); |
1331 | |
1332 PurpleChat *purple_chat_new(PurpleAccount *account, const char *alias, GHashTable *components) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1333 { |
15822 | 1334 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1335 PurpleChat *chat; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1336 |
27415
2e6482e80a16
Returning FALSE from a function that is suposed to return a PurpleChat * is
Etan Reisner <pidgin@unreliablesource.net>
parents:
27230
diff
changeset
|
1337 g_return_val_if_fail(account != NULL, NULL); |
2e6482e80a16
Returning FALSE from a function that is suposed to return a PurpleChat * is
Etan Reisner <pidgin@unreliablesource.net>
parents:
27230
diff
changeset
|
1338 g_return_val_if_fail(components != NULL, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1339 |
15822 | 1340 chat = g_new0(PurpleChat, 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1341 chat->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1342 if ((alias != NULL) && (*alias != '\0')) |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1343 chat->alias = purple_utf8_strip_unprintables(alias); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1344 chat->components = components; |
15822 | 1345 purple_blist_node_initialize_settings((PurpleBlistNode *)chat); |
1346 ((PurpleBlistNode *)chat)->type = PURPLE_BLIST_CHAT_NODE; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1347 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1348 if (ops != NULL && ops->new_node != NULL) |
15822 | 1349 ops->new_node((PurpleBlistNode *)chat); |
1350 | |
1351 PURPLE_DBUS_REGISTER_POINTER(chat, PurpleChat); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1352 return chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1353 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1354 |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1355 void |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1356 purple_chat_destroy(PurpleChat *chat) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1357 { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1358 g_hash_table_destroy(chat->components); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1359 g_hash_table_destroy(chat->node.settings); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1360 g_free(chat->alias); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1361 PURPLE_DBUS_UNREGISTER_POINTER(chat); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1362 g_free(chat); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1363 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1364 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
1365 PurpleBuddy *purple_buddy_new(PurpleAccount *account, const char *name, const char *alias) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1366 { |
15822 | 1367 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1368 PurpleBuddy *buddy; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1369 |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1370 g_return_val_if_fail(account != NULL, NULL); |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1371 g_return_val_if_fail(name != NULL, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1372 |
15822 | 1373 buddy = g_new0(PurpleBuddy, 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1374 buddy->account = account; |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1375 buddy->name = purple_utf8_strip_unprintables(name); |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1376 buddy->alias = purple_utf8_strip_unprintables(alias); |
15822 | 1377 buddy->presence = purple_presence_new_for_buddy(buddy); |
1378 ((PurpleBlistNode *)buddy)->type = PURPLE_BLIST_BUDDY_NODE; | |
1379 | |
1380 purple_presence_set_status_active(buddy->presence, "offline", TRUE); | |
1381 | |
1382 purple_blist_node_initialize_settings((PurpleBlistNode *)buddy); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1383 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1384 if (ops && ops->new_node) |
15822 | 1385 ops->new_node((PurpleBlistNode *)buddy); |
1386 | |
1387 PURPLE_DBUS_REGISTER_POINTER(buddy, PurpleBuddy); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1388 return buddy; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1389 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1390 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1391 void |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1392 purple_buddy_destroy(PurpleBuddy *buddy) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1393 { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1394 PurplePlugin *prpl; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1395 PurplePluginProtocolInfo *prpl_info; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1396 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1397 /* |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1398 * Tell the owner PRPL that we're about to free the buddy so it |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1399 * can free proto_data |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1400 */ |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1401 prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account)); |
26527
9a2e4aebfa91
Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26520
diff
changeset
|
1402 if (prpl) { |
9a2e4aebfa91
Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26520
diff
changeset
|
1403 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
9a2e4aebfa91
Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26520
diff
changeset
|
1404 if (prpl_info && prpl_info->buddy_free) |
9a2e4aebfa91
Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26520
diff
changeset
|
1405 prpl_info->buddy_free(buddy); |
9a2e4aebfa91
Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26520
diff
changeset
|
1406 } |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1407 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1408 /* Delete the node */ |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1409 purple_buddy_icon_unref(buddy->icon); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1410 g_hash_table_destroy(buddy->node.settings); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1411 purple_presence_destroy(buddy->presence); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1412 g_free(buddy->name); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1413 g_free(buddy->alias); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1414 g_free(buddy->server_alias); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1415 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1416 PURPLE_DBUS_UNREGISTER_POINTER(buddy); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1417 g_free(buddy); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1418 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1419 /* FIXME: Once PurpleBuddy is a GObject, timeout callbacks can |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1420 * g_object_ref() it when connecting the callback and |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1421 * g_object_unref() it in the handler. That way, it won't |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1422 * get freed while the timeout is pending and this line can |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1423 * be removed. */ |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1424 while (g_source_remove_by_user_data((gpointer *)buddy)); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1425 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1426 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1427 void |
15822 | 1428 purple_buddy_set_icon(PurpleBuddy *buddy, PurpleBuddyIcon *icon) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1429 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1430 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1431 |
16373
c9b4ff420140
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
1432 if (buddy->icon != icon) |
c9b4ff420140
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
1433 { |
c9b4ff420140
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
1434 purple_buddy_icon_unref(buddy->icon); |
15822 | 1435 buddy->icon = (icon != NULL ? purple_buddy_icon_ref(icon) : NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1436 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1437 |
15822 | 1438 purple_signal_emit(purple_blist_get_handle(), "buddy-icon-changed", buddy); |
1439 | |
23117
21636ef92dbb
Update some calls to the functions I just deprecated.
Etan Reisner <pidgin@unreliablesource.net>
parents:
23115
diff
changeset
|
1440 purple_blist_update_node_icon((PurpleBlistNode*)buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1441 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1442 |
15822 | 1443 PurpleAccount * |
1444 purple_buddy_get_account(const PurpleBuddy *buddy) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1445 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1446 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1447 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1448 return buddy->account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1449 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1450 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1451 const char * |
15822 | 1452 purple_buddy_get_name(const PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1453 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1454 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1455 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1456 return buddy->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1457 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1458 |
15822 | 1459 PurpleBuddyIcon * |
1460 purple_buddy_get_icon(const PurpleBuddy *buddy) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1461 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1462 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1463 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1464 return buddy->icon; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1465 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1466 |
25787
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1467 gpointer |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1468 purple_buddy_get_protocol_data(const PurpleBuddy *buddy) |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1469 { |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1470 g_return_val_if_fail(buddy != NULL, NULL); |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1471 |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1472 return buddy->proto_data; |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1473 } |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1474 |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1475 void |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1476 purple_buddy_set_protocol_data(PurpleBuddy *buddy, gpointer data) |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1477 { |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1478 g_return_if_fail(buddy != NULL); |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1479 |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1480 buddy->proto_data = data; |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1481 } |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1482 |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24333
diff
changeset
|
1483 |
15822 | 1484 void purple_blist_add_chat(PurpleChat *chat, PurpleGroup *group, PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1485 { |
15822 | 1486 PurpleBlistNode *cnode = (PurpleBlistNode*)chat; |
1487 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1488 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1489 g_return_if_fail(chat != NULL); |
15822 | 1490 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT((PurpleBlistNode *)chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1491 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1492 if (node == NULL) { |
22984
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1493 if (group == NULL) |
15822 | 1494 group = purple_group_new(_("Chats")); |
22984
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1495 |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1496 /* Add group to blist if isn't already on it. Fixes #2752. */ |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1497 if (!purple_find_group(group->name)) { |
15822 | 1498 purple_blist_add_group(group, |
1499 purple_blist_get_last_sibling(purplebuddylist->root)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1500 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1501 } else { |
15822 | 1502 group = (PurpleGroup*)node->parent; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1503 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1504 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1505 /* if we're moving to overtop of ourselves, do nothing */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1506 if (cnode == node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1507 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1508 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1509 if (cnode->parent) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1510 /* This chat was already in the list and is |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1511 * being moved. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1512 */ |
15822 | 1513 ((PurpleGroup *)cnode->parent)->totalsize--; |
1514 if (purple_account_is_connected(chat->account)) { | |
1515 ((PurpleGroup *)cnode->parent)->online--; | |
1516 ((PurpleGroup *)cnode->parent)->currentsize--; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1517 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1518 if (cnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1519 cnode->next->prev = cnode->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1520 if (cnode->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1521 cnode->prev->next = cnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1522 if (cnode->parent->child == cnode) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1523 cnode->parent->child = cnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1524 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1525 if (ops && ops->remove) |
15822 | 1526 ops->remove(purplebuddylist, cnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1527 /* ops->remove() cleaned up the cnode's ui_data, so we need to |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1528 * reinitialize it */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1529 if (ops && ops->new_node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1530 ops->new_node(cnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1531 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1532 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1533 if (node != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1534 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1535 node->next->prev = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1536 cnode->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 cnode->prev = node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1538 cnode->parent = node->parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1539 node->next = cnode; |
15822 | 1540 ((PurpleGroup *)node->parent)->totalsize++; |
1541 if (purple_account_is_connected(chat->account)) { | |
1542 ((PurpleGroup *)node->parent)->online++; | |
1543 ((PurpleGroup *)node->parent)->currentsize++; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1544 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1545 } else { |
15822 | 1546 if (((PurpleBlistNode *)group)->child) |
1547 ((PurpleBlistNode *)group)->child->prev = cnode; | |
1548 cnode->next = ((PurpleBlistNode *)group)->child; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1549 cnode->prev = NULL; |
15822 | 1550 ((PurpleBlistNode *)group)->child = cnode; |
1551 cnode->parent = (PurpleBlistNode *)group; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1552 group->totalsize++; |
15822 | 1553 if (purple_account_is_connected(chat->account)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1554 group->online++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1555 group->currentsize++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1557 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1558 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1559 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1560 ops->save_node(cnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1562 if (ops && ops->update) |
15822 | 1563 ops->update(purplebuddylist, (PurpleBlistNode *)cnode); |
26796
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
1564 |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
1565 purple_signal_emit(purple_blist_get_handle(), "blist-node-added", |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
1566 cnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1567 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1568 |
15822 | 1569 void purple_blist_add_buddy(PurpleBuddy *buddy, PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1570 { |
15822 | 1571 PurpleBlistNode *cnode, *bnode; |
1572 PurpleGroup *g; | |
1573 PurpleContact *c; | |
1574 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); | |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1575 struct _purple_hbuddy *hb, *hb2; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1576 GHashTable *account_buddies; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1577 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1578 g_return_if_fail(buddy != NULL); |
15822 | 1579 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY((PurpleBlistNode*)buddy)); |
1580 | |
1581 bnode = (PurpleBlistNode *)buddy; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1582 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1583 /* if we're moving to overtop of ourselves, do nothing */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1584 if (bnode == node || (!node && bnode->parent && |
15822 | 1585 contact && bnode->parent == (PurpleBlistNode*)contact |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1586 && bnode == bnode->parent->child)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1587 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1588 |
15822 | 1589 if (node && PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
1590 c = (PurpleContact*)node->parent; | |
1591 g = (PurpleGroup*)node->parent->parent; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1592 } else if (contact) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1593 c = contact; |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
1594 g = PURPLE_GROUP(PURPLE_BLIST_NODE(c)->parent); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1595 } else { |
22984
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1596 g = group; |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1597 if (g == NULL) |
15822 | 1598 g = purple_group_new(_("Buddies")); |
22984
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1599 /* Add group to blist if isn't already on it. Fixes #2752. */ |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1600 if (!purple_find_group(g->name)) { |
15822 | 1601 purple_blist_add_group(g, |
1602 purple_blist_get_last_sibling(purplebuddylist->root)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1603 } |
15822 | 1604 c = purple_contact_new(); |
1605 purple_blist_add_contact(c, g, | |
1606 purple_blist_get_last_child((PurpleBlistNode*)g)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1607 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1608 |
15822 | 1609 cnode = (PurpleBlistNode *)c; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1610 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1611 if (bnode->parent) { |
15822 | 1612 if (PURPLE_BUDDY_IS_ONLINE(buddy)) { |
1613 ((PurpleContact*)bnode->parent)->online--; | |
1614 if (((PurpleContact*)bnode->parent)->online == 0) | |
1615 ((PurpleGroup*)bnode->parent->parent)->online--; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1616 } |
15822 | 1617 if (purple_account_is_connected(buddy->account)) { |
1618 ((PurpleContact*)bnode->parent)->currentsize--; | |
1619 if (((PurpleContact*)bnode->parent)->currentsize == 0) | |
1620 ((PurpleGroup*)bnode->parent->parent)->currentsize--; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 } |
15822 | 1622 ((PurpleContact*)bnode->parent)->totalsize--; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1623 /* the group totalsize will be taken care of by remove_contact below */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1624 |
15822 | 1625 if (bnode->parent->parent != (PurpleBlistNode*)g) |
1626 serv_move_buddy(buddy, (PurpleGroup *)bnode->parent->parent, g); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1627 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1628 if (bnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 bnode->next->prev = bnode->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1630 if (bnode->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 bnode->prev->next = bnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1632 if (bnode->parent->child == bnode) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1633 bnode->parent->child = bnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1634 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1635 if (ops && ops->remove) |
15822 | 1636 ops->remove(purplebuddylist, bnode); |
1637 | |
1638 if (bnode->parent->parent != (PurpleBlistNode*)g) { | |
27584
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
1639 struct _purple_hbuddy hb; |
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
1640 hb.name = (gchar *)purple_normalize(buddy->account, buddy->name); |
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
1641 hb.account = buddy->account; |
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
1642 hb.group = bnode->parent->parent; |
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
1643 g_hash_table_remove(purplebuddylist->buddies, &hb); |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1644 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1645 account_buddies = g_hash_table_lookup(buddies_cache, buddy->account); |
27584
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
1646 g_hash_table_remove(account_buddies, &hb); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1647 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1648 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1649 if (!bnode->parent->child) { |
15822 | 1650 purple_blist_remove_contact((PurpleContact*)bnode->parent); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1651 } else { |
15822 | 1652 purple_contact_invalidate_priority_buddy((PurpleContact*)bnode->parent); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1653 if (ops && ops->update) |
15822 | 1654 ops->update(purplebuddylist, bnode->parent); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1655 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1656 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1657 |
15822 | 1658 if (node && PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1659 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1660 node->next->prev = bnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1661 bnode->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1662 bnode->prev = node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1663 bnode->parent = node->parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1664 node->next = bnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1665 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1666 if (cnode->child) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1667 cnode->child->prev = bnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1668 bnode->prev = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1669 bnode->next = cnode->child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1670 cnode->child = bnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1671 bnode->parent = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1672 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1673 |
15822 | 1674 if (PURPLE_BUDDY_IS_ONLINE(buddy)) { |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
1675 if (++(PURPLE_CONTACT(bnode->parent)->online) == 1) |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
1676 PURPLE_GROUP(bnode->parent->parent)->online++; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1677 } |
15822 | 1678 if (purple_account_is_connected(buddy->account)) { |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
1679 if (++(PURPLE_CONTACT(bnode->parent)->currentsize) == 1) |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
1680 PURPLE_GROUP(bnode->parent->parent)->currentsize++; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1681 } |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
1682 PURPLE_CONTACT(bnode->parent)->totalsize++; |
15822 | 1683 |
1684 hb = g_new(struct _purple_hbuddy, 1); | |
1685 hb->name = g_strdup(purple_normalize(buddy->account, buddy->name)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1686 hb->account = buddy->account; |
15822 | 1687 hb->group = ((PurpleBlistNode*)buddy)->parent->parent; |
1688 | |
1689 g_hash_table_replace(purplebuddylist->buddies, hb, buddy); | |
1690 | |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1691 account_buddies = g_hash_table_lookup(buddies_cache, buddy->account); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1692 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1693 hb2 = g_new(struct _purple_hbuddy, 1); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1694 hb2->name = g_strdup(hb->name); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1695 hb2->account = buddy->account; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1696 hb2->group = ((PurpleBlistNode*)buddy)->parent->parent; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1697 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1698 g_hash_table_replace(account_buddies, hb2, buddy); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1699 |
15822 | 1700 purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy)); |
1701 | |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1702 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1703 ops->save_node((PurpleBlistNode*) buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1704 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1705 if (ops && ops->update) |
15822 | 1706 ops->update(purplebuddylist, (PurpleBlistNode*)buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1707 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1708 /* Signal that the buddy has been added */ |
15822 | 1709 purple_signal_emit(purple_blist_get_handle(), "buddy-added", buddy); |
26796
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
1710 |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
1711 purple_signal_emit(purple_blist_get_handle(), "blist-node-added", |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
1712 PURPLE_BLIST_NODE(buddy)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1713 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1714 |
15822 | 1715 PurpleContact *purple_contact_new() |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1716 { |
15822 | 1717 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1718 | |
1719 PurpleContact *contact = g_new0(PurpleContact, 1); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1720 contact->totalsize = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1721 contact->currentsize = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1722 contact->online = 0; |
15822 | 1723 purple_blist_node_initialize_settings((PurpleBlistNode *)contact); |
1724 ((PurpleBlistNode *)contact)->type = PURPLE_BLIST_CONTACT_NODE; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1725 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1726 if (ops && ops->new_node) |
15822 | 1727 ops->new_node((PurpleBlistNode *)contact); |
1728 | |
1729 PURPLE_DBUS_REGISTER_POINTER(contact, PurpleContact); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1730 return contact; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1731 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1732 |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1733 void |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1734 purple_contact_destroy(PurpleContact *contact) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1735 { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1736 g_hash_table_destroy(contact->node.settings); |
26548
3e274d6fcfaa
Plug leak of PurpleContact->alias
Paul Aurich <paul@darkrain42.org>
parents:
26543
diff
changeset
|
1737 g_free(contact->alias); |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1738 PURPLE_DBUS_UNREGISTER_POINTER(contact); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1739 g_free(contact); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1740 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1741 |
29335
e26af064fe8c
added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents:
29333
diff
changeset
|
1742 PurpleGroup * |
e26af064fe8c
added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents:
29333
diff
changeset
|
1743 purple_contact_get_group(const PurpleContact *contact) |
e26af064fe8c
added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents:
29333
diff
changeset
|
1744 { |
e26af064fe8c
added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents:
29333
diff
changeset
|
1745 g_return_val_if_fail(contact, NULL); |
e26af064fe8c
added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents:
29333
diff
changeset
|
1746 |
e26af064fe8c
added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents:
29333
diff
changeset
|
1747 return (PurpleGroup *)(((PurpleBlistNode *)contact)->parent); |
e26af064fe8c
added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents:
29333
diff
changeset
|
1748 } |
e26af064fe8c
added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents:
29333
diff
changeset
|
1749 |
15822 | 1750 void purple_contact_set_alias(PurpleContact *contact, const char *alias) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1751 { |
20550
28493a27849b
Looking at purple_contact_set_alias and purple_blist_alias_contact functions
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20205
diff
changeset
|
1752 purple_blist_alias_contact(contact,alias); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1753 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1754 |
15822 | 1755 const char *purple_contact_get_alias(PurpleContact* contact) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1756 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1757 g_return_val_if_fail(contact != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1758 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1759 if (contact->alias) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1760 return contact->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1761 |
15822 | 1762 return purple_buddy_get_alias(purple_contact_get_priority_buddy(contact)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1763 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1764 |
15822 | 1765 gboolean purple_contact_on_account(PurpleContact *c, PurpleAccount *account) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1766 { |
15822 | 1767 PurpleBlistNode *bnode, *cnode = (PurpleBlistNode *) c; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1768 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1769 g_return_val_if_fail(c != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1770 g_return_val_if_fail(account != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1771 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1772 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
15822 | 1773 PurpleBuddy *buddy; |
1774 | |
1775 if (! PURPLE_BLIST_NODE_IS_BUDDY(bnode)) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1776 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1777 |
15822 | 1778 buddy = (PurpleBuddy *)bnode; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1779 if (buddy->account == account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1780 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1781 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1782 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1783 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1784 |
15822 | 1785 void purple_contact_invalidate_priority_buddy(PurpleContact *contact) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1786 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1787 g_return_if_fail(contact != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1788 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1789 contact->priority_valid = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1790 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1791 |
15822 | 1792 PurpleGroup *purple_group_new(const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1793 { |
15822 | 1794 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1795 PurpleGroup *group; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1796 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1797 g_return_val_if_fail(name != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1798 g_return_val_if_fail(*name != '\0', NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1799 |
15822 | 1800 group = purple_find_group(name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1801 if (group != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1802 return group; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1803 |
15822 | 1804 group = g_new0(PurpleGroup, 1); |
27024
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
1805 group->name = purple_utf8_strip_unprintables(name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1806 group->totalsize = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1807 group->currentsize = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1808 group->online = 0; |
15822 | 1809 purple_blist_node_initialize_settings((PurpleBlistNode *)group); |
1810 ((PurpleBlistNode *)group)->type = PURPLE_BLIST_GROUP_NODE; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1811 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1812 if (ops && ops->new_node) |
15822 | 1813 ops->new_node((PurpleBlistNode *)group); |
1814 | |
1815 PURPLE_DBUS_REGISTER_POINTER(group, PurpleGroup); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1816 return group; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1817 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1818 |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1819 void |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1820 purple_group_destroy(PurpleGroup *group) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1821 { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1822 g_hash_table_destroy(group->node.settings); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1823 g_free(group->name); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1824 PURPLE_DBUS_UNREGISTER_POINTER(group); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1825 g_free(group); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1826 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
1827 |
15822 | 1828 void purple_blist_add_contact(PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1829 { |
15822 | 1830 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1831 PurpleGroup *g; | |
1832 PurpleBlistNode *gnode, *cnode, *bnode; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1833 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1834 g_return_if_fail(contact != NULL); |
15822 | 1835 g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT((PurpleBlistNode*)contact)); |
1836 | |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
1837 if (PURPLE_BLIST_NODE(contact) == node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1838 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1839 |
15822 | 1840 if (node && (PURPLE_BLIST_NODE_IS_CONTACT(node) || |
1841 PURPLE_BLIST_NODE_IS_CHAT(node))) | |
1842 g = (PurpleGroup*)node->parent; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1843 else if (group) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1844 g = group; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1845 else { |
22984
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1846 g = purple_find_group(_("Buddies")); |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1847 if (g == NULL) { |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1848 g = purple_group_new(_("Buddies")); |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1849 purple_blist_add_group(g, |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1850 purple_blist_get_last_sibling(purplebuddylist->root)); |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22920
diff
changeset
|
1851 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1852 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1853 |
15822 | 1854 gnode = (PurpleBlistNode*)g; |
1855 cnode = (PurpleBlistNode*)contact; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1856 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1857 if (cnode->parent) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1858 if (cnode->parent->child == cnode) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1859 cnode->parent->child = cnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1860 if (cnode->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1861 cnode->prev->next = cnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1862 if (cnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1863 cnode->next->prev = cnode->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1864 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1865 if (cnode->parent != gnode) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1866 bnode = cnode->child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1867 while (bnode) { |
15822 | 1868 PurpleBlistNode *next_bnode = bnode->next; |
1869 PurpleBuddy *b = (PurpleBuddy*)bnode; | |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1870 GHashTable *account_buddies; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1871 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1872 struct _purple_hbuddy *hb, *hb2; |
27584
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
1873 |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1874 hb = g_new(struct _purple_hbuddy, 1); |
15822 | 1875 hb->name = g_strdup(purple_normalize(b->account, b->name)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1876 hb->account = b->account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1877 hb->group = cnode->parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1878 |
15822 | 1879 g_hash_table_remove(purplebuddylist->buddies, hb); |
1880 | |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1881 account_buddies = g_hash_table_lookup(buddies_cache, b->account); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1882 g_hash_table_remove(account_buddies, hb); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1883 |
15822 | 1884 if (!purple_find_buddy_in_group(b->account, b->name, g)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1885 hb->group = gnode; |
15822 | 1886 g_hash_table_replace(purplebuddylist->buddies, hb, b); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1887 |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1888 hb2 = g_new(struct _purple_hbuddy, 1); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1889 hb2->name = g_strdup(hb->name); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1890 hb2->account = b->account; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1891 hb2->group = gnode; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1892 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1893 g_hash_table_replace(account_buddies, hb2, b); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
1894 |
22327
6fc8f0c825e0
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22262
diff
changeset
|
1895 if (purple_account_get_connection(b->account)) |
15822 | 1896 serv_move_buddy(b, (PurpleGroup *)cnode->parent, g); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1897 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1898 gboolean empty_contact = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1899 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1900 /* this buddy already exists in the group, so we're |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1901 * gonna delete it instead */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1902 g_free(hb->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1903 g_free(hb); |
22327
6fc8f0c825e0
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22262
diff
changeset
|
1904 if (purple_account_get_connection(b->account)) |
15822 | 1905 purple_account_remove_buddy(b->account, b, (PurpleGroup *)cnode->parent); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1906 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1907 if (!cnode->child->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1908 empty_contact = TRUE; |
15822 | 1909 purple_blist_remove_buddy(b); |
1910 | |
1911 /** in purple_blist_remove_buddy(), if the last buddy in a | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1912 * contact is removed, the contact is cleaned up and |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1913 * g_free'd, so we mustn't try to reference bnode->next */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1914 if (empty_contact) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1915 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1916 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1917 bnode = next_bnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1918 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1919 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1920 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1921 if (contact->online > 0) |
15822 | 1922 ((PurpleGroup*)cnode->parent)->online--; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1923 if (contact->currentsize > 0) |
15822 | 1924 ((PurpleGroup*)cnode->parent)->currentsize--; |
1925 ((PurpleGroup*)cnode->parent)->totalsize--; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1926 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1927 if (ops && ops->remove) |
15822 | 1928 ops->remove(purplebuddylist, cnode); |
1929 | |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1930 if (ops && ops->remove_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1931 ops->remove_node(cnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1932 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1933 |
15822 | 1934 if (node && (PURPLE_BLIST_NODE_IS_CONTACT(node) || |
1935 PURPLE_BLIST_NODE_IS_CHAT(node))) { | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1936 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1937 node->next->prev = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1938 cnode->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1939 cnode->prev = node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1940 cnode->parent = node->parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1941 node->next = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1942 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1943 if (gnode->child) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1944 gnode->child->prev = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1945 cnode->prev = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1946 cnode->next = gnode->child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1947 gnode->child = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1948 cnode->parent = gnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1949 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1950 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1951 if (contact->online > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1952 g->online++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1953 if (contact->currentsize > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1954 g->currentsize++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1955 g->totalsize++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1956 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1957 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1958 { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1959 if (cnode->child) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1960 ops->save_node(cnode); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1961 for (bnode = cnode->child; bnode; bnode = bnode->next) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1962 ops->save_node(bnode); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
1963 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1964 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1965 if (ops && ops->update) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1966 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1967 if (cnode->child) |
15822 | 1968 ops->update(purplebuddylist, cnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1969 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1970 for (bnode = cnode->child; bnode; bnode = bnode->next) |
15822 | 1971 ops->update(purplebuddylist, bnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1972 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1973 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1974 |
15822 | 1975 void purple_blist_merge_contact(PurpleContact *source, PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1976 { |
15822 | 1977 PurpleBlistNode *sourcenode = (PurpleBlistNode*)source; |
1978 PurpleBlistNode *prev, *cur, *next; | |
1979 PurpleContact *target; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1980 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1981 g_return_if_fail(source != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1982 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1983 |
15822 | 1984 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
1985 target = (PurpleContact *)node; | |
1986 prev = purple_blist_get_last_child(node); | |
1987 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | |
1988 target = (PurpleContact *)node->parent; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1989 prev = node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1990 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1991 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1992 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1993 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1994 if (source == target || !target) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1995 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1996 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1997 next = sourcenode->child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1998 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1999 while (next) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2000 cur = next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2001 next = cur->next; |
15822 | 2002 if (PURPLE_BLIST_NODE_IS_BUDDY(cur)) { |
2003 purple_blist_add_buddy((PurpleBuddy *)cur, target, NULL, prev); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2004 prev = cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2005 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2006 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2007 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2008 |
15822 | 2009 void purple_blist_add_group(PurpleGroup *group, PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2010 { |
15822 | 2011 PurpleBlistUiOps *ops; |
2012 PurpleBlistNode *gnode = (PurpleBlistNode*)group; | |
27569
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2013 gchar* key; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2014 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2015 g_return_if_fail(group != NULL); |
15822 | 2016 g_return_if_fail(PURPLE_BLIST_NODE_IS_GROUP((PurpleBlistNode *)group)); |
2017 | |
2018 ops = purple_blist_get_ui_ops(); | |
2019 | |
28312
ec2782028fc5
Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28173
diff
changeset
|
2020 /* if we're moving to overtop of ourselves, do nothing */ |
ec2782028fc5
Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28173
diff
changeset
|
2021 if (gnode == node) { |
ec2782028fc5
Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28173
diff
changeset
|
2022 if (!purplebuddylist->root) |
ec2782028fc5
Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28173
diff
changeset
|
2023 node = NULL; |
ec2782028fc5
Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28173
diff
changeset
|
2024 else |
ec2782028fc5
Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28173
diff
changeset
|
2025 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2026 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2027 |
15822 | 2028 if (purple_find_group(group->name)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2029 /* This is just being moved */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2030 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2031 if (ops && ops->remove) |
15822 | 2032 ops->remove(purplebuddylist, (PurpleBlistNode *)group); |
2033 | |
2034 if (gnode == purplebuddylist->root) | |
2035 purplebuddylist->root = gnode->next; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2036 if (gnode->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2037 gnode->prev->next = gnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2038 if (gnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2039 gnode->next->prev = gnode->prev; |
27612
b419196556c7
corner case: the first group wasn't being put into the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
2040 } else { |
b419196556c7
corner case: the first group wasn't being put into the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
2041 key = g_utf8_collate_key(group->name, -1); |
b419196556c7
corner case: the first group wasn't being put into the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
2042 g_hash_table_insert(groups_cache, key, group); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2043 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2044 |
15822 | 2045 if (node && PURPLE_BLIST_NODE_IS_GROUP(node)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2046 gnode->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2047 gnode->prev = node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2048 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2049 node->next->prev = gnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2050 node->next = gnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2051 } else { |
15822 | 2052 if (purplebuddylist->root) |
2053 purplebuddylist->root->prev = gnode; | |
2054 gnode->next = purplebuddylist->root; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2055 gnode->prev = NULL; |
15822 | 2056 purplebuddylist->root = gnode; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2057 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2058 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2059 if (ops && ops->save_node) { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2060 ops->save_node(gnode); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2061 for (node = gnode->child; node; node = node->next) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2062 ops->save_node(node); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2063 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2064 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2065 if (ops && ops->update) { |
15822 | 2066 ops->update(purplebuddylist, gnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2067 for (node = gnode->child; node; node = node->next) |
15822 | 2068 ops->update(purplebuddylist, node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2069 } |
26796
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2070 |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2071 purple_signal_emit(purple_blist_get_handle(), "blist-node-added", |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2072 gnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2073 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2074 |
15822 | 2075 void purple_blist_remove_contact(PurpleContact *contact) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2076 { |
15822 | 2077 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2078 PurpleBlistNode *node, *gnode; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2079 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2080 g_return_if_fail(contact != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2081 |
15822 | 2082 node = (PurpleBlistNode *)contact; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2083 gnode = node->parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2084 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2085 if (node->child) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2086 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2087 * If this contact has children then remove them. When the last |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2088 * buddy is removed from the contact, the contact is automatically |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2089 * deleted. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2090 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2091 while (node->child->next) { |
15822 | 2092 purple_blist_remove_buddy((PurpleBuddy*)node->child); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2093 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2094 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2095 * Remove the last buddy and trigger the deletion of the contact. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2096 * It would probably be cleaner if contact-deletion was done after |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2097 * a timeout? Or if it had to be done manually, like below? |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2098 */ |
15822 | 2099 purple_blist_remove_buddy((PurpleBuddy*)node->child); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2100 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2101 /* Remove the node from its parent */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2102 if (gnode->child == node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2103 gnode->child = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2104 if (node->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2105 node->prev->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2106 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2107 node->next->prev = node->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2108 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2109 /* Update the UI */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2110 if (ops && ops->remove) |
15822 | 2111 ops->remove(purplebuddylist, node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2112 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2113 if (ops && ops->remove_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2114 ops->remove_node(node); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2115 |
26796
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2116 purple_signal_emit(purple_blist_get_handle(), "blist-node-removed", |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2117 PURPLE_BLIST_NODE(contact)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2118 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2119 /* Delete the node */ |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2120 purple_contact_destroy(contact); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2121 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2122 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2123 |
15822 | 2124 void purple_blist_remove_buddy(PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2125 { |
15822 | 2126 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2127 PurpleBlistNode *node, *cnode, *gnode; | |
2128 PurpleContact *contact; | |
2129 PurpleGroup *group; | |
2130 struct _purple_hbuddy hb; | |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2131 GHashTable *account_buddies; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2132 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2133 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2134 |
15822 | 2135 node = (PurpleBlistNode *)buddy; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2136 cnode = node->parent; |
17583
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2137 gnode = (cnode != NULL) ? cnode->parent : NULL; |
15822 | 2138 contact = (PurpleContact *)cnode; |
2139 group = (PurpleGroup *)gnode; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2140 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2141 /* Remove the node from its parent */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2142 if (node->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2143 node->prev->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2144 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2145 node->next->prev = node->prev; |
17583
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2146 if ((cnode != NULL) && (cnode->child == node)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2147 cnode->child = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2148 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2149 /* Adjust size counts */ |
17583
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2150 if (contact != NULL) { |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2151 if (PURPLE_BUDDY_IS_ONLINE(buddy)) { |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2152 contact->online--; |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2153 if (contact->online == 0) |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2154 group->online--; |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2155 } |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2156 if (purple_account_is_connected(buddy->account)) { |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2157 contact->currentsize--; |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2158 if (contact->currentsize == 0) |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2159 group->currentsize--; |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2160 } |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2161 contact->totalsize--; |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2162 |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2163 /* Re-sort the contact */ |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2164 if (cnode->child && contact->priority == buddy) { |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2165 purple_contact_invalidate_priority_buddy(contact); |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2166 if (ops && ops->update) |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2167 ops->update(purplebuddylist, cnode); |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2168 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2169 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2170 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2171 /* Remove this buddy from the buddies hash table */ |
27584
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
2172 hb.name = (gchar *)purple_normalize(buddy->account, buddy->name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2173 hb.account = buddy->account; |
17583
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2174 hb.group = gnode; |
15822 | 2175 g_hash_table_remove(purplebuddylist->buddies, &hb); |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2176 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2177 account_buddies = g_hash_table_lookup(buddies_cache, buddy->account); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2178 g_hash_table_remove(account_buddies, &hb); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2179 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2180 /* Update the UI */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2181 if (ops && ops->remove) |
15822 | 2182 ops->remove(purplebuddylist, node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2183 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2184 if (ops && ops->remove_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2185 ops->remove_node(node); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2186 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2187 /* Signal that the buddy has been removed before freeing the memory for it */ |
15822 | 2188 purple_signal_emit(purple_blist_get_handle(), "buddy-removed", buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2189 |
26796
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2190 purple_signal_emit(purple_blist_get_handle(), "blist-node-removed", |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2191 PURPLE_BLIST_NODE(buddy)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2192 |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2193 purple_buddy_destroy(buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2194 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2195 /* If the contact is empty then remove it */ |
17583
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16798
diff
changeset
|
2196 if ((contact != NULL) && !cnode->child) |
15822 | 2197 purple_blist_remove_contact(contact); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2198 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2199 |
15822 | 2200 void purple_blist_remove_chat(PurpleChat *chat) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2201 { |
15822 | 2202 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2203 PurpleBlistNode *node, *gnode; | |
2204 PurpleGroup *group; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2205 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2206 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2207 |
15822 | 2208 node = (PurpleBlistNode *)chat; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2209 gnode = node->parent; |
15822 | 2210 group = (PurpleGroup *)gnode; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2211 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2212 if (gnode != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2213 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2214 /* Remove the node from its parent */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2215 if (gnode->child == node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2216 gnode->child = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2217 if (node->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2218 node->prev->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2219 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2220 node->next->prev = node->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2221 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2222 /* Adjust size counts */ |
15822 | 2223 if (purple_account_is_connected(chat->account)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2224 group->online--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2225 group->currentsize--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2226 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2227 group->totalsize--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2228 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2229 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2230 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2231 /* Update the UI */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2232 if (ops && ops->remove) |
15822 | 2233 ops->remove(purplebuddylist, node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2234 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2235 if (ops && ops->remove_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2236 ops->remove_node(node); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2237 |
26796
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2238 purple_signal_emit(purple_blist_get_handle(), "blist-node-removed", |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2239 PURPLE_BLIST_NODE(chat)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2240 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2241 /* Delete the node */ |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2242 purple_chat_destroy(chat); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2243 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2244 |
15822 | 2245 void purple_blist_remove_group(PurpleGroup *group) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2246 { |
15822 | 2247 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2248 PurpleBlistNode *node; | |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2249 GList *l; |
27569
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2250 gchar* key; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2251 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2252 g_return_if_fail(group != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2253 |
15822 | 2254 node = (PurpleBlistNode *)group; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2255 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2256 /* Make sure the group is empty */ |
15678
5ec709327dc6
Remove a few unneeded strings, per evans's recommendation
Sean Egan <seanegan@gmail.com>
parents:
15420
diff
changeset
|
2257 if (node->child) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2258 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2259 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2260 /* Remove the node from its parent */ |
15822 | 2261 if (purplebuddylist->root == node) |
2262 purplebuddylist->root = node->next; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2263 if (node->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2264 node->prev->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2265 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2266 node->next->prev = node->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2267 |
27569
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2268 key = g_utf8_collate_key(group->name, -1); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2269 g_hash_table_remove(groups_cache, key); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2270 g_free(key); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2271 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2272 /* Update the UI */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2273 if (ops && ops->remove) |
15822 | 2274 ops->remove(purplebuddylist, node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2275 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2276 if (ops && ops->remove_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2277 ops->remove_node(node); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2278 |
26796
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2279 purple_signal_emit(purple_blist_get_handle(), "blist-node-removed", |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2280 PURPLE_BLIST_NODE(group)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
2281 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2282 /* Remove the group from all accounts that are online */ |
15822 | 2283 for (l = purple_connections_get_all(); l != NULL; l = l->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2284 { |
15822 | 2285 PurpleConnection *gc = (PurpleConnection *)l->data; |
2286 | |
2287 if (purple_connection_get_state(gc) == PURPLE_CONNECTED) | |
2288 purple_account_remove_group(purple_connection_get_account(gc), group); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2289 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2290 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2291 /* Delete the node */ |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2292 purple_group_destroy(group); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2293 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2294 |
15822 | 2295 PurpleBuddy *purple_contact_get_priority_buddy(PurpleContact *contact) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2296 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2297 g_return_val_if_fail(contact != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2298 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2299 if (!contact->priority_valid) |
15822 | 2300 purple_contact_compute_priority_buddy(contact); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2301 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2302 return contact->priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2303 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2304 |
15822 | 2305 const char *purple_buddy_get_alias_only(PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2306 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2307 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2308 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2309 if ((buddy->alias != NULL) && (*buddy->alias != '\0')) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2310 return buddy->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2311 } else if ((buddy->server_alias != NULL) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2312 (*buddy->server_alias != '\0')) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2313 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2314 return buddy->server_alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2315 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2316 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2317 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2318 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2319 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2320 |
15822 | 2321 const char *purple_buddy_get_contact_alias(PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2322 { |
15822 | 2323 PurpleContact *c; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2324 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2325 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2326 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2327 /* Search for an alias for the buddy. In order of precedence: */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2328 /* The buddy alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2329 if (buddy->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2330 return buddy->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2331 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2332 /* The contact alias */ |
15822 | 2333 c = purple_buddy_get_contact(buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2334 if ((c != NULL) && (c->alias != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2335 return c->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2336 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2337 /* The server alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2338 if ((buddy->server_alias) && (*buddy->server_alias)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2339 return buddy->server_alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2340 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2341 /* The buddy's user name (i.e. no alias) */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2342 return buddy->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2343 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2344 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2345 |
15822 | 2346 const char *purple_buddy_get_alias(PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2347 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2348 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2349 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2350 /* Search for an alias for the buddy. In order of precedence: */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2351 /* The buddy alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2352 if (buddy->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2353 return buddy->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2354 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2355 /* The server alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2356 if ((buddy->server_alias) && (*buddy->server_alias)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2357 return buddy->server_alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2358 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2359 /* The buddy's user name (i.e. no alias) */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2360 return buddy->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2361 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2362 |
25803
8aa7d8bcbc7d
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25797
diff
changeset
|
2363 const char *purple_buddy_get_local_buddy_alias(PurpleBuddy *buddy) |
8aa7d8bcbc7d
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25797
diff
changeset
|
2364 { |
8aa7d8bcbc7d
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25797
diff
changeset
|
2365 g_return_val_if_fail(buddy, NULL); |
8aa7d8bcbc7d
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25797
diff
changeset
|
2366 return buddy->alias; |
8aa7d8bcbc7d
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25797
diff
changeset
|
2367 } |
8aa7d8bcbc7d
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25797
diff
changeset
|
2368 |
15822 | 2369 const char *purple_buddy_get_server_alias(PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2370 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2371 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2372 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2373 if ((buddy->server_alias) && (*buddy->server_alias)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2374 return buddy->server_alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2375 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2376 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2377 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2378 |
15822 | 2379 const char *purple_buddy_get_local_alias(PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2380 { |
15822 | 2381 PurpleContact *c; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2382 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2383 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2384 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2385 /* Search for an alias for the buddy. In order of precedence: */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2386 /* The buddy alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2387 if (buddy->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2388 return buddy->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2389 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2390 /* The contact alias */ |
15822 | 2391 c = purple_buddy_get_contact(buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2392 if ((c != NULL) && (c->alias != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2393 return c->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2394 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2395 /* The buddy's user name (i.e. no alias) */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2396 return buddy->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2397 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2398 |
15822 | 2399 const char *purple_chat_get_name(PurpleChat *chat) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2400 { |
22920
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2401 char *ret = NULL; |
16770
8a5fe6db7750
We don't really need an active connection to get the name of a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16768
diff
changeset
|
2402 PurplePlugin *prpl; |
8a5fe6db7750
We don't really need an active connection to get the name of a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16768
diff
changeset
|
2403 PurplePluginProtocolInfo *prpl_info = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2404 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2405 g_return_val_if_fail(chat != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2406 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2407 if ((chat->alias != NULL) && (*chat->alias != '\0')) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2408 return chat->alias; |
16770
8a5fe6db7750
We don't really need an active connection to get the name of a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16768
diff
changeset
|
2409 |
8a5fe6db7750
We don't really need an active connection to get the name of a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16768
diff
changeset
|
2410 prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account)); |
8a5fe6db7750
We don't really need an active connection to get the name of a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16768
diff
changeset
|
2411 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
8a5fe6db7750
We don't really need an active connection to get the name of a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16768
diff
changeset
|
2412 |
22920
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2413 if (prpl_info->chat_info) { |
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2414 struct proto_chat_entry *pce; |
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2415 GList *parts = prpl_info->chat_info(purple_account_get_connection(chat->account)); |
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2416 pce = parts->data; |
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2417 ret = g_hash_table_lookup(chat->components, pce->identifier); |
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2418 g_list_foreach(parts, (GFunc)g_free, NULL); |
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2419 g_list_free(parts); |
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2420 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2421 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2422 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2423 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2424 |
15822 | 2425 PurpleBuddy *purple_find_buddy(PurpleAccount *account, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2426 { |
15822 | 2427 PurpleBuddy *buddy; |
2428 struct _purple_hbuddy hb; | |
2429 PurpleBlistNode *group; | |
2430 | |
2431 g_return_val_if_fail(purplebuddylist != NULL, NULL); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2432 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2433 g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2434 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2435 hb.account = account; |
27503 | 2436 hb.name = (gchar *)purple_normalize(account, name); |
15822 | 2437 |
2438 for (group = purplebuddylist->root; group; group = group->next) { | |
27705
12ab4c1112e5
Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents:
27704
diff
changeset
|
2439 if (!group->child) |
12ab4c1112e5
Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents:
27704
diff
changeset
|
2440 continue; |
12ab4c1112e5
Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents:
27704
diff
changeset
|
2441 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2442 hb.group = group; |
15822 | 2443 if ((buddy = g_hash_table_lookup(purplebuddylist->buddies, &hb))) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2444 return buddy; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2445 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2446 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2447 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2448 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2449 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2450 |
15822 | 2451 PurpleBuddy *purple_find_buddy_in_group(PurpleAccount *account, const char *name, |
2452 PurpleGroup *group) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2453 { |
15822 | 2454 struct _purple_hbuddy hb; |
2455 | |
2456 g_return_val_if_fail(purplebuddylist != NULL, NULL); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2457 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2458 g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2459 |
27584
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
2460 hb.name = (gchar *)purple_normalize(account, name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2461 hb.account = account; |
15822 | 2462 hb.group = (PurpleBlistNode*)group; |
2463 | |
27584
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
2464 return g_hash_table_lookup(purplebuddylist->buddies, &hb); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2465 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2466 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2467 static void find_acct_buddies(gpointer key, gpointer value, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2468 { |
15822 | 2469 PurpleBuddy *buddy = value; |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2470 GSList **list = data; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2471 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2472 *list = g_slist_prepend(*list, buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2473 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2474 |
15822 | 2475 GSList *purple_find_buddies(PurpleAccount *account, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2476 { |
15822 | 2477 PurpleBuddy *buddy; |
2478 PurpleBlistNode *node; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2479 GSList *ret = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2480 |
15822 | 2481 g_return_val_if_fail(purplebuddylist != NULL, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2482 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2483 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2484 if ((name != NULL) && (*name != '\0')) { |
15822 | 2485 struct _purple_hbuddy hb; |
2486 | |
27584
b84f51988365
Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents:
27569
diff
changeset
|
2487 hb.name = (gchar *)purple_normalize(account, name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2488 hb.account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2489 |
15822 | 2490 for (node = purplebuddylist->root; node != NULL; node = node->next) { |
27705
12ab4c1112e5
Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents:
27704
diff
changeset
|
2491 if (!node->child) |
12ab4c1112e5
Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents:
27704
diff
changeset
|
2492 continue; |
12ab4c1112e5
Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents:
27704
diff
changeset
|
2493 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2494 hb.group = node; |
15822 | 2495 if ((buddy = g_hash_table_lookup(purplebuddylist->buddies, &hb)) != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2496 ret = g_slist_prepend(ret, buddy); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2497 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2498 } else { |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2499 GSList *list = NULL; |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2500 GHashTable *buddies = g_hash_table_lookup(buddies_cache, account); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2501 g_hash_table_foreach(buddies, find_acct_buddies, &list); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
2502 ret = list; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2503 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2504 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2505 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2506 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2507 |
15822 | 2508 PurpleGroup *purple_find_group(const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2509 { |
27569
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2510 gchar* key; |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2511 PurpleGroup *group; |
15822 | 2512 |
2513 g_return_val_if_fail(purplebuddylist != NULL, NULL); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2514 g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2515 |
27569
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2516 key = g_utf8_collate_key(name, -1); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2517 group = g_hash_table_lookup(groups_cache, key); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2518 g_free(key); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2519 |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
2520 return group; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2521 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2522 |
15822 | 2523 PurpleChat * |
2524 purple_blist_find_chat(PurpleAccount *account, const char *name) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2525 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2526 char *chat_name; |
15822 | 2527 PurpleChat *chat; |
2528 PurplePlugin *prpl; | |
2529 PurplePluginProtocolInfo *prpl_info = NULL; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2530 struct proto_chat_entry *pce; |
15822 | 2531 PurpleBlistNode *node, *group; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2532 GList *parts; |
24444
123c78e48663
Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24350
diff
changeset
|
2533 char *normname; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2534 |
15822 | 2535 g_return_val_if_fail(purplebuddylist != NULL, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2536 g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2537 |
15822 | 2538 if (!purple_account_is_connected(account)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2539 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2540 |
15822 | 2541 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
2542 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2543 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2544 if (prpl_info->find_blist_chat != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2545 return prpl_info->find_blist_chat(account, name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2546 |
24444
123c78e48663
Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24350
diff
changeset
|
2547 normname = g_strdup(purple_normalize(account, name)); |
15822 | 2548 for (group = purplebuddylist->root; group != NULL; group = group->next) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2549 for (node = group->child; node != NULL; node = node->next) { |
15822 | 2550 if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
2551 | |
2552 chat = (PurpleChat*)node; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2553 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2554 if (account != chat->account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2555 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2556 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2557 parts = prpl_info->chat_info( |
15822 | 2558 purple_account_get_connection(chat->account)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2559 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2560 pce = parts->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2561 chat_name = g_hash_table_lookup(chat->components, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2562 pce->identifier); |
22694
04dc38d726fb
Leak fix. This is probably quite serious if you have busy chats on your
Stu Tomlinson <stu@nosnilmot.com>
parents:
22327
diff
changeset
|
2563 g_list_foreach(parts, (GFunc)g_free, NULL); |
04dc38d726fb
Leak fix. This is probably quite serious if you have busy chats on your
Stu Tomlinson <stu@nosnilmot.com>
parents:
22327
diff
changeset
|
2564 g_list_free(parts); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2565 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2566 if (chat->account == account && chat_name != NULL && |
24444
123c78e48663
Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24350
diff
changeset
|
2567 normname != NULL && !strcmp(purple_normalize(account, chat_name), normname)) { |
123c78e48663
Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24350
diff
changeset
|
2568 g_free(normname); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2569 return chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2570 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2571 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2572 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2573 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2574 |
24444
123c78e48663
Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24350
diff
changeset
|
2575 g_free(normname); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2576 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2577 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2578 |
15822 | 2579 PurpleGroup * |
2580 purple_chat_get_group(PurpleChat *chat) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2581 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2582 g_return_val_if_fail(chat != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2583 |
15822 | 2584 return (PurpleGroup *)(((PurpleBlistNode *)chat)->parent); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2585 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2586 |
22169
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2587 PurpleAccount * |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2588 purple_chat_get_account(PurpleChat *chat) |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2589 { |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2590 g_return_val_if_fail(chat != NULL, NULL); |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2591 |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2592 return chat->account; |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2593 } |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2594 |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
2595 GHashTable * |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
2596 purple_chat_get_components(PurpleChat *chat) |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
2597 { |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
2598 g_return_val_if_fail(chat != NULL, NULL); |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
2599 |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
2600 return chat->components; |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
2601 } |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
2602 |
15822 | 2603 PurpleContact *purple_buddy_get_contact(PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2604 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2605 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2606 |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25821
diff
changeset
|
2607 return PURPLE_CONTACT(PURPLE_BLIST_NODE(buddy)->parent); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2608 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2609 |
15822 | 2610 PurplePresence *purple_buddy_get_presence(const PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2611 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2612 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2613 return buddy->presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2614 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2615 |
29333
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2616 PurpleMediaCaps purple_buddy_get_media_caps(const PurpleBuddy *buddy) |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2617 { |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2618 g_return_val_if_fail(buddy != NULL, 0); |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2619 return buddy->media_caps; |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2620 } |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2621 |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2622 void purple_buddy_set_media_caps(PurpleBuddy *buddy, PurpleMediaCaps media_caps) |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2623 { |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2624 g_return_if_fail(buddy != NULL); |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2625 buddy->media_caps = media_caps; |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2626 } |
4055d0f7f1ea
added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
29133
diff
changeset
|
2627 |
15822 | 2628 PurpleGroup *purple_buddy_get_group(PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2629 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2630 g_return_val_if_fail(buddy != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2631 |
15822 | 2632 if (((PurpleBlistNode *)buddy)->parent == NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2633 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2634 |
15822 | 2635 return (PurpleGroup *)(((PurpleBlistNode*)buddy)->parent->parent); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2636 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2637 |
15822 | 2638 GSList *purple_group_get_accounts(PurpleGroup *group) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2639 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2640 GSList *l = NULL; |
15822 | 2641 PurpleBlistNode *gnode, *cnode, *bnode; |
2642 | |
2643 gnode = (PurpleBlistNode *)group; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2644 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2645 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
15822 | 2646 if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { |
2647 if (!g_slist_find(l, ((PurpleChat *)cnode)->account)) | |
2648 l = g_slist_append(l, ((PurpleChat *)cnode)->account); | |
2649 } else if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2650 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
15822 | 2651 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) { |
2652 if (!g_slist_find(l, ((PurpleBuddy *)bnode)->account)) | |
2653 l = g_slist_append(l, ((PurpleBuddy *)bnode)->account); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2654 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2655 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2656 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2657 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2658 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2659 return l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2660 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2661 |
15822 | 2662 void purple_blist_add_account(PurpleAccount *account) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2663 { |
15822 | 2664 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2665 PurpleBlistNode *gnode, *cnode, *bnode; | |
2666 | |
2667 g_return_if_fail(purplebuddylist != NULL); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2668 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2669 if (!ops || !ops->update) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2670 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2671 |
15822 | 2672 for (gnode = purplebuddylist->root; gnode; gnode = gnode->next) { |
2673 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2674 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2675 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
15822 | 2676 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2677 gboolean recompute = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2678 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
15822 | 2679 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode) && |
2680 ((PurpleBuddy*)bnode)->account == account) { | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2681 recompute = TRUE; |
15822 | 2682 ((PurpleContact*)cnode)->currentsize++; |
2683 if (((PurpleContact*)cnode)->currentsize == 1) | |
2684 ((PurpleGroup*)gnode)->currentsize++; | |
2685 ops->update(purplebuddylist, bnode); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2686 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2687 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2688 if (recompute || |
15822 | 2689 purple_blist_node_get_bool(cnode, "show_offline")) { |
2690 purple_contact_invalidate_priority_buddy((PurpleContact*)cnode); | |
2691 ops->update(purplebuddylist, cnode); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2692 } |
15822 | 2693 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode) && |
2694 ((PurpleChat*)cnode)->account == account) { | |
2695 ((PurpleGroup *)gnode)->online++; | |
2696 ((PurpleGroup *)gnode)->currentsize++; | |
2697 ops->update(purplebuddylist, cnode); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2698 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2699 } |
15822 | 2700 ops->update(purplebuddylist, gnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2701 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2702 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2703 |
15822 | 2704 void purple_blist_remove_account(PurpleAccount *account) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2705 { |
15822 | 2706 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2707 PurpleBlistNode *gnode, *cnode, *bnode; | |
2708 PurpleBuddy *buddy; | |
2709 PurpleChat *chat; | |
2710 PurpleContact *contact; | |
2711 PurpleGroup *group; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2712 GList *list = NULL, *iter = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2713 |
15822 | 2714 g_return_if_fail(purplebuddylist != NULL); |
2715 | |
2716 for (gnode = purplebuddylist->root; gnode; gnode = gnode->next) { | |
2717 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2718 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2719 |
15822 | 2720 group = (PurpleGroup *)gnode; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2721 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2722 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
15822 | 2723 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2724 gboolean recompute = FALSE; |
15822 | 2725 contact = (PurpleContact *)cnode; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2726 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2727 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
15822 | 2728 if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2729 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2730 |
15822 | 2731 buddy = (PurpleBuddy *)bnode; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2732 if (account == buddy->account) { |
15822 | 2733 PurplePresence *presence; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2734 |
15822 | 2735 presence = purple_buddy_get_presence(buddy); |
2736 | |
2737 if(purple_presence_is_online(presence)) { | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2738 contact->online--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2739 if (contact->online == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2740 group->online--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2741 |
15822 | 2742 purple_blist_node_set_int(&buddy->node, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2743 "last_seen", time(NULL)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2744 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2745 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2746 contact->currentsize--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2747 if (contact->currentsize == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2748 group->currentsize--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2749 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2750 if (!g_list_find(list, presence)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2751 list = g_list_prepend(list, presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2752 |
16510
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
2753 if (contact->priority == buddy) |
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
2754 purple_contact_invalidate_priority_buddy(contact); |
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
2755 else |
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
2756 recompute = TRUE; |
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
2757 |
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
2758 if (ops && ops->remove) { |
15822 | 2759 ops->remove(purplebuddylist, bnode); |
16510
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
2760 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2761 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2762 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2763 if (recompute) { |
15822 | 2764 purple_contact_invalidate_priority_buddy(contact); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2765 if (ops && ops->update) |
15822 | 2766 ops->update(purplebuddylist, cnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2767 } |
15822 | 2768 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { |
2769 chat = (PurpleChat *)cnode; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2770 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2771 if(chat->account == account) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2772 group->currentsize--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2773 group->online--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2774 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2775 if (ops && ops->remove) |
15822 | 2776 ops->remove(purplebuddylist, cnode); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2777 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2778 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2779 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2780 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2781 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2782 for (iter = list; iter; iter = iter->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2783 { |
15822 | 2784 purple_presence_set_status_active(iter->data, "offline", TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2785 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2786 g_list_free(list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2787 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2788 |
15822 | 2789 gboolean purple_group_on_account(PurpleGroup *g, PurpleAccount *account) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2790 { |
15822 | 2791 PurpleBlistNode *cnode; |
2792 for (cnode = ((PurpleBlistNode *)g)->child; cnode; cnode = cnode->next) { | |
2793 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { | |
2794 if(purple_contact_on_account((PurpleContact *) cnode, account)) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2795 return TRUE; |
15822 | 2796 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { |
2797 PurpleChat *chat = (PurpleChat *)cnode; | |
2798 if ((!account && purple_account_is_connected(chat->account)) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2799 || chat->account == account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2800 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2801 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2802 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2803 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2804 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2805 |
16768
52342adf4303
Add a missing function useful for dbus clients, requested by Andrey Kostenko. And fix a crash from badly written dbus code.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16631
diff
changeset
|
2806 const char *purple_group_get_name(PurpleGroup *group) |
52342adf4303
Add a missing function useful for dbus clients, requested by Andrey Kostenko. And fix a crash from badly written dbus code.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16631
diff
changeset
|
2807 { |
52342adf4303
Add a missing function useful for dbus clients, requested by Andrey Kostenko. And fix a crash from badly written dbus code.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16631
diff
changeset
|
2808 g_return_val_if_fail(group != NULL, NULL); |
52342adf4303
Add a missing function useful for dbus clients, requested by Andrey Kostenko. And fix a crash from badly written dbus code.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16631
diff
changeset
|
2809 |
52342adf4303
Add a missing function useful for dbus clients, requested by Andrey Kostenko. And fix a crash from badly written dbus code.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16631
diff
changeset
|
2810 return group->name; |
52342adf4303
Add a missing function useful for dbus clients, requested by Andrey Kostenko. And fix a crash from badly written dbus code.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16631
diff
changeset
|
2811 } |
52342adf4303
Add a missing function useful for dbus clients, requested by Andrey Kostenko. And fix a crash from badly written dbus code.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16631
diff
changeset
|
2812 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2813 void |
15822 | 2814 purple_blist_request_add_buddy(PurpleAccount *account, const char *username, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2815 const char *group, const char *alias) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2816 { |
15822 | 2817 PurpleBlistUiOps *ui_ops; |
2818 | |
2819 ui_ops = purple_blist_get_ui_ops(); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2820 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2821 if (ui_ops != NULL && ui_ops->request_add_buddy != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2822 ui_ops->request_add_buddy(account, username, group, alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2823 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2824 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2825 void |
15822 | 2826 purple_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2827 const char *alias, const char *name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2828 { |
15822 | 2829 PurpleBlistUiOps *ui_ops; |
2830 | |
2831 ui_ops = purple_blist_get_ui_ops(); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2832 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2833 if (ui_ops != NULL && ui_ops->request_add_chat != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2834 ui_ops->request_add_chat(account, group, alias, name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2835 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2836 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2837 void |
15822 | 2838 purple_blist_request_add_group(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2839 { |
15822 | 2840 PurpleBlistUiOps *ui_ops; |
2841 | |
2842 ui_ops = purple_blist_get_ui_ops(); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2843 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2844 if (ui_ops != NULL && ui_ops->request_add_group != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2845 ui_ops->request_add_group(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2846 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2847 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2848 static void |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2849 purple_blist_node_destroy(PurpleBlistNode *node) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2850 { |
26817
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26796
diff
changeset
|
2851 PurpleBlistUiOps *ui_ops; |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2852 PurpleBlistNode *child, *next_child; |
26540
384eaba9974e
Reset some global data when uninit-ing. Fixes a crash on quit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26527
diff
changeset
|
2853 |
26817
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26796
diff
changeset
|
2854 ui_ops = purple_blist_get_ui_ops(); |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2855 child = node->child; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2856 while (child) { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2857 next_child = child->next; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2858 purple_blist_node_destroy(child); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2859 child = next_child; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2860 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2861 |
26817
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26796
diff
changeset
|
2862 /* Allow the UI to free data */ |
26819
73eeb91911f3
Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents:
26817
diff
changeset
|
2863 node->parent = NULL; |
73eeb91911f3
Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents:
26817
diff
changeset
|
2864 node->child = NULL; |
73eeb91911f3
Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents:
26817
diff
changeset
|
2865 node->next = NULL; |
73eeb91911f3
Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents:
26817
diff
changeset
|
2866 node->prev = NULL; |
26817
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26796
diff
changeset
|
2867 if (ui_ops && ui_ops->remove) |
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26796
diff
changeset
|
2868 ui_ops->remove(purplebuddylist, node); |
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26796
diff
changeset
|
2869 |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2870 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2871 purple_buddy_destroy((PurpleBuddy*)node); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2872 else if (PURPLE_BLIST_NODE_IS_CHAT(node)) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2873 purple_chat_destroy((PurpleChat*)node); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2874 else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2875 purple_contact_destroy((PurpleContact*)node); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2876 else if (PURPLE_BLIST_NODE_IS_GROUP(node)) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2877 purple_group_destroy((PurpleGroup*)node); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2878 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2879 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
2880 static void |
15822 | 2881 purple_blist_node_setting_free(gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2882 { |
15822 | 2883 PurpleValue *value; |
2884 | |
2885 value = (PurpleValue *)data; | |
2886 | |
2887 purple_value_destroy(value); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2888 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2889 |
15822 | 2890 static void purple_blist_node_initialize_settings(PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2891 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2892 if (node->settings) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2893 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2894 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2895 node->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
15822 | 2896 (GDestroyNotify)purple_blist_node_setting_free); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2897 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2898 |
15822 | 2899 void purple_blist_node_remove_setting(PurpleBlistNode *node, const char *key) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2900 { |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2901 PurpleBlistUiOps *ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2902 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2903 g_return_if_fail(node->settings != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2904 g_return_if_fail(key != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2905 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2906 g_hash_table_remove(node->settings, key); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2907 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2908 ops = purple_blist_get_ui_ops(); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2909 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2910 ops->save_node(node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2911 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2912 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2913 void |
15822 | 2914 purple_blist_node_set_flags(PurpleBlistNode *node, PurpleBlistNodeFlags flags) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2915 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2916 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2917 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2918 node->flags = flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2919 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2920 |
15822 | 2921 PurpleBlistNodeFlags |
2922 purple_blist_node_get_flags(PurpleBlistNode *node) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2923 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2924 g_return_val_if_fail(node != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2925 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2926 return node->flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2927 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2928 |
17818
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16798
diff
changeset
|
2929 PurpleBlistNodeType |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16798
diff
changeset
|
2930 purple_blist_node_get_type(PurpleBlistNode *node) |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16798
diff
changeset
|
2931 { |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16798
diff
changeset
|
2932 g_return_val_if_fail(node != NULL, PURPLE_BLIST_OTHER_NODE); |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16798
diff
changeset
|
2933 return node->type; |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16798
diff
changeset
|
2934 } |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16798
diff
changeset
|
2935 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2936 void |
15822 | 2937 purple_blist_node_set_bool(PurpleBlistNode* node, const char *key, gboolean data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2938 { |
15822 | 2939 PurpleValue *value; |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2940 PurpleBlistUiOps *ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2941 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2942 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2943 g_return_if_fail(node->settings != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2944 g_return_if_fail(key != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2945 |
15822 | 2946 value = purple_value_new(PURPLE_TYPE_BOOLEAN); |
2947 purple_value_set_boolean(value, data); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2948 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2949 g_hash_table_replace(node->settings, g_strdup(key), value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2950 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2951 ops = purple_blist_get_ui_ops(); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2952 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2953 ops->save_node(node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2954 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2955 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2956 gboolean |
15822 | 2957 purple_blist_node_get_bool(PurpleBlistNode* node, const char *key) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2958 { |
15822 | 2959 PurpleValue *value; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2960 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2961 g_return_val_if_fail(node != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2962 g_return_val_if_fail(node->settings != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2963 g_return_val_if_fail(key != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2964 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2965 value = g_hash_table_lookup(node->settings, key); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2966 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2967 if (value == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2968 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2969 |
15822 | 2970 g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN, FALSE); |
2971 | |
2972 return purple_value_get_boolean(value); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2973 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2974 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2975 void |
15822 | 2976 purple_blist_node_set_int(PurpleBlistNode* node, const char *key, int data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2977 { |
15822 | 2978 PurpleValue *value; |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2979 PurpleBlistUiOps *ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2980 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2981 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2982 g_return_if_fail(node->settings != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2983 g_return_if_fail(key != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2984 |
15822 | 2985 value = purple_value_new(PURPLE_TYPE_INT); |
2986 purple_value_set_int(value, data); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2987 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2988 g_hash_table_replace(node->settings, g_strdup(key), value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2989 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2990 ops = purple_blist_get_ui_ops(); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2991 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
2992 ops->save_node(node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2993 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2994 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2995 int |
15822 | 2996 purple_blist_node_get_int(PurpleBlistNode* node, const char *key) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2997 { |
15822 | 2998 PurpleValue *value; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2999 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3000 g_return_val_if_fail(node != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3001 g_return_val_if_fail(node->settings != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3002 g_return_val_if_fail(key != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3003 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3004 value = g_hash_table_lookup(node->settings, key); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3005 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3006 if (value == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3007 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3008 |
15822 | 3009 g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_INT, 0); |
3010 | |
3011 return purple_value_get_int(value); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3012 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3013 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3014 void |
15822 | 3015 purple_blist_node_set_string(PurpleBlistNode* node, const char *key, const char *data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3016 { |
15822 | 3017 PurpleValue *value; |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3018 PurpleBlistUiOps *ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3019 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3020 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3021 g_return_if_fail(node->settings != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3022 g_return_if_fail(key != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3023 |
15822 | 3024 value = purple_value_new(PURPLE_TYPE_STRING); |
3025 purple_value_set_string(value, data); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3026 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3027 g_hash_table_replace(node->settings, g_strdup(key), value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3028 |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3029 ops = purple_blist_get_ui_ops(); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3030 if (ops && ops->save_node) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3031 ops->save_node(node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3032 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3033 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3034 const char * |
15822 | 3035 purple_blist_node_get_string(PurpleBlistNode* node, const char *key) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3036 { |
15822 | 3037 PurpleValue *value; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3038 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3039 g_return_val_if_fail(node != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3040 g_return_val_if_fail(node->settings != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3041 g_return_val_if_fail(key != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3042 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3043 value = g_hash_table_lookup(node->settings, key); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3044 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3045 if (value == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3046 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3047 |
15822 | 3048 g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_STRING, NULL); |
3049 | |
3050 return purple_value_get_string(value); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3051 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3052 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3053 GList * |
15822 | 3054 purple_blist_node_get_extended_menu(PurpleBlistNode *n) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3055 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3056 GList *menu = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3057 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3058 g_return_val_if_fail(n != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3059 |
15822 | 3060 purple_signal_emit(purple_blist_get_handle(), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3061 "blist-node-extended-menu", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3062 n, &menu); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3063 return menu; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3064 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3065 |
15822 | 3066 int purple_blist_get_group_size(PurpleGroup *group, gboolean offline) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3067 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3068 if (!group) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3069 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3070 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3071 return offline ? group->totalsize : group->currentsize; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3072 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3073 |
15822 | 3074 int purple_blist_get_group_online_count(PurpleGroup *group) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3075 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3076 if (!group) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3077 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3078 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3079 return group->online; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3080 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3081 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3082 void |
15822 | 3083 purple_blist_set_ui_ops(PurpleBlistUiOps *ops) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3084 { |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3085 gboolean overrode = FALSE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3086 blist_ui_ops = ops; |
27704
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3087 |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3088 if (!ops) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3089 return; |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3090 |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3091 if (!ops->save_node) { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3092 ops->save_node = purple_blist_save_node; |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3093 overrode = TRUE; |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3094 } |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3095 if (!ops->remove_node) { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3096 ops->remove_node = purple_blist_save_node; |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3097 overrode = TRUE; |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3098 } |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3099 if (!ops->save_account) { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3100 ops->save_account = purple_blist_save_account; |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3101 overrode = TRUE; |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3102 } |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3103 |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3104 if (overrode && (ops->save_node != purple_blist_save_node || |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3105 ops->remove_node != purple_blist_save_node || |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3106 ops->save_account != purple_blist_save_account)) { |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3107 purple_debug_warning("blist", "Only some of the blist saving UI ops " |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3108 "were overridden. This probably is not what you want!\n"); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27665
diff
changeset
|
3109 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3110 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3111 |
15822 | 3112 PurpleBlistUiOps * |
3113 purple_blist_get_ui_ops(void) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3114 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3115 return blist_ui_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3116 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3117 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3118 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3119 void * |
15822 | 3120 purple_blist_get_handle(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3121 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3122 static int handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3123 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3124 return &handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3125 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3126 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3127 void |
15822 | 3128 purple_blist_init(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3129 { |
15822 | 3130 void *handle = purple_blist_get_handle(); |
3131 | |
3132 purple_signal_register(handle, "buddy-status-changed", | |
3133 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3134 3, |
15822 | 3135 purple_value_new(PURPLE_TYPE_SUBTYPE, |
3136 PURPLE_SUBTYPE_BLIST_BUDDY), | |
3137 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3138 PURPLE_SUBTYPE_STATUS), | |
3139 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3140 PURPLE_SUBTYPE_STATUS)); | |
3141 purple_signal_register(handle, "buddy-privacy-changed", | |
3142 purple_marshal_VOID__POINTER, NULL, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3143 1, |
15822 | 3144 purple_value_new(PURPLE_TYPE_SUBTYPE, |
3145 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3146 | |
3147 purple_signal_register(handle, "buddy-idle-changed", | |
3148 purple_marshal_VOID__POINTER_INT_INT, NULL, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3149 3, |
15822 | 3150 purple_value_new(PURPLE_TYPE_SUBTYPE, |
3151 PURPLE_SUBTYPE_BLIST_BUDDY), | |
3152 purple_value_new(PURPLE_TYPE_INT), | |
3153 purple_value_new(PURPLE_TYPE_INT)); | |
3154 | |
3155 | |
3156 purple_signal_register(handle, "buddy-signed-on", | |
3157 purple_marshal_VOID__POINTER, NULL, 1, | |
3158 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3159 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3160 | |
3161 purple_signal_register(handle, "buddy-signed-off", | |
3162 purple_marshal_VOID__POINTER, NULL, 1, | |
3163 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3164 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3165 | |
3166 purple_signal_register(handle, "buddy-got-login-time", | |
3167 purple_marshal_VOID__POINTER, NULL, 1, | |
3168 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3169 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3170 | |
26796
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
3171 purple_signal_register(handle, "blist-node-added", |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
3172 purple_marshal_VOID__POINTER, NULL, 1, |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
3173 purple_value_new(PURPLE_TYPE_SUBTYPE, |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
3174 PURPLE_SUBTYPE_BLIST_NODE)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
3175 |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
3176 purple_signal_register(handle, "blist-node-removed", |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
3177 purple_marshal_VOID__POINTER, NULL, 1, |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
3178 purple_value_new(PURPLE_TYPE_SUBTYPE, |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
3179 PURPLE_SUBTYPE_BLIST_NODE)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26764
diff
changeset
|
3180 |
15822 | 3181 purple_signal_register(handle, "buddy-added", |
3182 purple_marshal_VOID__POINTER, NULL, 1, | |
3183 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3184 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3185 | |
3186 purple_signal_register(handle, "buddy-removed", | |
3187 purple_marshal_VOID__POINTER, NULL, 1, | |
3188 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3189 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3190 | |
3191 purple_signal_register(handle, "buddy-icon-changed", | |
3192 purple_marshal_VOID__POINTER, NULL, 1, | |
3193 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3194 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3195 | |
3196 purple_signal_register(handle, "update-idle", purple_marshal_VOID, NULL, 0); | |
3197 | |
3198 purple_signal_register(handle, "blist-node-extended-menu", | |
3199 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
3200 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3201 PURPLE_SUBTYPE_BLIST_NODE), | |
3202 purple_value_new(PURPLE_TYPE_BOXED, "GList **")); | |
3203 | |
3204 purple_signal_register(handle, "blist-node-aliased", | |
3205 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
3206 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3207 PURPLE_SUBTYPE_BLIST_NODE), | |
3208 purple_value_new(PURPLE_TYPE_STRING)); | |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3209 |
29133
c855d321fc78
Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents:
28312
diff
changeset
|
3210 purple_signal_register(handle, "buddy-caps-changed", |
c855d321fc78
Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents:
28312
diff
changeset
|
3211 purple_marshal_VOID__POINTER_INT_INT, NULL, |
c855d321fc78
Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents:
28312
diff
changeset
|
3212 3, purple_value_new(PURPLE_TYPE_SUBTYPE, |
c855d321fc78
Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents:
28312
diff
changeset
|
3213 PURPLE_SUBTYPE_BLIST_BUDDY), |
c855d321fc78
Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents:
28312
diff
changeset
|
3214 purple_value_new(PURPLE_TYPE_INT), |
c855d321fc78
Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents:
28312
diff
changeset
|
3215 purple_value_new(PURPLE_TYPE_INT)); |
c855d321fc78
Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents:
28312
diff
changeset
|
3216 |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3217 purple_signal_connect(purple_accounts_get_handle(), "account-created", |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3218 handle, |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3219 PURPLE_CALLBACK(purple_blist_buddies_cache_add_account), |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3220 NULL); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3221 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3222 purple_signal_connect(purple_accounts_get_handle(), "account-destroying", |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3223 handle, |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3224 PURPLE_CALLBACK(purple_blist_buddies_cache_remove_account), |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3225 NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3226 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3227 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3228 void |
15822 | 3229 purple_blist_uninit(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3230 { |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
3231 PurpleBlistNode *node, *next_node; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
3232 |
26817
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26796
diff
changeset
|
3233 /* This happens if we quit before purple_set_blist is called. */ |
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26796
diff
changeset
|
3234 if (purplebuddylist == NULL) |
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26796
diff
changeset
|
3235 return; |
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26796
diff
changeset
|
3236 |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
3237 if (save_timer != 0) { |
15822 | 3238 purple_timeout_remove(save_timer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3239 save_timer = 0; |
15822 | 3240 purple_blist_sync(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3241 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3242 |
27480
cbee8aecc90a
Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents:
27230
diff
changeset
|
3243 purple_blist_destroy(); |
cbee8aecc90a
Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents:
27230
diff
changeset
|
3244 |
26520
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
3245 node = purple_blist_get_root(); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
3246 while (node) { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
3247 next_node = node->next; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
3248 purple_blist_node_destroy(node); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
3249 node = next_node; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25925
diff
changeset
|
3250 } |
26540
384eaba9974e
Reset some global data when uninit-ing. Fixes a crash on quit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26527
diff
changeset
|
3251 purplebuddylist->root = NULL; |
27480
cbee8aecc90a
Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents:
27230
diff
changeset
|
3252 |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3253 g_hash_table_destroy(purplebuddylist->buddies); |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3254 g_hash_table_destroy(buddies_cache); |
27569
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
3255 g_hash_table_destroy(groups_cache); |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
3256 |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
3257 buddies_cache = NULL; |
36aa9ed8cd39
Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents:
27503
diff
changeset
|
3258 groups_cache = NULL; |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3259 |
27480
cbee8aecc90a
Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents:
27230
diff
changeset
|
3260 PURPLE_DBUS_UNREGISTER_POINTER(purplebuddylist); |
cbee8aecc90a
Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents:
27230
diff
changeset
|
3261 g_free(purplebuddylist); |
cbee8aecc90a
Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents:
27230
diff
changeset
|
3262 purplebuddylist = NULL; |
26764
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3263 |
0e99b80b54c6
Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents:
26548
diff
changeset
|
3264 purple_signals_disconnect_by_handle(purple_blist_get_handle()); |
15822 | 3265 purple_signals_unregister_by_instance(purple_blist_get_handle()); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3266 } |