Mercurial > pidgin.yaz
annotate libpurple/blist.c @ 27564:3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
in the add request. We really should try and move this into the add buddy
dialog instead of an extra prompt.
Fixes #8503.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 13 Jul 2009 05:01:42 +0000 |
parents | 75acd9ad14be |
children | cbee8aecc90a 6d26258e9f1d 2e6482e80a16 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15823 | 2 * purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15823 | 4 * Purple is the legal property of its developers, whose names are too numerous |
15374
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 |
19680
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 |
15374
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 */ |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
23 #define _PURPLE_BLIST_C_ |
24275
d81104908a4e
use some additional preproc logic to avoid copying the structs directly into the implementation files
Gary Kramlich <grim@reaperworld.com>
parents:
24256
diff
changeset
|
24 |
15374
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 |
15823 | 40 static PurpleBlistUiOps *blist_ui_ops = NULL; |
41 | |
42 static PurpleBuddyList *purplebuddylist = NULL; | |
26846
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:
26630
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:
26630
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:
26630
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:
26630
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:
26630
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:
26630
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:
26630
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:
26630
diff
changeset
|
50 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 static guint save_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 static gboolean blist_loaded = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 /********************************************************************* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 * Private utility functions * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 *********************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 |
15823 | 58 static PurpleBlistNode *purple_blist_get_last_sibling(PurpleBlistNode *node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 { |
15823 | 60 PurpleBlistNode *n = node; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 if (!n) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 while (n->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 n = n->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 return n; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 |
15823 | 68 static PurpleBlistNode *purple_blist_get_last_child(PurpleBlistNode *node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 if (!node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 return NULL; |
15823 | 72 return purple_blist_get_last_sibling(node->child); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 struct _list_account_buddies { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 GSList *list; |
15823 | 77 PurpleAccount *account; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 |
15823 | 80 struct _purple_hbuddy { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 char *name; |
15823 | 82 PurpleAccount *account; |
83 PurpleBlistNode *group; | |
15374
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 |
15823 | 86 static guint _purple_blist_hbuddy_hash(struct _purple_hbuddy *hb) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 return g_str_hash(hb->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 |
15823 | 91 static guint _purple_blist_hbuddy_equal(struct _purple_hbuddy *hb1, struct _purple_hbuddy *hb2) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 { |
25385
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:
25381
diff
changeset
|
93 return (purple_strequal(hb1->name, hb2->name) && hb1->account == hb2->account && hb1->group == hb2->group); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 |
15823 | 96 static void _purple_blist_hbuddy_free_key(struct _purple_hbuddy *hb) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 g_free(hb->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 g_free(hb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 |
26846
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:
26630
diff
changeset
|
102 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:
26630
diff
changeset
|
103 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:
26630
diff
changeset
|
104 { |
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:
26630
diff
changeset
|
105 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:
26630
diff
changeset
|
106 (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:
26630
diff
changeset
|
107 (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:
26630
diff
changeset
|
108 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:
26630
diff
changeset
|
109 } |
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:
26630
diff
changeset
|
110 |
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:
26630
diff
changeset
|
111 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:
26630
diff
changeset
|
112 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:
26630
diff
changeset
|
113 { |
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:
26630
diff
changeset
|
114 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:
26630
diff
changeset
|
115 } |
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:
26630
diff
changeset
|
116 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 /********************************************************************* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 * Writing to disk * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 *********************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 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
|
124 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 const char *name; |
15823 | 126 PurpleValue *value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 xmlnode *node, *child; |
26967
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26901
diff
changeset
|
128 char buf[21]; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 name = (const char *)key; |
15823 | 131 value = (PurpleValue *)hvalue; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 node = (xmlnode *)user_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 g_return_if_fail(value != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 child = xmlnode_new_child(node, "setting"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 xmlnode_set_attrib(child, "name", name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 |
15823 | 139 if (purple_value_get_type(value) == PURPLE_TYPE_INT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 xmlnode_set_attrib(child, "type", "int"); |
26967
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26901
diff
changeset
|
141 g_snprintf(buf, sizeof(buf), "%d", purple_value_get_int(value)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 xmlnode_insert_data(child, buf, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 } |
15823 | 144 else if (purple_value_get_type(value) == PURPLE_TYPE_STRING) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 xmlnode_set_attrib(child, "type", "string"); |
15823 | 146 xmlnode_insert_data(child, purple_value_get_string(value), -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 } |
15823 | 148 else if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 xmlnode_set_attrib(child, "type", "bool"); |
26967
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26901
diff
changeset
|
150 g_snprintf(buf, sizeof(buf), "%d", purple_value_get_boolean(value)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 xmlnode_insert_data(child, buf, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 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
|
157 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 const char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 const char *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 xmlnode *node, *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 name = (const char *)key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 data = (const char *)value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 node = (xmlnode *)user_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 g_return_if_fail(data != NULL); |
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 child = xmlnode_new_child(node, "component"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 xmlnode_set_attrib(child, "name", name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 xmlnode_insert_data(child, data, -1); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 static xmlnode * |
15823 | 174 buddy_to_xmlnode(PurpleBlistNode *bnode) |
15374
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 xmlnode *node, *child; |
15823 | 177 PurpleBuddy *buddy; |
178 | |
179 buddy = (PurpleBuddy *)bnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 node = xmlnode_new("buddy"); |
15823 | 182 xmlnode_set_attrib(node, "account", purple_account_get_username(buddy->account)); |
183 xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(buddy->account)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 child = xmlnode_new_child(node, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 xmlnode_insert_data(child, buddy->name, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 if (buddy->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 child = xmlnode_new_child(node, "alias"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 xmlnode_insert_data(child, buddy->alias, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 /* Write buddy settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 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
|
196 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 } |
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 static xmlnode * |
15823 | 201 contact_to_xmlnode(PurpleBlistNode *cnode) |
15374
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 xmlnode *node, *child; |
15823 | 204 PurpleContact *contact; |
205 PurpleBlistNode *bnode; | |
206 | |
207 contact = (PurpleContact *)cnode; | |
15374
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 node = xmlnode_new("contact"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 if (contact->alias != NULL) |
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_set_attrib(node, "alias", contact->alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 /* Write buddies */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 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
|
218 { |
15823 | 219 if (!PURPLE_BLIST_NODE_SHOULD_SAVE(bnode)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 continue; |
15823 | 221 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
15374
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 child = buddy_to_xmlnode(bnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 xmlnode_insert_child(node, child); |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 /* Write contact settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 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
|
230 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 return node; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 static xmlnode * |
15823 | 235 chat_to_xmlnode(PurpleBlistNode *cnode) |
15374
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 xmlnode *node, *child; |
15823 | 238 PurpleChat *chat; |
239 | |
240 chat = (PurpleChat *)cnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 node = xmlnode_new("chat"); |
15823 | 243 xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(chat->account)); |
244 xmlnode_set_attrib(node, "account", purple_account_get_username(chat->account)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 if (chat->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 child = xmlnode_new_child(node, "alias"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 xmlnode_insert_data(child, chat->alias, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 } |
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 /* Write chat components */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 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
|
254 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 /* Write chat settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 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
|
257 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 } |
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 static xmlnode * |
15823 | 262 group_to_xmlnode(PurpleBlistNode *gnode) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 xmlnode *node, *child; |
15823 | 265 PurpleGroup *group; |
266 PurpleBlistNode *cnode; | |
267 | |
268 group = (PurpleGroup *)gnode; | |
15374
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 node = xmlnode_new("group"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 xmlnode_set_attrib(node, "name", group->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 /* Write settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 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
|
275 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 /* Write contacts and chats */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 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
|
278 { |
15823 | 279 if (!PURPLE_BLIST_NODE_SHOULD_SAVE(cnode)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 continue; |
15823 | 281 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
15374
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 child = contact_to_xmlnode(cnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 xmlnode_insert_child(node, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 } |
15823 | 286 else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 child = chat_to_xmlnode(cnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 xmlnode_insert_child(node, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 } |
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 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 static xmlnode * |
15823 | 297 accountprivacy_to_xmlnode(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 xmlnode *node, *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 GSList *cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 char buf[10]; |
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 node = xmlnode_new("account"); |
15823 | 304 xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); |
305 xmlnode_set_attrib(node, "name", purple_account_get_username(account)); | |
26967
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26901
diff
changeset
|
306 g_snprintf(buf, sizeof(buf), "%d", account->perm_deny); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 xmlnode_set_attrib(node, "mode", buf); |
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 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
|
310 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 child = xmlnode_new_child(node, "permit"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 xmlnode_insert_data(child, cur->data, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 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
|
316 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 child = xmlnode_new_child(node, "block"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 xmlnode_insert_data(child, cur->data, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 } |
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 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 } |
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 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
|
325 blist_to_xmlnode(void) |
15374
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 xmlnode *node, *child, *grandchild; |
15823 | 328 PurpleBlistNode *gnode; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
329 GList *cur; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 |
15823 | 331 node = xmlnode_new("purple"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 xmlnode_set_attrib(node, "version", "1.0"); |
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 /* Write groups */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 child = xmlnode_new_child(node, "blist"); |
15823 | 336 for (gnode = purplebuddylist->root; gnode != NULL; gnode = gnode->next) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 { |
15823 | 338 if (!PURPLE_BLIST_NODE_SHOULD_SAVE(gnode)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 continue; |
15823 | 340 if (PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 grandchild = group_to_xmlnode(gnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 xmlnode_insert_child(child, grandchild); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 /* Write privacy settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 child = xmlnode_new_child(node, "privacy"); |
15823 | 349 for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 grandchild = accountprivacy_to_xmlnode(cur->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 xmlnode_insert_child(child, grandchild); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 } |
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 return node; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 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
|
359 purple_blist_sync(void) |
15374
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 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 char *data; |
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 if (!blist_loaded) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 { |
15823 | 366 purple_debug_error("blist", "Attempted to save buddy list before it " |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 "was read!\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 } |
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 node = blist_to_xmlnode(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 data = xmlnode_to_formatted_str(node, NULL); |
15823 | 373 purple_util_write_data_to_file("blist.xml", data, -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 xmlnode_free(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 save_cb(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 { |
15823 | 381 purple_blist_sync(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 save_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 void |
15823 | 387 purple_blist_schedule_save() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 if (save_timer == 0) |
18006
f2d8658b3a86
merge of '62e9d17cd37551991c5040ce6ca48e6d7578dde3'
Richard Laager <rlaager@wiktel.com>
parents:
16809
diff
changeset
|
390 save_timer = purple_timeout_add_seconds(5, save_cb, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 |
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 * Reading from disk * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 *********************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 static void |
15823 | 399 parse_setting(PurpleBlistNode *node, xmlnode *setting) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 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
|
402 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
|
403 char *value = xmlnode_get_data(setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 if (!value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 |
25385
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:
25381
diff
changeset
|
408 if (!type || purple_strequal(type, "string")) |
15823 | 409 purple_blist_node_set_string(node, name, value); |
25385
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:
25381
diff
changeset
|
410 else if (purple_strequal(type, "bool")) |
15823 | 411 purple_blist_node_set_bool(node, name, atoi(value)); |
25385
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:
25381
diff
changeset
|
412 else if (purple_strequal(type, "int")) |
15823 | 413 purple_blist_node_set_int(node, name, atoi(value)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 g_free(value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 static void |
15823 | 419 parse_buddy(PurpleGroup *group, PurpleContact *contact, xmlnode *bnode) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 { |
15823 | 421 PurpleAccount *account; |
422 PurpleBuddy *buddy; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 char *name = NULL, *alias = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 const char *acct_name, *proto, *protocol; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 xmlnode *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 acct_name = xmlnode_get_attrib(bnode, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 protocol = xmlnode_get_attrib(bnode, "protocol"); |
15823 | 429 protocol = _purple_oscar_convert(acct_name, protocol); /* XXX: Remove */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 proto = xmlnode_get_attrib(bnode, "proto"); |
15823 | 431 proto = _purple_oscar_convert(acct_name, proto); /* XXX: Remove */ |
15374
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 if (!acct_name || (!proto && !protocol)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 |
15823 | 436 account = purple_accounts_find(acct_name, proto ? proto : protocol); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 if (!account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 if ((x = xmlnode_get_child(bnode, "name"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 name = xmlnode_get_data(x); |
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 (!name) |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 if ((x = xmlnode_get_child(bnode, "alias"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 alias = xmlnode_get_data(x); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 |
15823 | 450 buddy = purple_buddy_new(account, name, alias); |
451 purple_blist_add_buddy(buddy, contact, group, | |
452 purple_blist_get_last_child((PurpleBlistNode*)contact)); | |
15374
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 for (x = xmlnode_get_child(bnode, "setting"); x; x = xmlnode_get_next_twin(x)) { |
15823 | 455 parse_setting((PurpleBlistNode*)buddy, x); |
15374
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 g_free(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 g_free(alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 static void |
15823 | 463 parse_contact(PurpleGroup *group, xmlnode *cnode) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 { |
15823 | 465 PurpleContact *contact = purple_contact_new(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 xmlnode *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 const char *alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 |
15823 | 469 purple_blist_add_contact(contact, group, |
470 purple_blist_get_last_child((PurpleBlistNode*)group)); | |
15374
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 ((alias = xmlnode_get_attrib(cnode, "alias"))) { |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
473 purple_blist_alias_contact(contact, alias); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 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
|
477 if (x->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 continue; |
25385
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:
25381
diff
changeset
|
479 if (purple_strequal(x->name, "buddy")) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 parse_buddy(group, contact, x); |
25385
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:
25381
diff
changeset
|
481 else if (purple_strequal(x->name, "setting")) |
15823 | 482 parse_setting((PurpleBlistNode*)contact, x); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 /* if the contact is empty, don't keep it around. it causes problems */ |
15823 | 486 if (!((PurpleBlistNode*)contact)->child) |
487 purple_blist_remove_contact(contact); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 static void |
15823 | 491 parse_chat(PurpleGroup *group, xmlnode *cnode) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 { |
15823 | 493 PurpleChat *chat; |
494 PurpleAccount *account; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 const char *acct_name, *proto, *protocol; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 xmlnode *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 char *alias = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 GHashTable *components; |
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 acct_name = xmlnode_get_attrib(cnode, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 protocol = xmlnode_get_attrib(cnode, "protocol"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 proto = xmlnode_get_attrib(cnode, "proto"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 if (!acct_name || (!proto && !protocol)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 |
15823 | 507 account = purple_accounts_find(acct_name, proto ? proto : protocol); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 if (!account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 if ((x = xmlnode_get_child(cnode, "alias"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 alias = xmlnode_get_data(x); |
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 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
|
516 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 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
|
518 const char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 char *value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 name = xmlnode_get_attrib(x, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 value = xmlnode_get_data(x); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 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
|
524 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 |
15823 | 526 chat = purple_chat_new(account, alias, components); |
527 purple_blist_add_chat(chat, group, | |
528 purple_blist_get_last_child((PurpleBlistNode*)group)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 for (x = xmlnode_get_child(cnode, "setting"); x; x = xmlnode_get_next_twin(x)) { |
15823 | 531 parse_setting((PurpleBlistNode*)chat, x); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 g_free(alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 parse_group(xmlnode *groupnode) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 const char *name = xmlnode_get_attrib(groupnode, "name"); |
15823 | 541 PurpleGroup *group; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 xmlnode *cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 if (!name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 name = _("Buddies"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 |
15823 | 547 group = purple_group_new(name); |
548 purple_blist_add_group(group, | |
549 purple_blist_get_last_sibling(purplebuddylist->root)); | |
15374
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 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
|
552 if (cnode->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 continue; |
25385
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:
25381
diff
changeset
|
554 if (purple_strequal(cnode->name, "setting")) |
15823 | 555 parse_setting((PurpleBlistNode*)group, cnode); |
25385
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:
25381
diff
changeset
|
556 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:
25381
diff
changeset
|
557 purple_strequal(cnode->name, "person")) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 parse_contact(group, cnode); |
25385
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:
25381
diff
changeset
|
559 else if (purple_strequal(cnode->name, "chat")) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 parse_chat(group, cnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 } |
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 /* 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
|
565 void |
15823 | 566 purple_blist_load() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 { |
15823 | 568 xmlnode *purple, *blist, *privacy; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 blist_loaded = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 |
15823 | 572 purple = purple_util_read_xml_from_file("blist.xml", _("buddy list")); |
573 | |
574 if (purple == NULL) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 |
15823 | 577 blist = xmlnode_get_child(purple, "blist"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 if (blist) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 xmlnode *groupnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 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
|
581 groupnode = xmlnode_get_next_twin(groupnode)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 parse_group(groupnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 |
15823 | 586 privacy = xmlnode_get_child(purple, "privacy"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 if (privacy) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 xmlnode *anode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 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
|
590 xmlnode *x; |
15823 | 591 PurpleAccount *account; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 int imode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 const char *acct_name, *proto, *mode, *protocol; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 acct_name = xmlnode_get_attrib(anode, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 protocol = xmlnode_get_attrib(anode, "protocol"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 proto = xmlnode_get_attrib(anode, "proto"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 mode = xmlnode_get_attrib(anode, "mode"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 if (!acct_name || (!proto && !protocol) || !mode) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 |
15823 | 603 account = purple_accounts_find(acct_name, proto ? proto : protocol); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 if (!account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 imode = atoi(mode); |
15823 | 609 account->perm_deny = (imode != 0 ? imode : PURPLE_PRIVACY_ALLOW_ALL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 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
|
612 char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 if (x->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 |
25385
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:
25381
diff
changeset
|
616 if (purple_strequal(x->name, "permit")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 name = xmlnode_get_data(x); |
15823 | 618 purple_privacy_permit_add(account, name, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 g_free(name); |
25385
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:
25381
diff
changeset
|
620 } else if (purple_strequal(x->name, "block")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 name = xmlnode_get_data(x); |
15823 | 622 purple_privacy_deny_add(account, name, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 g_free(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 |
15823 | 629 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:
15823
diff
changeset
|
630 |
c9b4ff420140
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
631 /* This tells the buddy icon code to do its thing. */ |
16639
f9c369b4291c
Fix up the private function calls to be prefixed with an underscore.
Richard Laager <rlaager@wiktel.com>
parents:
16518
diff
changeset
|
632 _purple_buddy_icons_blist_loaded_cb(); |
15374
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 /********************************************************************* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 * Stuff * |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 static void |
15823 | 641 purple_contact_compute_priority_buddy(PurpleContact *contact) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 { |
15823 | 643 PurpleBlistNode *bnode; |
644 PurpleBuddy *new_priority = NULL; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 g_return_if_fail(contact != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 contact->priority = NULL; |
15823 | 649 for (bnode = ((PurpleBlistNode*)contact)->child; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 bnode != NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 bnode = bnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 { |
15823 | 653 PurpleBuddy *buddy; |
654 | |
655 if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 |
15823 | 658 buddy = (PurpleBuddy*)bnode; |
20633
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
659 if (new_priority == NULL) |
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
660 { |
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
661 new_priority = buddy; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 continue; |
20633
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
663 } |
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
664 |
4c910fcb5b0a
Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents:
20550
diff
changeset
|
665 if (purple_account_is_connected(buddy->account)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 { |
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
|
667 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
|
668 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
|
669 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
|
670 purple_buddy_get_presence(buddy)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 if (cmp > 0 || (cmp == 0 && |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15823
diff
changeset
|
673 purple_prefs_get_bool("/purple/contact/last_match"))) |
15374
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 new_priority = buddy; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 contact->priority = new_priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 contact->priority_valid = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 |
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 /***************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 * Public API functions * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 *****************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 |
15823 | 689 PurpleBuddyList *purple_blist_new() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 { |
15823 | 691 PurpleBlistUiOps *ui_ops; |
26846
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:
26630
diff
changeset
|
692 GList *account; |
15823 | 693 PurpleBuddyList *gbl = g_new0(PurpleBuddyList, 1); |
694 PURPLE_DBUS_REGISTER_POINTER(gbl, PurpleBuddyList); | |
695 | |
696 ui_ops = purple_blist_get_ui_ops(); | |
697 | |
698 gbl->buddies = g_hash_table_new_full((GHashFunc)_purple_blist_hbuddy_hash, | |
699 (GEqualFunc)_purple_blist_hbuddy_equal, | |
700 (GDestroyNotify)_purple_blist_hbuddy_free_key, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 |
26846
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:
26630
diff
changeset
|
702 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:
26630
diff
changeset
|
703 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:
26630
diff
changeset
|
704 |
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:
26630
diff
changeset
|
705 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:
26630
diff
changeset
|
706 { |
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:
26630
diff
changeset
|
707 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:
26630
diff
changeset
|
708 } |
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:
26630
diff
changeset
|
709 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 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
|
711 ui_ops->new_list(gbl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 return gbl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 } |
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 void |
15823 | 717 purple_set_blist(PurpleBuddyList *list) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 { |
15823 | 719 purplebuddylist = list; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 |
15823 | 722 PurpleBuddyList * |
723 purple_get_blist() | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 { |
15823 | 725 return purplebuddylist; |
15374
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 |
15823 | 728 PurpleBlistNode * |
729 purple_blist_get_root() | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 { |
15823 | 731 return purplebuddylist ? purplebuddylist->root : NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 |
26620
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
734 static void |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
735 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:
26609
diff
changeset
|
736 { |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
737 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:
26609
diff
changeset
|
738 *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:
26609
diff
changeset
|
739 } |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
740 |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
741 GSList * |
25297 | 742 purple_blist_get_buddies() |
743 { | |
26620
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
744 GSList *buddies = NULL; |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
745 |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
746 if (!purplebuddylist) |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
747 return NULL; |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
748 |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
26609
diff
changeset
|
749 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:
26609
diff
changeset
|
750 return buddies; |
25297 | 751 } |
752 | |
25312
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:
25297
diff
changeset
|
753 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:
25297
diff
changeset
|
754 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:
25297
diff
changeset
|
755 { |
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:
25297
diff
changeset
|
756 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:
25297
diff
changeset
|
757 } |
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:
25297
diff
changeset
|
758 |
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:
25297
diff
changeset
|
759 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:
25297
diff
changeset
|
760 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:
25297
diff
changeset
|
761 { |
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:
25297
diff
changeset
|
762 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:
25297
diff
changeset
|
763 } |
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:
25297
diff
changeset
|
764 |
15823 | 765 void purple_blist_show() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 { |
15823 | 767 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 if (ops && ops->show) |
15823 | 770 ops->show(purplebuddylist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 |
15823 | 773 void purple_blist_destroy() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 { |
15823 | 775 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
776 | |
777 purple_debug(PURPLE_DEBUG_INFO, "blist", "Destroying\n"); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 if (ops && ops->destroy) |
15823 | 780 ops->destroy(purplebuddylist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 |
15823 | 783 void purple_blist_set_visible(gboolean show) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 { |
15823 | 785 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 if (ops && ops->set_visible) |
15823 | 788 ops->set_visible(purplebuddylist, show); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 |
15823 | 791 static PurpleBlistNode *get_next_node(PurpleBlistNode *node, gboolean godeep) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 if (node == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
794 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 if (godeep && node->child) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 return node->child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
798 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
799 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 return node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 return get_next_node(node->parent, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 |
15823 | 805 PurpleBlistNode *purple_blist_node_next(PurpleBlistNode *node, gboolean offline) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 { |
15823 | 807 PurpleBlistNode *ret = node; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 if (offline) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 return get_next_node(ret, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 do |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
812 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 ret = get_next_node(ret, TRUE); |
15823 | 814 } while (ret && PURPLE_BLIST_NODE_IS_BUDDY(ret) && |
815 !purple_account_is_connected(purple_buddy_get_account((PurpleBuddy *)ret))); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
817 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
820 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
|
821 { |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
822 return node ? node->parent : NULL; |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
823 } |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
824 |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
825 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
|
826 { |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
827 return node ? node->child : NULL; |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
828 } |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
829 |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
830 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
|
831 { |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
832 return node? node->next : NULL; |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
833 } |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
834 |
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
|
835 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
|
836 { |
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22180
diff
changeset
|
837 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
|
838 } |
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22180
diff
changeset
|
839 |
25312
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:
25297
diff
changeset
|
840 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:
25297
diff
changeset
|
841 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:
25297
diff
changeset
|
842 { |
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:
25297
diff
changeset
|
843 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:
25297
diff
changeset
|
844 |
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:
25297
diff
changeset
|
845 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:
25297
diff
changeset
|
846 } |
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:
25297
diff
changeset
|
847 |
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:
25297
diff
changeset
|
848 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:
25297
diff
changeset
|
849 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:
25297
diff
changeset
|
850 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:
25297
diff
changeset
|
851 |
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:
25297
diff
changeset
|
852 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:
25297
diff
changeset
|
853 } |
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:
25297
diff
changeset
|
854 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 void |
15823 | 856 purple_blist_update_buddy_status(PurpleBuddy *buddy, PurpleStatus *old_status) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 { |
15823 | 858 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
859 PurplePresence *presence; | |
860 PurpleStatus *status; | |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
861 PurpleBlistNode *cnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 |
15823 | 865 presence = purple_buddy_get_presence(buddy); |
866 status = purple_presence_get_active_status(presence); | |
867 | |
868 purple_debug_info("blist", "Updating buddy status for %s (%s)\n", | |
869 buddy->name, purple_account_get_protocol_name(buddy->account)); | |
870 | |
871 if (purple_status_is_online(status) && | |
872 !purple_status_is_online(old_status)) { | |
873 | |
874 purple_signal_emit(purple_blist_get_handle(), "buddy-signed-on", buddy); | |
875 | |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
876 cnode = buddy->node.parent; |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
877 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:
25312
diff
changeset
|
878 PURPLE_GROUP(cnode->parent)->online++; |
15823 | 879 } else if (!purple_status_is_online(status) && |
880 purple_status_is_online(old_status)) { | |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
881 |
15823 | 882 purple_blist_node_set_int(&buddy->node, "last_seen", time(NULL)); |
883 purple_signal_emit(purple_blist_get_handle(), "buddy-signed-off", buddy); | |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
884 |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
885 cnode = buddy->node.parent; |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
886 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:
25312
diff
changeset
|
887 PURPLE_GROUP(cnode->parent)->online--; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 } else { |
15823 | 889 purple_signal_emit(purple_blist_get_handle(), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
890 "buddy-status-changed", buddy, old_status, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 status); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
892 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
893 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 * 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
|
896 * 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
|
897 * 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
|
898 * to away then no signal is triggered. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
899 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 * 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
|
901 * 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
|
902 * 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
|
903 */ |
15823 | 904 purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
905 if (ops && ops->update) |
15823 | 906 ops->update(purplebuddylist, (PurpleBlistNode *)buddy); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
908 |
23117
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22677
diff
changeset
|
909 void |
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22677
diff
changeset
|
910 purple_blist_update_node_icon(PurpleBlistNode *node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 { |
15823 | 912 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 |
23117
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22677
diff
changeset
|
914 g_return_if_fail(node != NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
916 if (ops && ops->update) |
23117
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22677
diff
changeset
|
917 ops->update(purplebuddylist, node); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
918 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 |
23117
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22677
diff
changeset
|
920 void |
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22677
diff
changeset
|
921 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:
22677
diff
changeset
|
922 { |
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22677
diff
changeset
|
923 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:
22677
diff
changeset
|
924 } |
d11c993700e6
Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents:
22677
diff
changeset
|
925 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 * 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
|
928 * from oscar.c and toc.c instead? |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 */ |
15823 | 930 void purple_blist_rename_buddy(PurpleBuddy *buddy, const char *name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 { |
15823 | 932 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
26846
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:
26630
diff
changeset
|
933 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:
26630
diff
changeset
|
934 GHashTable *account_buddies; |
15374
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 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 |
15823 | 938 hb = g_new(struct _purple_hbuddy, 1); |
939 hb->name = g_strdup(purple_normalize(buddy->account, buddy->name)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 hb->account = buddy->account; |
15823 | 941 hb->group = ((PurpleBlistNode *)buddy)->parent->parent; |
942 g_hash_table_remove(purplebuddylist->buddies, hb); | |
26846
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:
26630
diff
changeset
|
943 |
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:
26630
diff
changeset
|
944 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:
26630
diff
changeset
|
945 g_hash_table_remove(account_buddies, hb); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
947 g_free(hb->name); |
15823 | 948 hb->name = g_strdup(purple_normalize(buddy->account, name)); |
949 g_hash_table_replace(purplebuddylist->buddies, hb, buddy); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 |
26846
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:
26630
diff
changeset
|
951 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:
26630
diff
changeset
|
952 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:
26630
diff
changeset
|
953 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:
26630
diff
changeset
|
954 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:
26630
diff
changeset
|
955 |
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:
26630
diff
changeset
|
956 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:
26630
diff
changeset
|
957 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 g_free(buddy->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 buddy->name = g_strdup(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 |
15823 | 961 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 if (ops && ops->update) |
15823 | 964 ops->update(purplebuddylist, (PurpleBlistNode *)buddy); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
966 |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
967 static gboolean |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
968 purple_strings_are_different(const char *one, const char *two) |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
969 { |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
970 return !((one && two && g_utf8_collate(one, two) == 0) || |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
971 ((one == NULL || *one == '\0') && (two == NULL || *two == '\0'))); |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
972 } |
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
973 |
15823 | 974 void purple_blist_alias_contact(PurpleContact *contact, const char *alias) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
975 { |
15823 | 976 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
977 PurpleConversation *conv; | |
978 PurpleBlistNode *bnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 char *old_alias; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
980 char *new_alias = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
981 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 g_return_if_fail(contact != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
984 if ((alias != NULL) && (*alias != '\0')) |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
985 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:
26967
diff
changeset
|
986 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
987 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:
26967
diff
changeset
|
988 g_free(new_alias); |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
989 return; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
990 } |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
991 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
992 old_alias = contact->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
993 |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
994 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:
26967
diff
changeset
|
995 contact->alias = new_alias; |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
996 else { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
997 contact->alias = NULL; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
998 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:
26967
diff
changeset
|
999 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1000 |
15823 | 1001 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1002 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1003 if (ops && ops->update) |
15823 | 1004 ops->update(purplebuddylist, (PurpleBlistNode *)contact); |
1005 | |
1006 for(bnode = ((PurpleBlistNode *)contact)->child; bnode != NULL; bnode = bnode->next) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1007 { |
15823 | 1008 PurpleBuddy *buddy = (PurpleBuddy *)bnode; |
1009 | |
1010 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1011 buddy->account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 if (conv) |
15823 | 1013 purple_conversation_autoset_title(conv); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1014 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1015 |
15823 | 1016 purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1017 contact, old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1018 g_free(old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1019 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1020 |
15823 | 1021 void purple_blist_alias_chat(PurpleChat *chat, const char *alias) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1022 { |
15823 | 1023 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1024 char *old_alias; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1025 char *new_alias = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1026 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1027 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1028 |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1029 if ((alias != NULL) && (*alias != '\0')) |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1030 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:
26967
diff
changeset
|
1031 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1032 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:
26967
diff
changeset
|
1033 g_free(new_alias); |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
1034 return; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1035 } |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
1036 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1037 old_alias = chat->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1038 |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1039 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:
26967
diff
changeset
|
1040 chat->alias = new_alias; |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1041 else { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1042 chat->alias = NULL; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1043 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:
26967
diff
changeset
|
1044 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1045 |
15823 | 1046 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 if (ops && ops->update) |
15823 | 1049 ops->update(purplebuddylist, (PurpleBlistNode *)chat); |
1050 | |
1051 purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 chat, old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 g_free(old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 |
15823 | 1056 void purple_blist_alias_buddy(PurpleBuddy *buddy, const char *alias) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1057 { |
15823 | 1058 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1059 PurpleConversation *conv; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1060 char *old_alias; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1061 char *new_alias = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1065 if ((alias != NULL) && (*alias != '\0')) |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1066 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:
26967
diff
changeset
|
1067 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1068 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:
26967
diff
changeset
|
1069 g_free(new_alias); |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
1070 return; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1071 } |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
1072 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1073 old_alias = buddy->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1075 if ((new_alias != NULL) && (*new_alias != '\0')) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 buddy->alias = g_strdup(alias); |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1077 else { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1078 buddy->alias = NULL; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1079 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:
26967
diff
changeset
|
1080 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 |
15823 | 1082 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1083 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1084 if (ops && ops->update) |
15823 | 1085 ops->update(purplebuddylist, (PurpleBlistNode *)buddy); |
1086 | |
1087 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 buddy->account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 if (conv) |
15823 | 1090 purple_conversation_autoset_title(conv); |
1091 | |
1092 purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 buddy, old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1094 g_free(old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1095 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1096 |
15823 | 1097 void purple_blist_server_alias_buddy(PurpleBuddy *buddy, const char *alias) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1098 { |
15823 | 1099 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1100 PurpleConversation *conv; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1101 char *old_alias; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1102 char *new_alias = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1103 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1104 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1105 |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1106 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:
26967
diff
changeset
|
1107 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:
26967
diff
changeset
|
1108 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1109 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:
26967
diff
changeset
|
1110 g_free(new_alias); |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
1111 return; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1112 } |
20205
859087457089
applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
1113 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1114 old_alias = buddy->server_alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1115 |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1116 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:
26967
diff
changeset
|
1117 buddy->server_alias = new_alias; |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1118 else { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1119 buddy->server_alias = NULL; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1120 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:
26967
diff
changeset
|
1121 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1122 |
15823 | 1123 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1124 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1125 if (ops && ops->update) |
15823 | 1126 ops->update(purplebuddylist, (PurpleBlistNode *)buddy); |
1127 | |
1128 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1129 buddy->account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1130 if (conv) |
15823 | 1131 purple_conversation_autoset_title(conv); |
1132 | |
1133 purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 buddy, old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1135 g_free(old_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1136 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1137 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1138 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1139 * 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
|
1140 */ |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1141 void purple_blist_rename_group(PurpleGroup *source, const char *name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1142 { |
15823 | 1143 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1144 PurpleGroup *dest; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1145 gchar *old_name; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1146 gchar *new_name; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 GList *moved_buddies = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1148 GSList *accts; |
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(source != NULL); |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1151 g_return_if_fail(name != NULL); |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1152 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1153 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:
26967
diff
changeset
|
1154 |
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1155 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:
26967
diff
changeset
|
1156 g_free(new_name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1157 return; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1158 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 |
15823 | 1160 dest = purple_find_group(new_name); |
24830 | 1161 if (dest != NULL && purple_utf8_strcasecmp(source->name, dest->name) != 0) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 /* We're merging two groups */ |
15823 | 1163 PurpleBlistNode *prev, *child, *next; |
1164 | |
1165 prev = purple_blist_get_last_child((PurpleBlistNode*)dest); | |
1166 child = ((PurpleBlistNode*)source)->child; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1169 * 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
|
1170 * 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
|
1171 * 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
|
1172 * each moved buddy... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1173 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1174 while (child) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1175 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 next = child->next; |
15823 | 1177 if (PURPLE_BLIST_NODE_IS_CONTACT(child)) { |
1178 PurpleBlistNode *bnode; | |
1179 purple_blist_add_contact((PurpleContact *)child, dest, prev); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 for (bnode = child->child; bnode != NULL; bnode = bnode->next) { |
15823 | 1181 purple_blist_add_buddy((PurpleBuddy *)bnode, (PurpleContact *)child, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 NULL, bnode->prev); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1183 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
|
1184 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1185 prev = child; |
15823 | 1186 } else if (PURPLE_BLIST_NODE_IS_CHAT(child)) { |
1187 purple_blist_add_chat((PurpleChat *)child, dest, prev); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1188 prev = child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 } else { |
15823 | 1190 purple_debug(PURPLE_DEBUG_ERROR, "blist", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1191 "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
|
1192 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1193 child = next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 /* 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
|
1197 old_name = g_strdup(source->name); |
15823 | 1198 purple_blist_remove_group(source); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 source = dest; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1200 g_free(new_name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1201 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1202 /* A simple rename */ |
15823 | 1203 PurpleBlistNode *cnode, *bnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1204 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1205 /* Build a GList of all buddies in this group */ |
15823 | 1206 for (cnode = ((PurpleBlistNode *)source)->child; cnode != NULL; cnode = cnode->next) { |
1207 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1208 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
|
1209 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
|
1210 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1211 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1212 old_name = source->name; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1213 source->name = new_name; |
15374
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 /* Save our changes */ |
15823 | 1217 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1218 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1219 /* Update the UI */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1220 if (ops && ops->update) |
15823 | 1221 ops->update(purplebuddylist, (PurpleBlistNode*)source); |
15374
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 /* Notify all PRPLs */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1224 /* TODO: Is this condition needed? Seems like it would always be TRUE */ |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1225 if(old_name && !purple_strequal(source->name, old_name)) { |
15823 | 1226 for (accts = purple_group_get_accounts(source); accts; accts = g_slist_remove(accts, accts->data)) { |
1227 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
|
1228 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
|
1229 PurplePlugin *prpl = NULL; |
15823 | 1230 PurplePluginProtocolInfo *prpl_info = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1231 GList *l = NULL, *buddies = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 |
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
|
1233 gc = purple_account_get_connection(account); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
1234 |
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
|
1235 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
|
1236 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
|
1237 |
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22219
diff
changeset
|
1238 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
|
1239 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1240 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1241 if(!prpl_info) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1244 for(l = moved_buddies; l; l = l->next) { |
15823 | 1245 PurpleBuddy *buddy = (PurpleBuddy *)l->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1247 if(buddy && buddy->account == account) |
15823 | 1248 buddies = g_list_append(buddies, (PurpleBlistNode *)buddy); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1250 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1251 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
|
1252 prpl_info->rename_group(gc, old_name, source, buddies); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1254 GList *cur, *groups = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1255 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1256 /* 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
|
1257 for(cur = buddies; cur; cur = cur->next) { |
15823 | 1258 PurpleBlistNode *node = (PurpleBlistNode *)cur->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1259 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
|
1260 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1261 |
15823 | 1262 purple_account_remove_buddies(account, buddies, groups); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1263 g_list_free(groups); |
15823 | 1264 purple_account_add_buddies(account, buddies); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1266 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1267 g_list_free(buddies); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1268 } |
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 g_list_free(moved_buddies); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1271 g_free(old_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1272 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1273 |
15823 | 1274 static void purple_blist_node_initialize_settings(PurpleBlistNode *node); |
1275 | |
1276 PurpleChat *purple_chat_new(PurpleAccount *account, const char *alias, GHashTable *components) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1277 { |
15823 | 1278 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1279 PurpleChat *chat; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1280 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1281 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
|
1282 g_return_val_if_fail(components != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1283 |
15823 | 1284 chat = g_new0(PurpleChat, 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1285 chat->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1286 if ((alias != NULL) && (*alias != '\0')) |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1287 chat->alias = purple_utf8_strip_unprintables(alias); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1288 chat->components = components; |
15823 | 1289 purple_blist_node_initialize_settings((PurpleBlistNode *)chat); |
1290 ((PurpleBlistNode *)chat)->type = PURPLE_BLIST_CHAT_NODE; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1291 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1292 if (ops != NULL && ops->new_node != NULL) |
15823 | 1293 ops->new_node((PurpleBlistNode *)chat); |
1294 | |
1295 PURPLE_DBUS_REGISTER_POINTER(chat, PurpleChat); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1296 return chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1297 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1298 |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1299 void |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1300 purple_chat_destroy(PurpleChat *chat) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1301 { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1302 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:
25416
diff
changeset
|
1303 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:
25416
diff
changeset
|
1304 g_free(chat->alias); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1305 PURPLE_DBUS_UNREGISTER_POINTER(chat); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1306 g_free(chat); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1307 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1308 |
25416
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
1309 PurpleBuddy *purple_buddy_new(PurpleAccount *account, const char *name, const char *alias) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1310 { |
15823 | 1311 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1312 PurpleBuddy *buddy; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1313 |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1314 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:
26967
diff
changeset
|
1315 g_return_val_if_fail(name != NULL, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1316 |
15823 | 1317 buddy = g_new0(PurpleBuddy, 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1318 buddy->account = account; |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1319 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:
26967
diff
changeset
|
1320 buddy->alias = purple_utf8_strip_unprintables(alias); |
15823 | 1321 buddy->presence = purple_presence_new_for_buddy(buddy); |
1322 ((PurpleBlistNode *)buddy)->type = PURPLE_BLIST_BUDDY_NODE; | |
1323 | |
1324 purple_presence_set_status_active(buddy->presence, "offline", TRUE); | |
1325 | |
1326 purple_blist_node_initialize_settings((PurpleBlistNode *)buddy); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1327 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1328 if (ops && ops->new_node) |
15823 | 1329 ops->new_node((PurpleBlistNode *)buddy); |
1330 | |
1331 PURPLE_DBUS_REGISTER_POINTER(buddy, PurpleBuddy); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1332 return buddy; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1333 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1334 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1335 void |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1336 purple_buddy_destroy(PurpleBuddy *buddy) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1337 { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1338 PurplePlugin *prpl; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1339 PurplePluginProtocolInfo *prpl_info; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1340 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1341 /* |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1342 * 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:
25416
diff
changeset
|
1343 * can free proto_data |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1344 */ |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1345 prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account)); |
26609
9a2e4aebfa91
Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26602
diff
changeset
|
1346 if (prpl) { |
9a2e4aebfa91
Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26602
diff
changeset
|
1347 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
9a2e4aebfa91
Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26602
diff
changeset
|
1348 if (prpl_info && prpl_info->buddy_free) |
9a2e4aebfa91
Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26602
diff
changeset
|
1349 prpl_info->buddy_free(buddy); |
9a2e4aebfa91
Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26602
diff
changeset
|
1350 } |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1351 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1352 /* Delete the node */ |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1353 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:
25416
diff
changeset
|
1354 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:
25416
diff
changeset
|
1355 purple_presence_destroy(buddy->presence); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1356 g_free(buddy->name); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1357 g_free(buddy->alias); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1358 g_free(buddy->server_alias); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1359 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1360 PURPLE_DBUS_UNREGISTER_POINTER(buddy); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1361 g_free(buddy); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1362 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1363 /* 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:
25416
diff
changeset
|
1364 * 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:
25416
diff
changeset
|
1365 * 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:
25416
diff
changeset
|
1366 * 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:
25416
diff
changeset
|
1367 * be removed. */ |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1368 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:
25416
diff
changeset
|
1369 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1370 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1371 void |
15823 | 1372 purple_buddy_set_icon(PurpleBuddy *buddy, PurpleBuddyIcon *icon) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1373 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1374 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1375 |
16373
c9b4ff420140
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
1376 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:
15823
diff
changeset
|
1377 { |
c9b4ff420140
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
1378 purple_buddy_icon_unref(buddy->icon); |
15823 | 1379 buddy->icon = (icon != NULL ? purple_buddy_icon_ref(icon) : NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1380 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1381 |
15823 | 1382 purple_signal_emit(purple_blist_get_handle(), "buddy-icon-changed", buddy); |
1383 | |
23119
21636ef92dbb
Update some calls to the functions I just deprecated.
Etan Reisner <pidgin@unreliablesource.net>
parents:
23117
diff
changeset
|
1384 purple_blist_update_node_icon((PurpleBlistNode*)buddy); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1385 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1386 |
15823 | 1387 PurpleAccount * |
1388 purple_buddy_get_account(const PurpleBuddy *buddy) | |
15374
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 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
|
1391 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1392 return buddy->account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1393 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1394 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1395 const char * |
15823 | 1396 purple_buddy_get_name(const PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1397 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1398 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
|
1399 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1400 return buddy->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1401 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1402 |
15823 | 1403 PurpleBuddyIcon * |
1404 purple_buddy_get_icon(const PurpleBuddy *buddy) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1405 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1406 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
|
1407 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1408 return buddy->icon; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1409 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1410 |
25278
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1411 gpointer |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1412 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:
24275
diff
changeset
|
1413 { |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1414 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:
24275
diff
changeset
|
1415 |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1416 return buddy->proto_data; |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1417 } |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1418 |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1419 void |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1420 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:
24275
diff
changeset
|
1421 { |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1422 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:
24275
diff
changeset
|
1423 |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1424 buddy->proto_data = data; |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1425 } |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1426 |
12b8ccc3e9ec
Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents:
24275
diff
changeset
|
1427 |
15823 | 1428 void purple_blist_add_chat(PurpleChat *chat, PurpleGroup *group, PurpleBlistNode *node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1429 { |
15823 | 1430 PurpleBlistNode *cnode = (PurpleBlistNode*)chat; |
1431 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1432 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1433 g_return_if_fail(chat != NULL); |
15823 | 1434 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT((PurpleBlistNode *)chat)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1435 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1436 if (node == NULL) { |
22986
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22922
diff
changeset
|
1437 if (group == NULL) |
15823 | 1438 group = purple_group_new(_("Chats")); |
22986
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22922
diff
changeset
|
1439 |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22922
diff
changeset
|
1440 /* 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:
22922
diff
changeset
|
1441 if (!purple_find_group(group->name)) { |
15823 | 1442 purple_blist_add_group(group, |
1443 purple_blist_get_last_sibling(purplebuddylist->root)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1444 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1445 } else { |
15823 | 1446 group = (PurpleGroup*)node->parent; |
15374
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1449 /* 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
|
1450 if (cnode == node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1451 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1452 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1453 if (cnode->parent) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1454 /* 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
|
1455 * being moved. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1456 */ |
15823 | 1457 ((PurpleGroup *)cnode->parent)->totalsize--; |
1458 if (purple_account_is_connected(chat->account)) { | |
1459 ((PurpleGroup *)cnode->parent)->online--; | |
1460 ((PurpleGroup *)cnode->parent)->currentsize--; | |
15374
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 if (cnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1463 cnode->next->prev = cnode->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1464 if (cnode->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1465 cnode->prev->next = cnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1466 if (cnode->parent->child == cnode) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1467 cnode->parent->child = cnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1468 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1469 if (ops && ops->remove) |
15823 | 1470 ops->remove(purplebuddylist, cnode); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1471 /* 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
|
1472 * reinitialize it */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1473 if (ops && ops->new_node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1474 ops->new_node(cnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1475 |
15823 | 1476 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1477 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1478 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1479 if (node != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1480 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1481 node->next->prev = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1482 cnode->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1483 cnode->prev = node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1484 cnode->parent = node->parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1485 node->next = cnode; |
15823 | 1486 ((PurpleGroup *)node->parent)->totalsize++; |
1487 if (purple_account_is_connected(chat->account)) { | |
1488 ((PurpleGroup *)node->parent)->online++; | |
1489 ((PurpleGroup *)node->parent)->currentsize++; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1490 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1491 } else { |
15823 | 1492 if (((PurpleBlistNode *)group)->child) |
1493 ((PurpleBlistNode *)group)->child->prev = cnode; | |
1494 cnode->next = ((PurpleBlistNode *)group)->child; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1495 cnode->prev = NULL; |
15823 | 1496 ((PurpleBlistNode *)group)->child = cnode; |
1497 cnode->parent = (PurpleBlistNode *)group; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1498 group->totalsize++; |
15823 | 1499 if (purple_account_is_connected(chat->account)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1500 group->online++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1501 group->currentsize++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1502 } |
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 |
15823 | 1505 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1506 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1507 if (ops && ops->update) |
15823 | 1508 ops->update(purplebuddylist, (PurpleBlistNode *)cnode); |
26878
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
1509 |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
1510 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:
26846
diff
changeset
|
1511 cnode); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1512 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1513 |
15823 | 1514 void purple_blist_add_buddy(PurpleBuddy *buddy, PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1515 { |
15823 | 1516 PurpleBlistNode *cnode, *bnode; |
1517 PurpleGroup *g; | |
1518 PurpleContact *c; | |
1519 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); | |
26846
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:
26630
diff
changeset
|
1520 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:
26630
diff
changeset
|
1521 GHashTable *account_buddies; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1522 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1523 g_return_if_fail(buddy != NULL); |
15823 | 1524 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY((PurpleBlistNode*)buddy)); |
1525 | |
1526 bnode = (PurpleBlistNode *)buddy; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1527 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1528 /* 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
|
1529 if (bnode == node || (!node && bnode->parent && |
15823 | 1530 contact && bnode->parent == (PurpleBlistNode*)contact |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1531 && bnode == bnode->parent->child)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1532 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1533 |
15823 | 1534 if (node && PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
1535 c = (PurpleContact*)node->parent; | |
1536 g = (PurpleGroup*)node->parent->parent; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 } else if (contact) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1538 c = contact; |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
1539 g = PURPLE_GROUP(PURPLE_BLIST_NODE(c)->parent); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1540 } else { |
22986
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22922
diff
changeset
|
1541 g = group; |
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22922
diff
changeset
|
1542 if (g == NULL) |
15823 | 1543 g = purple_group_new(_("Buddies")); |
22986
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22922
diff
changeset
|
1544 /* 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:
22922
diff
changeset
|
1545 if (!purple_find_group(g->name)) { |
15823 | 1546 purple_blist_add_group(g, |
1547 purple_blist_get_last_sibling(purplebuddylist->root)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1548 } |
15823 | 1549 c = purple_contact_new(); |
1550 purple_blist_add_contact(c, g, | |
1551 purple_blist_get_last_child((PurpleBlistNode*)g)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1552 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1553 |
15823 | 1554 cnode = (PurpleBlistNode *)c; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1555 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 if (bnode->parent) { |
15823 | 1557 if (PURPLE_BUDDY_IS_ONLINE(buddy)) { |
1558 ((PurpleContact*)bnode->parent)->online--; | |
1559 if (((PurpleContact*)bnode->parent)->online == 0) | |
1560 ((PurpleGroup*)bnode->parent->parent)->online--; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 } |
15823 | 1562 if (purple_account_is_connected(buddy->account)) { |
1563 ((PurpleContact*)bnode->parent)->currentsize--; | |
1564 if (((PurpleContact*)bnode->parent)->currentsize == 0) | |
1565 ((PurpleGroup*)bnode->parent->parent)->currentsize--; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1566 } |
15823 | 1567 ((PurpleContact*)bnode->parent)->totalsize--; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1568 /* 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
|
1569 |
15823 | 1570 if (bnode->parent->parent != (PurpleBlistNode*)g) |
1571 serv_move_buddy(buddy, (PurpleGroup *)bnode->parent->parent, g); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1572 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1573 if (bnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1574 bnode->next->prev = bnode->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1575 if (bnode->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1576 bnode->prev->next = bnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1577 if (bnode->parent->child == bnode) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1578 bnode->parent->child = bnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1579 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1580 if (ops && ops->remove) |
15823 | 1581 ops->remove(purplebuddylist, bnode); |
1582 | |
1583 purple_blist_schedule_save(); | |
1584 | |
1585 if (bnode->parent->parent != (PurpleBlistNode*)g) { | |
1586 hb = g_new(struct _purple_hbuddy, 1); | |
1587 hb->name = g_strdup(purple_normalize(buddy->account, buddy->name)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1588 hb->account = buddy->account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1589 hb->group = bnode->parent->parent; |
15823 | 1590 g_hash_table_remove(purplebuddylist->buddies, hb); |
26846
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:
26630
diff
changeset
|
1591 |
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:
26630
diff
changeset
|
1592 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:
26630
diff
changeset
|
1593 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:
26630
diff
changeset
|
1594 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1595 g_free(hb->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1596 g_free(hb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1597 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1598 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1599 if (!bnode->parent->child) { |
15823 | 1600 purple_blist_remove_contact((PurpleContact*)bnode->parent); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1601 } else { |
15823 | 1602 purple_contact_invalidate_priority_buddy((PurpleContact*)bnode->parent); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1603 if (ops && ops->update) |
15823 | 1604 ops->update(purplebuddylist, bnode->parent); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1605 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1606 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1607 |
15823 | 1608 if (node && PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1609 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1610 node->next->prev = bnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1611 bnode->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1612 bnode->prev = node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1613 bnode->parent = node->parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1614 node->next = bnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1615 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1616 if (cnode->child) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1617 cnode->child->prev = bnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1618 bnode->prev = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1619 bnode->next = cnode->child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1620 cnode->child = bnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 bnode->parent = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1622 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1623 |
15823 | 1624 if (PURPLE_BUDDY_IS_ONLINE(buddy)) { |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
1625 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:
25312
diff
changeset
|
1626 PURPLE_GROUP(bnode->parent->parent)->online++; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1627 } |
15823 | 1628 if (purple_account_is_connected(buddy->account)) { |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
1629 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:
25312
diff
changeset
|
1630 PURPLE_GROUP(bnode->parent->parent)->currentsize++; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 } |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
1632 PURPLE_CONTACT(bnode->parent)->totalsize++; |
15823 | 1633 |
1634 hb = g_new(struct _purple_hbuddy, 1); | |
1635 hb->name = g_strdup(purple_normalize(buddy->account, buddy->name)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1636 hb->account = buddy->account; |
15823 | 1637 hb->group = ((PurpleBlistNode*)buddy)->parent->parent; |
1638 | |
1639 g_hash_table_replace(purplebuddylist->buddies, hb, buddy); | |
1640 | |
26846
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:
26630
diff
changeset
|
1641 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:
26630
diff
changeset
|
1642 |
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:
26630
diff
changeset
|
1643 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:
26630
diff
changeset
|
1644 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:
26630
diff
changeset
|
1645 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:
26630
diff
changeset
|
1646 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:
26630
diff
changeset
|
1647 |
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:
26630
diff
changeset
|
1648 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:
26630
diff
changeset
|
1649 |
15823 | 1650 purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy)); |
1651 | |
1652 purple_blist_schedule_save(); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1653 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1654 if (ops && ops->update) |
15823 | 1655 ops->update(purplebuddylist, (PurpleBlistNode*)buddy); |
15374
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 /* Signal that the buddy has been added */ |
15823 | 1658 purple_signal_emit(purple_blist_get_handle(), "buddy-added", buddy); |
26878
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
1659 |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
1660 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:
26846
diff
changeset
|
1661 PURPLE_BLIST_NODE(buddy)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1662 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1663 |
15823 | 1664 PurpleContact *purple_contact_new() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1665 { |
15823 | 1666 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1667 | |
1668 PurpleContact *contact = g_new0(PurpleContact, 1); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1669 contact->totalsize = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1670 contact->currentsize = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1671 contact->online = 0; |
15823 | 1672 purple_blist_node_initialize_settings((PurpleBlistNode *)contact); |
1673 ((PurpleBlistNode *)contact)->type = PURPLE_BLIST_CONTACT_NODE; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1674 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1675 if (ops && ops->new_node) |
15823 | 1676 ops->new_node((PurpleBlistNode *)contact); |
1677 | |
1678 PURPLE_DBUS_REGISTER_POINTER(contact, PurpleContact); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1679 return contact; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1680 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1681 |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1682 void |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1683 purple_contact_destroy(PurpleContact *contact) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1684 { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1685 g_hash_table_destroy(contact->node.settings); |
26630
3e274d6fcfaa
Plug leak of PurpleContact->alias
Paul Aurich <paul@darkrain42.org>
parents:
26625
diff
changeset
|
1686 g_free(contact->alias); |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1687 PURPLE_DBUS_UNREGISTER_POINTER(contact); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1688 g_free(contact); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1689 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1690 |
15823 | 1691 void purple_contact_set_alias(PurpleContact *contact, const char *alias) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1692 { |
20550
28493a27849b
Looking at purple_contact_set_alias and purple_blist_alias_contact functions
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20205
diff
changeset
|
1693 purple_blist_alias_contact(contact,alias); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1694 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1695 |
15823 | 1696 const char *purple_contact_get_alias(PurpleContact* contact) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1697 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1698 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
|
1699 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1700 if (contact->alias) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1701 return contact->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1702 |
15823 | 1703 return purple_buddy_get_alias(purple_contact_get_priority_buddy(contact)); |
15374
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 |
15823 | 1706 gboolean purple_contact_on_account(PurpleContact *c, PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1707 { |
15823 | 1708 PurpleBlistNode *bnode, *cnode = (PurpleBlistNode *) c; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1709 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1710 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
|
1711 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
|
1712 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1713 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
15823 | 1714 PurpleBuddy *buddy; |
1715 | |
1716 if (! PURPLE_BLIST_NODE_IS_BUDDY(bnode)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1717 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1718 |
15823 | 1719 buddy = (PurpleBuddy *)bnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1720 if (buddy->account == account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1721 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1722 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1723 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1724 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1725 |
15823 | 1726 void purple_contact_invalidate_priority_buddy(PurpleContact *contact) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1727 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1728 g_return_if_fail(contact != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1729 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1730 contact->priority_valid = FALSE; |
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 |
15823 | 1733 PurpleGroup *purple_group_new(const char *name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1734 { |
15823 | 1735 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1736 PurpleGroup *group; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1737 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1738 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
|
1739 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
|
1740 |
15823 | 1741 group = purple_find_group(name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1742 if (group != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1743 return group; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1744 |
15823 | 1745 group = g_new0(PurpleGroup, 1); |
27106
c59918579c3a
Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents:
26967
diff
changeset
|
1746 group->name = purple_utf8_strip_unprintables(name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1747 group->totalsize = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1748 group->currentsize = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1749 group->online = 0; |
15823 | 1750 purple_blist_node_initialize_settings((PurpleBlistNode *)group); |
1751 ((PurpleBlistNode *)group)->type = PURPLE_BLIST_GROUP_NODE; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1752 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1753 if (ops && ops->new_node) |
15823 | 1754 ops->new_node((PurpleBlistNode *)group); |
1755 | |
1756 PURPLE_DBUS_REGISTER_POINTER(group, PurpleGroup); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1757 return group; |
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 |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1760 void |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1761 purple_group_destroy(PurpleGroup *group) |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1762 { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1763 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:
25416
diff
changeset
|
1764 g_free(group->name); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1765 PURPLE_DBUS_UNREGISTER_POINTER(group); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1766 g_free(group); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1767 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
1768 |
15823 | 1769 void purple_blist_add_contact(PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1770 { |
15823 | 1771 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
1772 PurpleGroup *g; | |
1773 PurpleBlistNode *gnode, *cnode, *bnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1774 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1775 g_return_if_fail(contact != NULL); |
15823 | 1776 g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT((PurpleBlistNode*)contact)); |
1777 | |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
1778 if (PURPLE_BLIST_NODE(contact) == node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1779 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1780 |
15823 | 1781 if (node && (PURPLE_BLIST_NODE_IS_CONTACT(node) || |
1782 PURPLE_BLIST_NODE_IS_CHAT(node))) | |
1783 g = (PurpleGroup*)node->parent; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1784 else if (group) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1785 g = group; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1786 else { |
22986
493239b86bf6
When defaulting a group, don't move it to the bottom if it exists.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22922
diff
changeset
|
1787 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:
22922
diff
changeset
|
1788 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:
22922
diff
changeset
|
1789 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:
22922
diff
changeset
|
1790 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:
22922
diff
changeset
|
1791 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:
22922
diff
changeset
|
1792 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1793 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1794 |
15823 | 1795 gnode = (PurpleBlistNode*)g; |
1796 cnode = (PurpleBlistNode*)contact; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1797 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1798 if (cnode->parent) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1799 if (cnode->parent->child == cnode) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1800 cnode->parent->child = cnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1801 if (cnode->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1802 cnode->prev->next = cnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1803 if (cnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1804 cnode->next->prev = cnode->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1805 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1806 if (cnode->parent != gnode) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1807 bnode = cnode->child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1808 while (bnode) { |
15823 | 1809 PurpleBlistNode *next_bnode = bnode->next; |
1810 PurpleBuddy *b = (PurpleBuddy*)bnode; | |
26846
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:
26630
diff
changeset
|
1811 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:
26630
diff
changeset
|
1812 |
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:
26630
diff
changeset
|
1813 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:
26630
diff
changeset
|
1814 |
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:
26630
diff
changeset
|
1815 hb = g_new(struct _purple_hbuddy, 1); |
15823 | 1816 hb->name = g_strdup(purple_normalize(b->account, b->name)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1817 hb->account = b->account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1818 hb->group = cnode->parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1819 |
15823 | 1820 g_hash_table_remove(purplebuddylist->buddies, hb); |
1821 | |
26846
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:
26630
diff
changeset
|
1822 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:
26630
diff
changeset
|
1823 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:
26630
diff
changeset
|
1824 |
15823 | 1825 if (!purple_find_buddy_in_group(b->account, b->name, g)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1826 hb->group = gnode; |
15823 | 1827 g_hash_table_replace(purplebuddylist->buddies, hb, b); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1828 |
26846
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:
26630
diff
changeset
|
1829 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:
26630
diff
changeset
|
1830 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:
26630
diff
changeset
|
1831 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:
26630
diff
changeset
|
1832 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:
26630
diff
changeset
|
1833 |
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:
26630
diff
changeset
|
1834 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:
26630
diff
changeset
|
1835 |
22317
6fc8f0c825e0
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22262
diff
changeset
|
1836 if (purple_account_get_connection(b->account)) |
15823 | 1837 serv_move_buddy(b, (PurpleGroup *)cnode->parent, g); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1838 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1839 gboolean empty_contact = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1840 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1841 /* 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
|
1842 * gonna delete it instead */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1843 g_free(hb->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1844 g_free(hb); |
22317
6fc8f0c825e0
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22262
diff
changeset
|
1845 if (purple_account_get_connection(b->account)) |
15823 | 1846 purple_account_remove_buddy(b->account, b, (PurpleGroup *)cnode->parent); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1847 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1848 if (!cnode->child->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1849 empty_contact = TRUE; |
15823 | 1850 purple_blist_remove_buddy(b); |
1851 | |
1852 /** in purple_blist_remove_buddy(), if the last buddy in a | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1853 * 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
|
1854 * 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
|
1855 if (empty_contact) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1856 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1857 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1858 bnode = next_bnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1859 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1860 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1861 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1862 if (contact->online > 0) |
15823 | 1863 ((PurpleGroup*)cnode->parent)->online--; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1864 if (contact->currentsize > 0) |
15823 | 1865 ((PurpleGroup*)cnode->parent)->currentsize--; |
1866 ((PurpleGroup*)cnode->parent)->totalsize--; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1867 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1868 if (ops && ops->remove) |
15823 | 1869 ops->remove(purplebuddylist, cnode); |
1870 | |
1871 purple_blist_schedule_save(); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1872 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1873 |
15823 | 1874 if (node && (PURPLE_BLIST_NODE_IS_CONTACT(node) || |
1875 PURPLE_BLIST_NODE_IS_CHAT(node))) { | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1876 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1877 node->next->prev = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1878 cnode->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1879 cnode->prev = node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1880 cnode->parent = node->parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1881 node->next = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1882 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1883 if (gnode->child) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1884 gnode->child->prev = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1885 cnode->prev = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1886 cnode->next = gnode->child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1887 gnode->child = cnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1888 cnode->parent = gnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1889 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1890 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1891 if (contact->online > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1892 g->online++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1893 if (contact->currentsize > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1894 g->currentsize++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1895 g->totalsize++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1896 |
15823 | 1897 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1898 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1899 if (ops && ops->update) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1900 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1901 if (cnode->child) |
15823 | 1902 ops->update(purplebuddylist, cnode); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1903 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1904 for (bnode = cnode->child; bnode; bnode = bnode->next) |
15823 | 1905 ops->update(purplebuddylist, bnode); |
15374
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1908 |
15823 | 1909 void purple_blist_merge_contact(PurpleContact *source, PurpleBlistNode *node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1910 { |
15823 | 1911 PurpleBlistNode *sourcenode = (PurpleBlistNode*)source; |
1912 PurpleBlistNode *prev, *cur, *next; | |
1913 PurpleContact *target; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1914 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1915 g_return_if_fail(source != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1916 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1917 |
15823 | 1918 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
1919 target = (PurpleContact *)node; | |
1920 prev = purple_blist_get_last_child(node); | |
1921 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | |
1922 target = (PurpleContact *)node->parent; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1923 prev = node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1924 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1925 return; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1928 if (source == target || !target) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1929 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1930 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1931 next = sourcenode->child; |
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 while (next) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1934 cur = next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1935 next = cur->next; |
15823 | 1936 if (PURPLE_BLIST_NODE_IS_BUDDY(cur)) { |
1937 purple_blist_add_buddy((PurpleBuddy *)cur, target, NULL, prev); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1938 prev = cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1939 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1940 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1941 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1942 |
15823 | 1943 void purple_blist_add_group(PurpleGroup *group, PurpleBlistNode *node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1944 { |
15823 | 1945 PurpleBlistUiOps *ops; |
1946 PurpleBlistNode *gnode = (PurpleBlistNode*)group; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1947 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1948 g_return_if_fail(group != NULL); |
15823 | 1949 g_return_if_fail(PURPLE_BLIST_NODE_IS_GROUP((PurpleBlistNode *)group)); |
1950 | |
1951 ops = purple_blist_get_ui_ops(); | |
1952 | |
1953 if (!purplebuddylist->root) { | |
1954 purplebuddylist->root = gnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1955 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1956 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1957 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1958 /* 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
|
1959 if (gnode == node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1960 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1961 |
15823 | 1962 if (purple_find_group(group->name)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1963 /* This is just being moved */ |
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->remove) |
15823 | 1966 ops->remove(purplebuddylist, (PurpleBlistNode *)group); |
1967 | |
1968 if (gnode == purplebuddylist->root) | |
1969 purplebuddylist->root = gnode->next; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1970 if (gnode->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1971 gnode->prev->next = gnode->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1972 if (gnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1973 gnode->next->prev = gnode->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1974 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1975 |
15823 | 1976 if (node && PURPLE_BLIST_NODE_IS_GROUP(node)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1977 gnode->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1978 gnode->prev = node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1979 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1980 node->next->prev = gnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1981 node->next = gnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1982 } else { |
15823 | 1983 if (purplebuddylist->root) |
1984 purplebuddylist->root->prev = gnode; | |
1985 gnode->next = purplebuddylist->root; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1986 gnode->prev = NULL; |
15823 | 1987 purplebuddylist->root = gnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1988 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1989 |
15823 | 1990 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1991 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1992 if (ops && ops->update) { |
15823 | 1993 ops->update(purplebuddylist, gnode); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1994 for (node = gnode->child; node; node = node->next) |
15823 | 1995 ops->update(purplebuddylist, node); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1996 } |
26878
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
1997 |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
1998 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:
26846
diff
changeset
|
1999 gnode); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2000 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2001 |
15823 | 2002 void purple_blist_remove_contact(PurpleContact *contact) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2003 { |
15823 | 2004 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2005 PurpleBlistNode *node, *gnode; | |
15374
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 g_return_if_fail(contact != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2008 |
15823 | 2009 node = (PurpleBlistNode *)contact; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2010 gnode = node->parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2011 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2012 if (node->child) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2013 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2014 * 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
|
2015 * 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
|
2016 * deleted. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2017 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2018 while (node->child->next) { |
15823 | 2019 purple_blist_remove_buddy((PurpleBuddy*)node->child); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2020 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2021 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2022 * 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
|
2023 * 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
|
2024 * 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
|
2025 */ |
15823 | 2026 purple_blist_remove_buddy((PurpleBuddy*)node->child); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2027 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2028 /* Remove the node from its parent */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2029 if (gnode->child == node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2030 gnode->child = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2031 if (node->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2032 node->prev->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2033 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2034 node->next->prev = node->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2035 |
15823 | 2036 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2037 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2038 /* Update the UI */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2039 if (ops && ops->remove) |
15823 | 2040 ops->remove(purplebuddylist, node); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2041 |
26878
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
2042 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:
26846
diff
changeset
|
2043 PURPLE_BLIST_NODE(contact)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
2044 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2045 /* Delete the node */ |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2046 purple_contact_destroy(contact); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2047 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2048 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2049 |
15823 | 2050 void purple_blist_remove_buddy(PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2051 { |
15823 | 2052 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2053 PurpleBlistNode *node, *cnode, *gnode; | |
2054 PurpleContact *contact; | |
2055 PurpleGroup *group; | |
2056 struct _purple_hbuddy hb; | |
26846
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:
26630
diff
changeset
|
2057 GHashTable *account_buddies; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2058 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2059 g_return_if_fail(buddy != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2060 |
15823 | 2061 node = (PurpleBlistNode *)buddy; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2062 cnode = node->parent; |
17821
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2063 gnode = (cnode != NULL) ? cnode->parent : NULL; |
15823 | 2064 contact = (PurpleContact *)cnode; |
2065 group = (PurpleGroup *)gnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2066 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2067 /* Remove the node from its parent */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2068 if (node->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2069 node->prev->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2070 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2071 node->next->prev = node->prev; |
17821
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2072 if ((cnode != NULL) && (cnode->child == node)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2073 cnode->child = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2074 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2075 /* Adjust size counts */ |
17821
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2076 if (contact != NULL) { |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2077 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:
16809
diff
changeset
|
2078 contact->online--; |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2079 if (contact->online == 0) |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2080 group->online--; |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2081 } |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2082 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:
16809
diff
changeset
|
2083 contact->currentsize--; |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2084 if (contact->currentsize == 0) |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2085 group->currentsize--; |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2086 } |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2087 contact->totalsize--; |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2088 |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2089 /* Re-sort the contact */ |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2090 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:
16809
diff
changeset
|
2091 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:
16809
diff
changeset
|
2092 if (ops && ops->update) |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2093 ops->update(purplebuddylist, cnode); |
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2094 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2095 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2096 |
15823 | 2097 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2098 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2099 /* Remove this buddy from the buddies hash table */ |
15823 | 2100 hb.name = g_strdup(purple_normalize(buddy->account, buddy->name)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2101 hb.account = buddy->account; |
17821
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2102 hb.group = gnode; |
15823 | 2103 g_hash_table_remove(purplebuddylist->buddies, &hb); |
26846
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:
26630
diff
changeset
|
2104 |
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:
26630
diff
changeset
|
2105 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:
26630
diff
changeset
|
2106 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:
26630
diff
changeset
|
2107 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2108 g_free(hb.name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2109 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2110 /* Update the UI */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2111 if (ops && ops->remove) |
15823 | 2112 ops->remove(purplebuddylist, node); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2113 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2114 /* Signal that the buddy has been removed before freeing the memory for it */ |
15823 | 2115 purple_signal_emit(purple_blist_get_handle(), "buddy-removed", buddy); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2116 |
26878
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
2117 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:
26846
diff
changeset
|
2118 PURPLE_BLIST_NODE(buddy)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
2119 |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2120 purple_buddy_destroy(buddy); |
15374
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 /* If the contact is empty then remove it */ |
17821
9fafe265567f
Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents:
16809
diff
changeset
|
2123 if ((contact != NULL) && !cnode->child) |
15823 | 2124 purple_blist_remove_contact(contact); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2125 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2126 |
15823 | 2127 void purple_blist_remove_chat(PurpleChat *chat) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2128 { |
15823 | 2129 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2130 PurpleBlistNode *node, *gnode; | |
2131 PurpleGroup *group; | |
15374
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(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2134 |
15823 | 2135 node = (PurpleBlistNode *)chat; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2136 gnode = node->parent; |
15823 | 2137 group = (PurpleGroup *)gnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2138 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2139 if (gnode != NULL) |
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 (gnode->child == node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2143 gnode->child = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2144 if (node->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2145 node->prev->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2146 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2147 node->next->prev = node->prev; |
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 */ |
15823 | 2150 if (purple_account_is_connected(chat->account)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2151 group->online--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2152 group->currentsize--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2153 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2154 group->totalsize--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2155 |
15823 | 2156 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2157 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2158 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2159 /* Update the UI */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2160 if (ops && ops->remove) |
15823 | 2161 ops->remove(purplebuddylist, node); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2162 |
26878
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
2163 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:
26846
diff
changeset
|
2164 PURPLE_BLIST_NODE(chat)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
2165 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2166 /* Delete the node */ |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2167 purple_chat_destroy(chat); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2168 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2169 |
15823 | 2170 void purple_blist_remove_group(PurpleGroup *group) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2171 { |
15823 | 2172 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2173 PurpleBlistNode *node; | |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2174 GList *l; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2175 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2176 g_return_if_fail(group != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2177 |
15823 | 2178 node = (PurpleBlistNode *)group; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2179 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2180 /* Make sure the group is empty */ |
15679
5ec709327dc6
Remove a few unneeded strings, per evans's recommendation
Sean Egan <seanegan@gmail.com>
parents:
15421
diff
changeset
|
2181 if (node->child) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2182 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2183 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2184 /* Remove the node from its parent */ |
15823 | 2185 if (purplebuddylist->root == node) |
2186 purplebuddylist->root = node->next; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2187 if (node->prev) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2188 node->prev->next = node->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2189 if (node->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2190 node->next->prev = node->prev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2191 |
15823 | 2192 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2193 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2194 /* Update the UI */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2195 if (ops && ops->remove) |
15823 | 2196 ops->remove(purplebuddylist, node); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2197 |
26878
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
2198 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:
26846
diff
changeset
|
2199 PURPLE_BLIST_NODE(group)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
2200 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2201 /* Remove the group from all accounts that are online */ |
15823 | 2202 for (l = purple_connections_get_all(); l != NULL; l = l->next) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2203 { |
15823 | 2204 PurpleConnection *gc = (PurpleConnection *)l->data; |
2205 | |
2206 if (purple_connection_get_state(gc) == PURPLE_CONNECTED) | |
2207 purple_account_remove_group(purple_connection_get_account(gc), group); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2208 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2209 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2210 /* Delete the node */ |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2211 purple_group_destroy(group); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2212 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2213 |
15823 | 2214 PurpleBuddy *purple_contact_get_priority_buddy(PurpleContact *contact) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2215 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2216 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
|
2217 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2218 if (!contact->priority_valid) |
15823 | 2219 purple_contact_compute_priority_buddy(contact); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2220 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2221 return contact->priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2222 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2223 |
15823 | 2224 const char *purple_buddy_get_alias_only(PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2225 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2226 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
|
2227 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2228 if ((buddy->alias != NULL) && (*buddy->alias != '\0')) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2229 return buddy->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2230 } else if ((buddy->server_alias != NULL) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2231 (*buddy->server_alias != '\0')) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2232 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2233 return buddy->server_alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2234 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2235 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2236 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2237 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2238 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2239 |
15823 | 2240 const char *purple_buddy_get_contact_alias(PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2241 { |
15823 | 2242 PurpleContact *c; |
15374
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 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
|
2245 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2246 /* 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
|
2247 /* The buddy alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2248 if (buddy->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2249 return buddy->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2250 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2251 /* The contact alias */ |
15823 | 2252 c = purple_buddy_get_contact(buddy); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2253 if ((c != NULL) && (c->alias != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2254 return c->alias; |
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 /* The server alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2257 if ((buddy->server_alias) && (*buddy->server_alias)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2258 return buddy->server_alias; |
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 /* 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
|
2261 return buddy->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2262 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2263 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2264 |
15823 | 2265 const char *purple_buddy_get_alias(PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2266 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2267 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
|
2268 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2269 /* 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
|
2270 /* The buddy alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2271 if (buddy->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2272 return buddy->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2273 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2274 /* The server alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2275 if ((buddy->server_alias) && (*buddy->server_alias)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2276 return buddy->server_alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2277 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2278 /* 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
|
2279 return buddy->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2280 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2281 |
25294
8aa7d8bcbc7d
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25288
diff
changeset
|
2282 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:
25288
diff
changeset
|
2283 { |
8aa7d8bcbc7d
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25288
diff
changeset
|
2284 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:
25288
diff
changeset
|
2285 return buddy->alias; |
8aa7d8bcbc7d
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25288
diff
changeset
|
2286 } |
8aa7d8bcbc7d
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25288
diff
changeset
|
2287 |
15823 | 2288 const char *purple_buddy_get_server_alias(PurpleBuddy *buddy) |
15374
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 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
|
2291 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2292 if ((buddy->server_alias) && (*buddy->server_alias)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2293 return buddy->server_alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2294 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2295 return NULL; |
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 |
15823 | 2298 const char *purple_buddy_get_local_alias(PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2299 { |
15823 | 2300 PurpleContact *c; |
15374
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 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
|
2303 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2304 /* 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
|
2305 /* The buddy alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2306 if (buddy->alias != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2307 return buddy->alias; |
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 /* The contact alias */ |
15823 | 2310 c = purple_buddy_get_contact(buddy); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2311 if ((c != NULL) && (c->alias != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2312 return c->alias; |
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 /* 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
|
2315 return buddy->name; |
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 |
15823 | 2318 const char *purple_chat_get_name(PurpleChat *chat) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2319 { |
22922
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22677
diff
changeset
|
2320 char *ret = NULL; |
16781
8a5fe6db7750
We don't really need an active connection to get the name of a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16779
diff
changeset
|
2321 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:
16779
diff
changeset
|
2322 PurplePluginProtocolInfo *prpl_info = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2323 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2324 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
|
2325 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2326 if ((chat->alias != NULL) && (*chat->alias != '\0')) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2327 return chat->alias; |
16781
8a5fe6db7750
We don't really need an active connection to get the name of a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16779
diff
changeset
|
2328 |
8a5fe6db7750
We don't really need an active connection to get the name of a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16779
diff
changeset
|
2329 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:
16779
diff
changeset
|
2330 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:
16779
diff
changeset
|
2331 |
22922
abb17e7e2e98
For chats created using the "normal" (i.e. Join a Chat) flow, there will always
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22677
diff
changeset
|
2332 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:
22677
diff
changeset
|
2333 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:
22677
diff
changeset
|
2334 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:
22677
diff
changeset
|
2335 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:
22677
diff
changeset
|
2336 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:
22677
diff
changeset
|
2337 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:
22677
diff
changeset
|
2338 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:
22677
diff
changeset
|
2339 } |
15374
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 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2342 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2343 |
15823 | 2344 PurpleBuddy *purple_find_buddy(PurpleAccount *account, const char *name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2345 { |
15823 | 2346 PurpleBuddy *buddy; |
2347 struct _purple_hbuddy hb; | |
2348 PurpleBlistNode *group; | |
2349 | |
2350 g_return_val_if_fail(purplebuddylist != NULL, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2351 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
|
2352 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
|
2353 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2354 hb.account = account; |
15823 | 2355 hb.name = g_strdup(purple_normalize(account, name)); |
2356 | |
2357 for (group = purplebuddylist->root; group; group = group->next) { | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2358 hb.group = group; |
15823 | 2359 if ((buddy = g_hash_table_lookup(purplebuddylist->buddies, &hb))) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2360 g_free(hb.name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2361 return buddy; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2362 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2363 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2364 g_free(hb.name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2365 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2366 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2367 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2368 |
15823 | 2369 PurpleBuddy *purple_find_buddy_in_group(PurpleAccount *account, const char *name, |
2370 PurpleGroup *group) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2371 { |
15823 | 2372 struct _purple_hbuddy hb; |
2373 PurpleBuddy *ret; | |
2374 | |
2375 g_return_val_if_fail(purplebuddylist != NULL, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2376 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
|
2377 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
|
2378 |
15823 | 2379 hb.name = g_strdup(purple_normalize(account, name)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2380 hb.account = account; |
15823 | 2381 hb.group = (PurpleBlistNode*)group; |
2382 | |
2383 ret = g_hash_table_lookup(purplebuddylist->buddies, &hb); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2384 g_free(hb.name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2385 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2386 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2387 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2388 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2389 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
|
2390 { |
15823 | 2391 PurpleBuddy *buddy = value; |
26846
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:
26630
diff
changeset
|
2392 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:
26630
diff
changeset
|
2393 |
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:
26630
diff
changeset
|
2394 *list = g_slist_prepend(*list, buddy); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2395 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2396 |
15823 | 2397 GSList *purple_find_buddies(PurpleAccount *account, const char *name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2398 { |
15823 | 2399 PurpleBuddy *buddy; |
2400 PurpleBlistNode *node; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2401 GSList *ret = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2402 |
15823 | 2403 g_return_val_if_fail(purplebuddylist != NULL, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2404 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
|
2405 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2406 if ((name != NULL) && (*name != '\0')) { |
15823 | 2407 struct _purple_hbuddy hb; |
2408 | |
2409 hb.name = g_strdup(purple_normalize(account, name)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2410 hb.account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2411 |
15823 | 2412 for (node = purplebuddylist->root; node != NULL; node = node->next) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2413 hb.group = node; |
15823 | 2414 if ((buddy = g_hash_table_lookup(purplebuddylist->buddies, &hb)) != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2415 ret = g_slist_prepend(ret, buddy); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2416 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2417 g_free(hb.name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2418 } else { |
26846
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:
26630
diff
changeset
|
2419 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:
26630
diff
changeset
|
2420 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:
26630
diff
changeset
|
2421 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:
26630
diff
changeset
|
2422 ret = list; |
15374
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2425 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2426 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2427 |
15823 | 2428 PurpleGroup *purple_find_group(const char *name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2429 { |
15823 | 2430 PurpleBlistNode *node; |
2431 | |
2432 g_return_val_if_fail(purplebuddylist != NULL, NULL); | |
15374
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 |
15823 | 2435 for (node = purplebuddylist->root; node != NULL; node = node->next) { |
23150
e2d28391d3fc
Make group names case insensitive, which is the case in the official MSN,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22677
diff
changeset
|
2436 if (!purple_utf8_strcasecmp(((PurpleGroup *)node)->name, name)) |
15823 | 2437 return (PurpleGroup *)node; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2438 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2439 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2440 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2441 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2442 |
15823 | 2443 PurpleChat * |
2444 purple_blist_find_chat(PurpleAccount *account, const char *name) | |
15374
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 char *chat_name; |
15823 | 2447 PurpleChat *chat; |
2448 PurplePlugin *prpl; | |
2449 PurplePluginProtocolInfo *prpl_info = NULL; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2450 struct proto_chat_entry *pce; |
15823 | 2451 PurpleBlistNode *node, *group; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2452 GList *parts; |
24387
123c78e48663
Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24292
diff
changeset
|
2453 char *normname; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2454 |
15823 | 2455 g_return_val_if_fail(purplebuddylist != NULL, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2456 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
|
2457 |
15823 | 2458 if (!purple_account_is_connected(account)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2459 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2460 |
15823 | 2461 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
2462 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2463 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2464 if (prpl_info->find_blist_chat != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2465 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
|
2466 |
24387
123c78e48663
Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24292
diff
changeset
|
2467 normname = g_strdup(purple_normalize(account, name)); |
15823 | 2468 for (group = purplebuddylist->root; group != NULL; group = group->next) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2469 for (node = group->child; node != NULL; node = node->next) { |
15823 | 2470 if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
2471 | |
2472 chat = (PurpleChat*)node; | |
15374
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 if (account != chat->account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2475 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2476 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2477 parts = prpl_info->chat_info( |
15823 | 2478 purple_account_get_connection(chat->account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2479 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2480 pce = parts->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2481 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
|
2482 pce->identifier); |
22677
04dc38d726fb
Leak fix. This is probably quite serious if you have busy chats on your
Stu Tomlinson <stu@nosnilmot.com>
parents:
22317
diff
changeset
|
2483 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:
22317
diff
changeset
|
2484 g_list_free(parts); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2485 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2486 if (chat->account == account && chat_name != NULL && |
24387
123c78e48663
Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24292
diff
changeset
|
2487 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:
24292
diff
changeset
|
2488 g_free(normname); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2489 return chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2490 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2491 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2492 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2493 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2494 |
24387
123c78e48663
Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24292
diff
changeset
|
2495 g_free(normname); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2496 return NULL; |
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 |
15823 | 2499 PurpleGroup * |
2500 purple_chat_get_group(PurpleChat *chat) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2501 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2502 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
|
2503 |
15823 | 2504 return (PurpleGroup *)(((PurpleBlistNode *)chat)->parent); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2505 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2506 |
22169
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2507 PurpleAccount * |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2508 purple_chat_get_account(PurpleChat *chat) |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2509 { |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2510 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
|
2511 |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2512 return chat->account; |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2513 } |
8c5d0180c326
Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2514 |
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
|
2515 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
|
2516 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
|
2517 { |
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
|
2518 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
|
2519 |
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
|
2520 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
|
2521 } |
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
|
2522 |
15823 | 2523 PurpleContact *purple_buddy_get_contact(PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2524 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2525 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
|
2526 |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25312
diff
changeset
|
2527 return PURPLE_CONTACT(PURPLE_BLIST_NODE(buddy)->parent); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2528 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2529 |
15823 | 2530 PurplePresence *purple_buddy_get_presence(const PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2531 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2532 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
|
2533 return buddy->presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2534 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2535 |
15823 | 2536 PurpleGroup *purple_buddy_get_group(PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2537 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2538 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
|
2539 |
15823 | 2540 if (((PurpleBlistNode *)buddy)->parent == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2541 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2542 |
15823 | 2543 return (PurpleGroup *)(((PurpleBlistNode*)buddy)->parent->parent); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2544 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2545 |
15823 | 2546 GSList *purple_group_get_accounts(PurpleGroup *group) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2547 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2548 GSList *l = NULL; |
15823 | 2549 PurpleBlistNode *gnode, *cnode, *bnode; |
2550 | |
2551 gnode = (PurpleBlistNode *)group; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2552 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2553 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
15823 | 2554 if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { |
2555 if (!g_slist_find(l, ((PurpleChat *)cnode)->account)) | |
2556 l = g_slist_append(l, ((PurpleChat *)cnode)->account); | |
2557 } else if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2558 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
15823 | 2559 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) { |
2560 if (!g_slist_find(l, ((PurpleBuddy *)bnode)->account)) | |
2561 l = g_slist_append(l, ((PurpleBuddy *)bnode)->account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2562 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2563 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2564 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2567 return l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2568 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2569 |
15823 | 2570 void purple_blist_add_account(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2571 { |
15823 | 2572 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2573 PurpleBlistNode *gnode, *cnode, *bnode; | |
2574 | |
2575 g_return_if_fail(purplebuddylist != NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2576 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2577 if (!ops || !ops->update) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2578 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2579 |
15823 | 2580 for (gnode = purplebuddylist->root; gnode; gnode = gnode->next) { |
2581 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2582 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2583 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
15823 | 2584 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2585 gboolean recompute = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2586 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
15823 | 2587 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode) && |
2588 ((PurpleBuddy*)bnode)->account == account) { | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2589 recompute = TRUE; |
15823 | 2590 ((PurpleContact*)cnode)->currentsize++; |
2591 if (((PurpleContact*)cnode)->currentsize == 1) | |
2592 ((PurpleGroup*)gnode)->currentsize++; | |
2593 ops->update(purplebuddylist, bnode); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2594 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2595 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2596 if (recompute || |
15823 | 2597 purple_blist_node_get_bool(cnode, "show_offline")) { |
2598 purple_contact_invalidate_priority_buddy((PurpleContact*)cnode); | |
2599 ops->update(purplebuddylist, cnode); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2600 } |
15823 | 2601 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode) && |
2602 ((PurpleChat*)cnode)->account == account) { | |
2603 ((PurpleGroup *)gnode)->online++; | |
2604 ((PurpleGroup *)gnode)->currentsize++; | |
2605 ops->update(purplebuddylist, cnode); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2606 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2607 } |
15823 | 2608 ops->update(purplebuddylist, gnode); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2609 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2610 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2611 |
15823 | 2612 void purple_blist_remove_account(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2613 { |
15823 | 2614 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2615 PurpleBlistNode *gnode, *cnode, *bnode; | |
2616 PurpleBuddy *buddy; | |
2617 PurpleChat *chat; | |
2618 PurpleContact *contact; | |
2619 PurpleGroup *group; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2620 GList *list = NULL, *iter = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2621 |
15823 | 2622 g_return_if_fail(purplebuddylist != NULL); |
2623 | |
2624 for (gnode = purplebuddylist->root; gnode; gnode = gnode->next) { | |
2625 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2626 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2627 |
15823 | 2628 group = (PurpleGroup *)gnode; |
15374
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 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
15823 | 2631 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2632 gboolean recompute = FALSE; |
15823 | 2633 contact = (PurpleContact *)cnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2634 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2635 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
15823 | 2636 if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2637 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2638 |
15823 | 2639 buddy = (PurpleBuddy *)bnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2640 if (account == buddy->account) { |
15823 | 2641 PurplePresence *presence; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2642 |
15823 | 2643 presence = purple_buddy_get_presence(buddy); |
2644 | |
2645 if(purple_presence_is_online(presence)) { | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2646 contact->online--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2647 if (contact->online == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2648 group->online--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2649 |
15823 | 2650 purple_blist_node_set_int(&buddy->node, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2651 "last_seen", time(NULL)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2652 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2653 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2654 contact->currentsize--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2655 if (contact->currentsize == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2656 group->currentsize--; |
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 if (!g_list_find(list, presence)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2659 list = g_list_prepend(list, presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2660 |
16518
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16483
diff
changeset
|
2661 if (contact->priority == buddy) |
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16483
diff
changeset
|
2662 purple_contact_invalidate_priority_buddy(contact); |
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16483
diff
changeset
|
2663 else |
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16483
diff
changeset
|
2664 recompute = TRUE; |
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16483
diff
changeset
|
2665 |
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16483
diff
changeset
|
2666 if (ops && ops->remove) { |
15823 | 2667 ops->remove(purplebuddylist, bnode); |
16518
f1513338fbdb
A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents:
16483
diff
changeset
|
2668 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2669 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2670 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2671 if (recompute) { |
15823 | 2672 purple_contact_invalidate_priority_buddy(contact); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2673 if (ops && ops->update) |
15823 | 2674 ops->update(purplebuddylist, cnode); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2675 } |
15823 | 2676 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { |
2677 chat = (PurpleChat *)cnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2678 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2679 if(chat->account == account) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2680 group->currentsize--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2681 group->online--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2682 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2683 if (ops && ops->remove) |
15823 | 2684 ops->remove(purplebuddylist, cnode); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2685 } |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2689 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2690 for (iter = list; iter; iter = iter->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2691 { |
15823 | 2692 purple_presence_set_status_active(iter->data, "offline", TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2693 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2694 g_list_free(list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2695 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2696 |
15823 | 2697 gboolean purple_group_on_account(PurpleGroup *g, PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2698 { |
15823 | 2699 PurpleBlistNode *cnode; |
2700 for (cnode = ((PurpleBlistNode *)g)->child; cnode; cnode = cnode->next) { | |
2701 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { | |
2702 if(purple_contact_on_account((PurpleContact *) cnode, account)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2703 return TRUE; |
15823 | 2704 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { |
2705 PurpleChat *chat = (PurpleChat *)cnode; | |
2706 if ((!account && purple_account_is_connected(chat->account)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2707 || chat->account == account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2708 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2709 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2710 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2711 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2712 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2713 |
16779
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:
16639
diff
changeset
|
2714 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:
16639
diff
changeset
|
2715 { |
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:
16639
diff
changeset
|
2716 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:
16639
diff
changeset
|
2717 |
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:
16639
diff
changeset
|
2718 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:
16639
diff
changeset
|
2719 } |
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:
16639
diff
changeset
|
2720 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2721 void |
15823 | 2722 purple_blist_request_add_buddy(PurpleAccount *account, const char *username, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2723 const char *group, const char *alias) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2724 { |
15823 | 2725 PurpleBlistUiOps *ui_ops; |
2726 | |
2727 ui_ops = purple_blist_get_ui_ops(); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2728 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2729 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
|
2730 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
|
2731 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2732 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2733 void |
15823 | 2734 purple_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2735 const char *alias, const char *name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2736 { |
15823 | 2737 PurpleBlistUiOps *ui_ops; |
2738 | |
2739 ui_ops = purple_blist_get_ui_ops(); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2740 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2741 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
|
2742 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
|
2743 } |
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 void |
15823 | 2746 purple_blist_request_add_group(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2747 { |
15823 | 2748 PurpleBlistUiOps *ui_ops; |
2749 | |
2750 ui_ops = purple_blist_get_ui_ops(); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2751 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2752 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
|
2753 ui_ops->request_add_group(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2754 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2755 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2756 static void |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2757 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:
25416
diff
changeset
|
2758 { |
26899
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26878
diff
changeset
|
2759 PurpleBlistUiOps *ui_ops; |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2760 PurpleBlistNode *child, *next_child; |
26622
384eaba9974e
Reset some global data when uninit-ing. Fixes a crash on quit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26609
diff
changeset
|
2761 |
26899
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26878
diff
changeset
|
2762 ui_ops = purple_blist_get_ui_ops(); |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2763 child = node->child; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2764 while (child) { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2765 next_child = child->next; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2766 purple_blist_node_destroy(child); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2767 child = next_child; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2768 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2769 |
26899
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26878
diff
changeset
|
2770 /* Allow the UI to free data */ |
26901
73eeb91911f3
Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents:
26899
diff
changeset
|
2771 node->parent = NULL; |
73eeb91911f3
Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents:
26899
diff
changeset
|
2772 node->child = NULL; |
73eeb91911f3
Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents:
26899
diff
changeset
|
2773 node->next = NULL; |
73eeb91911f3
Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents:
26899
diff
changeset
|
2774 node->prev = NULL; |
26899
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26878
diff
changeset
|
2775 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:
26878
diff
changeset
|
2776 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:
26878
diff
changeset
|
2777 |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2778 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:
25416
diff
changeset
|
2779 purple_buddy_destroy((PurpleBuddy*)node); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2780 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:
25416
diff
changeset
|
2781 purple_chat_destroy((PurpleChat*)node); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2782 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:
25416
diff
changeset
|
2783 purple_contact_destroy((PurpleContact*)node); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2784 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:
25416
diff
changeset
|
2785 purple_group_destroy((PurpleGroup*)node); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2786 } |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2787 |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
2788 static void |
15823 | 2789 purple_blist_node_setting_free(gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2790 { |
15823 | 2791 PurpleValue *value; |
2792 | |
2793 value = (PurpleValue *)data; | |
2794 | |
2795 purple_value_destroy(value); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2796 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2797 |
15823 | 2798 static void purple_blist_node_initialize_settings(PurpleBlistNode *node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2799 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2800 if (node->settings) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2801 return; |
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 node->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
15823 | 2804 (GDestroyNotify)purple_blist_node_setting_free); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2805 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2806 |
15823 | 2807 void purple_blist_node_remove_setting(PurpleBlistNode *node, const char *key) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2808 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2809 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2810 g_return_if_fail(node->settings != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2811 g_return_if_fail(key != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2812 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2813 g_hash_table_remove(node->settings, key); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2814 |
15823 | 2815 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2816 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2817 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2818 void |
15823 | 2819 purple_blist_node_set_flags(PurpleBlistNode *node, PurpleBlistNodeFlags flags) |
15374
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 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2822 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2823 node->flags = flags; |
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 |
15823 | 2826 PurpleBlistNodeFlags |
2827 purple_blist_node_get_flags(PurpleBlistNode *node) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2828 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2829 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
|
2830 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2831 return node->flags; |
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 |
17534
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16809
diff
changeset
|
2834 PurpleBlistNodeType |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16809
diff
changeset
|
2835 purple_blist_node_get_type(PurpleBlistNode *node) |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16809
diff
changeset
|
2836 { |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16809
diff
changeset
|
2837 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:
16809
diff
changeset
|
2838 return node->type; |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16809
diff
changeset
|
2839 } |
79c1f60ece2e
New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16809
diff
changeset
|
2840 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2841 void |
15823 | 2842 purple_blist_node_set_bool(PurpleBlistNode* node, const char *key, gboolean data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2843 { |
15823 | 2844 PurpleValue *value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2845 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2846 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2847 g_return_if_fail(node->settings != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2848 g_return_if_fail(key != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2849 |
15823 | 2850 value = purple_value_new(PURPLE_TYPE_BOOLEAN); |
2851 purple_value_set_boolean(value, data); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2852 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2853 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
|
2854 |
15823 | 2855 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2856 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2857 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2858 gboolean |
15823 | 2859 purple_blist_node_get_bool(PurpleBlistNode* node, const char *key) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2860 { |
15823 | 2861 PurpleValue *value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2862 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2863 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
|
2864 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
|
2865 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
|
2866 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2867 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
|
2868 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2869 if (value == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2870 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2871 |
15823 | 2872 g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN, FALSE); |
2873 | |
2874 return purple_value_get_boolean(value); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2875 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2876 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2877 void |
15823 | 2878 purple_blist_node_set_int(PurpleBlistNode* node, const char *key, int data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2879 { |
15823 | 2880 PurpleValue *value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2881 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2882 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2883 g_return_if_fail(node->settings != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2884 g_return_if_fail(key != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2885 |
15823 | 2886 value = purple_value_new(PURPLE_TYPE_INT); |
2887 purple_value_set_int(value, data); | |
15374
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 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
|
2890 |
15823 | 2891 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2892 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2893 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2894 int |
15823 | 2895 purple_blist_node_get_int(PurpleBlistNode* node, const char *key) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2896 { |
15823 | 2897 PurpleValue *value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2898 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2899 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
|
2900 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
|
2901 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
|
2902 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2903 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
|
2904 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2905 if (value == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2906 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2907 |
15823 | 2908 g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_INT, 0); |
2909 | |
2910 return purple_value_get_int(value); | |
15374
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 |
15823 | 2914 purple_blist_node_set_string(PurpleBlistNode* node, const char *key, const char *data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2915 { |
15823 | 2916 PurpleValue *value; |
15374
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 g_return_if_fail(node != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2919 g_return_if_fail(node->settings != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2920 g_return_if_fail(key != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2921 |
15823 | 2922 value = purple_value_new(PURPLE_TYPE_STRING); |
2923 purple_value_set_string(value, data); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2924 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2925 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
|
2926 |
15823 | 2927 purple_blist_schedule_save(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2928 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2929 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2930 const char * |
15823 | 2931 purple_blist_node_get_string(PurpleBlistNode* node, const char *key) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2932 { |
15823 | 2933 PurpleValue *value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2934 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2935 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
|
2936 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
|
2937 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
|
2938 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2939 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
|
2940 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2941 if (value == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2942 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2943 |
15823 | 2944 g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_STRING, NULL); |
2945 | |
2946 return purple_value_get_string(value); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2947 } |
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 GList * |
15823 | 2950 purple_blist_node_get_extended_menu(PurpleBlistNode *n) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2951 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2952 GList *menu = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2953 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2954 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
|
2955 |
15823 | 2956 purple_signal_emit(purple_blist_get_handle(), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2957 "blist-node-extended-menu", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2958 n, &menu); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2959 return menu; |
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 |
15823 | 2962 int purple_blist_get_group_size(PurpleGroup *group, gboolean offline) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2963 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2964 if (!group) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2965 return 0; |
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 return offline ? group->totalsize : group->currentsize; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2968 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2969 |
15823 | 2970 int purple_blist_get_group_online_count(PurpleGroup *group) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2971 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2972 if (!group) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2973 return 0; |
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 return group->online; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2976 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2977 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2978 void |
15823 | 2979 purple_blist_set_ui_ops(PurpleBlistUiOps *ops) |
15374
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 blist_ui_ops = ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2982 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2983 |
15823 | 2984 PurpleBlistUiOps * |
2985 purple_blist_get_ui_ops(void) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2986 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2987 return blist_ui_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2988 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2989 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2990 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2991 void * |
15823 | 2992 purple_blist_get_handle(void) |
15374
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 static int handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2995 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2996 return &handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2997 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2998 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2999 void |
15823 | 3000 purple_blist_init(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3001 { |
15823 | 3002 void *handle = purple_blist_get_handle(); |
3003 | |
3004 purple_signal_register(handle, "buddy-status-changed", | |
3005 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3006 3, |
15823 | 3007 purple_value_new(PURPLE_TYPE_SUBTYPE, |
3008 PURPLE_SUBTYPE_BLIST_BUDDY), | |
3009 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3010 PURPLE_SUBTYPE_STATUS), | |
3011 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3012 PURPLE_SUBTYPE_STATUS)); | |
3013 purple_signal_register(handle, "buddy-privacy-changed", | |
3014 purple_marshal_VOID__POINTER, NULL, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3015 1, |
15823 | 3016 purple_value_new(PURPLE_TYPE_SUBTYPE, |
3017 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3018 | |
3019 purple_signal_register(handle, "buddy-idle-changed", | |
3020 purple_marshal_VOID__POINTER_INT_INT, NULL, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3021 3, |
15823 | 3022 purple_value_new(PURPLE_TYPE_SUBTYPE, |
3023 PURPLE_SUBTYPE_BLIST_BUDDY), | |
3024 purple_value_new(PURPLE_TYPE_INT), | |
3025 purple_value_new(PURPLE_TYPE_INT)); | |
3026 | |
3027 | |
3028 purple_signal_register(handle, "buddy-signed-on", | |
3029 purple_marshal_VOID__POINTER, NULL, 1, | |
3030 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3031 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3032 | |
3033 purple_signal_register(handle, "buddy-signed-off", | |
3034 purple_marshal_VOID__POINTER, NULL, 1, | |
3035 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3036 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3037 | |
3038 purple_signal_register(handle, "buddy-got-login-time", | |
3039 purple_marshal_VOID__POINTER, NULL, 1, | |
3040 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3041 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3042 | |
26878
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
3043 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:
26846
diff
changeset
|
3044 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:
26846
diff
changeset
|
3045 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:
26846
diff
changeset
|
3046 PURPLE_SUBTYPE_BLIST_NODE)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
3047 |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
3048 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:
26846
diff
changeset
|
3049 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:
26846
diff
changeset
|
3050 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:
26846
diff
changeset
|
3051 PURPLE_SUBTYPE_BLIST_NODE)); |
0924698e2362
Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents:
26846
diff
changeset
|
3052 |
15823 | 3053 purple_signal_register(handle, "buddy-added", |
3054 purple_marshal_VOID__POINTER, NULL, 1, | |
3055 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3056 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3057 | |
3058 purple_signal_register(handle, "buddy-removed", | |
3059 purple_marshal_VOID__POINTER, NULL, 1, | |
3060 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3061 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3062 | |
3063 purple_signal_register(handle, "buddy-icon-changed", | |
3064 purple_marshal_VOID__POINTER, NULL, 1, | |
3065 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3066 PURPLE_SUBTYPE_BLIST_BUDDY)); | |
3067 | |
3068 purple_signal_register(handle, "update-idle", purple_marshal_VOID, NULL, 0); | |
3069 | |
3070 purple_signal_register(handle, "blist-node-extended-menu", | |
3071 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
3072 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3073 PURPLE_SUBTYPE_BLIST_NODE), | |
3074 purple_value_new(PURPLE_TYPE_BOXED, "GList **")); | |
3075 | |
3076 purple_signal_register(handle, "blist-node-aliased", | |
3077 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
3078 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
3079 PURPLE_SUBTYPE_BLIST_NODE), | |
3080 purple_value_new(PURPLE_TYPE_STRING)); | |
26846
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:
26630
diff
changeset
|
3081 |
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:
26630
diff
changeset
|
3082 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:
26630
diff
changeset
|
3083 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:
26630
diff
changeset
|
3084 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:
26630
diff
changeset
|
3085 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:
26630
diff
changeset
|
3086 |
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:
26630
diff
changeset
|
3087 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:
26630
diff
changeset
|
3088 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:
26630
diff
changeset
|
3089 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:
26630
diff
changeset
|
3090 NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3091 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3092 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3093 void |
15823 | 3094 purple_blist_uninit(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3095 { |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
3096 PurpleBlistNode *node, *next_node; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
3097 |
26899
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26878
diff
changeset
|
3098 /* 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:
26878
diff
changeset
|
3099 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:
26878
diff
changeset
|
3100 return; |
d97a130da290
Fix a crash (from the single instance path) and leak of the node UI data.
Paul Aurich <paul@darkrain42.org>
parents:
26878
diff
changeset
|
3101 |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
3102 if (save_timer != 0) { |
15823 | 3103 purple_timeout_remove(save_timer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3104 save_timer = 0; |
15823 | 3105 purple_blist_sync(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3106 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3107 |
26602
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
3108 node = purple_blist_get_root(); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
3109 while (node) { |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
3110 next_node = node->next; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
3111 purple_blist_node_destroy(node); |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
3112 node = next_node; |
0cbdc2639ce2
Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents:
25416
diff
changeset
|
3113 } |
26622
384eaba9974e
Reset some global data when uninit-ing. Fixes a crash on quit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26609
diff
changeset
|
3114 purplebuddylist->root = NULL; |
26846
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:
26630
diff
changeset
|
3115 |
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:
26630
diff
changeset
|
3116 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:
26630
diff
changeset
|
3117 g_hash_table_destroy(buddies_cache); |
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:
26630
diff
changeset
|
3118 |
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:
26630
diff
changeset
|
3119 purple_signals_disconnect_by_handle(purple_blist_get_handle()); |
15823 | 3120 purple_signals_unregister_by_instance(purple_blist_get_handle()); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3121 } |