annotate libpurple/blist.c @ 32459:fcf841ffd620

Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
author andrew.victor@mxit.com
date Tue, 30 Aug 2011 20:03:11 +0000
parents 609e3855f36d
children cd1d9e04c587
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2 * purple
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
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"
31907
4076f53cdd84 Delete buddy pounces when removing a buddy. Fixes #1131.
kartikmohta@gmail.com
parents: 29729
diff changeset
31 #include "pounce.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "prefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "privacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "server.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "signals.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "value.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include "xmlnode.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
41 static PurpleBlistUiOps *blist_ui_ops = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
42
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
43 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
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 /**
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 * 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
47 * 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
48 * 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
49 */
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 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
51
27645
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
52 /**
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
53 * A hash table used for efficient lookups of groups by name.
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
54 * UTF-8 collate-key => PurpleGroup*.
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
55 */
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
56 static GHashTable *groups_cache = NULL;
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
57
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 static guint save_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 static gboolean blist_loaded = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 /*********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 * Private utility functions *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 *********************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
65 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
66 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
67 PurpleBlistNode *n = node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 if (!n)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 while (n->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 n = n->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 return n;
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
75 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
76 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 if (!node)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 return NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
79 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
80 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 struct _list_account_buddies {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 GSList *list;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
84 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
87 struct _purple_hbuddy {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
89 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
90 PurpleBlistNode *group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92
27579
c7812bda30f1 Fix a warning.
Paul Aurich <paul@darkrain42.org>
parents: 27578
diff changeset
93 /* This function must not use purple_normalize */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
94 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
95 {
27668
c868575ded5d Better hash function for the PurpleBuddy lookup hashtables.
Paul Aurich <paul@darkrain42.org>
parents: 27660
diff changeset
96 return g_str_hash(hb->name) ^ g_direct_hash(hb->group) ^ g_direct_hash(hb->account);
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
27579
c7812bda30f1 Fix a warning.
Paul Aurich <paul@darkrain42.org>
parents: 27578
diff changeset
99 /* This function must not use purple_normalize */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
100 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
101 {
27660
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
102 return (hb1->group == hb2->group &&
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
103 hb1->account == hb2->account &&
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
104 g_str_equal(hb1->name, hb2->name));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
107 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
108 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 g_free(hb->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 g_free(hb);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
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
113 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
114 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
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 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
117 (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
118 (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
119 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
120 }
0e99b80b54c6 Make purple_find_buddies(account, NULL) O(# buddies in the account) and rewrite purple_ssi_parselist to take advantage of said efficiency.
hanzz@soc.pidgin.im
parents: 26630
diff changeset
121
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
122 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
123 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
124 {
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
125 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
126 }
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
127
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 /*********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 * Writing to disk *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 *********************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 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
135 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
137 PurpleValue *value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 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
139 char buf[21];
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 name = (const char *)key;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
142 value = (PurpleValue *)hvalue;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 node = (xmlnode *)user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 g_return_if_fail(value != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 child = xmlnode_new_child(node, "setting");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 xmlnode_set_attrib(child, "name", name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
150 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
151 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
152 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
153 xmlnode_insert_data(child, buf, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
155 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
156 xmlnode_set_attrib(child, "type", "string");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
157 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
158 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
159 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
160 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
161 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
162 xmlnode_insert_data(child, buf, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 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
168 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 const char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 const char *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 xmlnode *node, *child;
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 name = (const char *)key;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 data = (const char *)value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 node = (xmlnode *)user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 g_return_if_fail(data != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 child = xmlnode_new_child(node, "component");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 xmlnode_set_attrib(child, "name", name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 xmlnode_insert_data(child, data, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
185 buddy_to_xmlnode(PurpleBlistNode *bnode)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 xmlnode *node, *child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
188 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
189
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
190 buddy = (PurpleBuddy *)bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 node = xmlnode_new("buddy");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
193 xmlnode_set_attrib(node, "account", purple_account_get_username(buddy->account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
194 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
195
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 child = xmlnode_new_child(node, "name");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 xmlnode_insert_data(child, buddy->name, -1);
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 if (buddy->alias != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 child = xmlnode_new_child(node, "alias");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 xmlnode_insert_data(child, buddy->alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 /* Write buddy settings */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 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
207
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
212 contact_to_xmlnode(PurpleBlistNode *cnode)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 xmlnode *node, *child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
215 PurpleContact *contact;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
216 PurpleBlistNode *bnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
217
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
218 contact = (PurpleContact *)cnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 node = xmlnode_new("contact");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 if (contact->alias != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 xmlnode_set_attrib(node, "alias", contact->alias);
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 /* Write buddies */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 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
229 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
230 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
231 continue;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
232 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
233 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 child = buddy_to_xmlnode(bnode);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 xmlnode_insert_child(node, child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 /* Write contact settings */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 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
241
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
246 chat_to_xmlnode(PurpleBlistNode *cnode)
15374
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 xmlnode *node, *child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
249 PurpleChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
250
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
251 chat = (PurpleChat *)cnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 node = xmlnode_new("chat");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
254 xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(chat->account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
255 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
256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 if (chat->alias != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 child = xmlnode_new_child(node, "alias");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 xmlnode_insert_data(child, chat->alias, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 /* Write chat components */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 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
265
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 /* Write chat settings */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 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
268
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
273 group_to_xmlnode(PurpleBlistNode *gnode)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 xmlnode *node, *child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
276 PurpleGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
277 PurpleBlistNode *cnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
278
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
279 group = (PurpleGroup *)gnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 node = xmlnode_new("group");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 xmlnode_set_attrib(node, "name", group->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 /* Write settings */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 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
286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 /* Write contacts and chats */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 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
289 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
290 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
291 continue;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
292 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
293 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 child = contact_to_xmlnode(cnode);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 xmlnode_insert_child(node, child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
297 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
298 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 child = chat_to_xmlnode(cnode);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 xmlnode_insert_child(node, child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
308 accountprivacy_to_xmlnode(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 xmlnode *node, *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 GSList *cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 char buf[10];
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 node = xmlnode_new("account");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
315 xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
316 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
317 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
318 xmlnode_set_attrib(node, "mode", buf);
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 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
321 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 child = xmlnode_new_child(node, "permit");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 xmlnode_insert_data(child, cur->data, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 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
327 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 child = xmlnode_new_child(node, "block");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 xmlnode_insert_data(child, cur->data, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 return node;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 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
336 blist_to_xmlnode(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 xmlnode *node, *child, *grandchild;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
339 PurpleBlistNode *gnode;
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
340 GList *cur;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
342 node = xmlnode_new("purple");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 xmlnode_set_attrib(node, "version", "1.0");
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 /* Write groups */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 child = xmlnode_new_child(node, "blist");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
347 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
348 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
349 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
350 continue;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
351 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
352 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 grandchild = group_to_xmlnode(gnode);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 xmlnode_insert_child(child, grandchild);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 /* Write privacy settings */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 child = xmlnode_new_child(node, "privacy");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
360 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
361 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 grandchild = accountprivacy_to_xmlnode(cur->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 xmlnode_insert_child(child, grandchild);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 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
370 purple_blist_sync(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 xmlnode *node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 char *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 if (!blist_loaded)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
377 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
378 "was read!\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 node = blist_to_xmlnode();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 data = xmlnode_to_formatted_str(node, NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
384 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
385 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 xmlnode_free(node);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 save_cb(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
392 purple_blist_sync();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 save_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
397 static void
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
398 _purple_blist_schedule_save()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 if (save_timer == 0)
18006
f2d8658b3a86 merge of '62e9d17cd37551991c5040ce6ca48e6d7578dde3'
Richard Laager <rlaager@wiktel.com>
parents: 16809
diff changeset
401 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
402 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
404 static void
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
405 purple_blist_save_account(PurpleAccount *account)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
406 {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
407 #if 1
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
408 _purple_blist_schedule_save();
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
409 #else
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
410 if (account != NULL) {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
411 /* Save the buddies and privacy data for this account */
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
412 } else {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
413 /* Save all buddies and privacy data */
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
414 }
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
415 #endif
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
416 }
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
417
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
418 static void
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
419 purple_blist_save_node(PurpleBlistNode *node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
420 {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
421 _purple_blist_schedule_save();
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
422 }
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
423
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
424 void purple_blist_schedule_save()
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
425 {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
426 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
427
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
428 /* Save everything */
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
429 if (ops && ops->save_account)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
430 ops->save_account(NULL);
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
431 }
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
432
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 /*********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 * Reading from disk *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 *********************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
439 parse_setting(PurpleBlistNode *node, xmlnode *setting)
15374
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 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
442 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
443 char *value = xmlnode_get_data(setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 if (!value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447
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
448 if (!type || purple_strequal(type, "string"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
449 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
450 else if (purple_strequal(type, "bool"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
451 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
452 else if (purple_strequal(type, "int"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
453 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
454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 g_free(value);
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 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
459 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
460 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
461 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
462 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 char *name = NULL, *alias = NULL;
32292
507e7721c5e4 Don't bother reading in the "protocol" attribute in blist.xml. As near as
Mark Doliner <mark@kingant.net>
parents: 32290
diff changeset
464 const char *acct_name, *proto;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 xmlnode *x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 acct_name = xmlnode_get_attrib(bnode, "account");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 proto = xmlnode_get_attrib(bnode, "proto");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469
32292
507e7721c5e4 Don't bother reading in the "protocol" attribute in blist.xml. As near as
Mark Doliner <mark@kingant.net>
parents: 32290
diff changeset
470 if (!acct_name || !proto)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472
32292
507e7721c5e4 Don't bother reading in the "protocol" attribute in blist.xml. As near as
Mark Doliner <mark@kingant.net>
parents: 32290
diff changeset
473 account = purple_accounts_find(acct_name, proto);
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 if (!account)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478 if ((x = xmlnode_get_child(bnode, "name")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 name = xmlnode_get_data(x);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 if (!name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 return;
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 if ((x = xmlnode_get_child(bnode, "alias")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 alias = xmlnode_get_data(x);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
487 buddy = purple_buddy_new(account, name, alias);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
488 purple_blist_add_buddy(buddy, contact, group,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
489 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
490
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 for (x = xmlnode_get_child(bnode, "setting"); x; x = xmlnode_get_next_twin(x)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
492 parse_setting((PurpleBlistNode*)buddy, x);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
500 parse_contact(PurpleGroup *group, xmlnode *cnode)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
502 PurpleContact *contact = purple_contact_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 xmlnode *x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 const char *alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
506 purple_blist_add_contact(contact, group,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
507 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
508
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 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
510 purple_blist_alias_contact(contact, alias);
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 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
514 if (x->type != XMLNODE_TYPE_TAG)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 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
516 if (purple_strequal(x->name, "buddy"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 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
518 else if (purple_strequal(x->name, "setting"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
519 parse_setting((PurpleBlistNode*)contact, x);
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 /* if the contact is empty, don't keep it around. it causes problems */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
523 if (!((PurpleBlistNode*)contact)->child)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
524 purple_blist_remove_contact(contact);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
528 parse_chat(PurpleGroup *group, xmlnode *cnode)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
530 PurpleChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
531 PurpleAccount *account;
32292
507e7721c5e4 Don't bother reading in the "protocol" attribute in blist.xml. As near as
Mark Doliner <mark@kingant.net>
parents: 32290
diff changeset
532 const char *acct_name, *proto;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 xmlnode *x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 char *alias = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 GHashTable *components;
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 acct_name = xmlnode_get_attrib(cnode, "account");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 proto = xmlnode_get_attrib(cnode, "proto");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539
32292
507e7721c5e4 Don't bother reading in the "protocol" attribute in blist.xml. As near as
Mark Doliner <mark@kingant.net>
parents: 32290
diff changeset
540 if (!acct_name || !proto)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542
32292
507e7721c5e4 Don't bother reading in the "protocol" attribute in blist.xml. As near as
Mark Doliner <mark@kingant.net>
parents: 32290
diff changeset
543 account = purple_accounts_find(acct_name, proto);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 if (!account)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 if ((x = xmlnode_get_child(cnode, "alias")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 alias = xmlnode_get_data(x);
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 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
552
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 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
554 const char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 char *value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 name = xmlnode_get_attrib(x, "name");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 value = xmlnode_get_data(x);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 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
560 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
562 chat = purple_chat_new(account, alias, components);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
563 purple_blist_add_chat(chat, group,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
564 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
565
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 for (x = xmlnode_get_child(cnode, "setting"); x; x = xmlnode_get_next_twin(x)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
567 parse_setting((PurpleBlistNode*)chat, x);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 g_free(alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 parse_group(xmlnode *groupnode)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 const char *name = xmlnode_get_attrib(groupnode, "name");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
577 PurpleGroup *group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 xmlnode *cnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 if (!name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 name = _("Buddies");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
583 group = purple_group_new(name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
584 purple_blist_add_group(group,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
585 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
586
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 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
588 if (cnode->type != XMLNODE_TYPE_TAG)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 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
590 if (purple_strequal(cnode->name, "setting"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
591 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
592 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
593 purple_strequal(cnode->name, "person"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 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
595 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
596 parse_chat(group, cnode);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 }
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 /* 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
601 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
602 purple_blist_load()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
604 xmlnode *purple, *blist, *privacy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 blist_loaded = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
608 purple = purple_util_read_xml_from_file("blist.xml", _("buddy list"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
609
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
610 if (purple == NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
613 blist = xmlnode_get_child(purple, "blist");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 if (blist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 xmlnode *groupnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 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
617 groupnode = xmlnode_get_next_twin(groupnode)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618 parse_group(groupnode);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
622 privacy = xmlnode_get_child(purple, "privacy");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623 if (privacy) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 xmlnode *anode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 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
626 xmlnode *x;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
627 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 int imode;
32292
507e7721c5e4 Don't bother reading in the "protocol" attribute in blist.xml. As near as
Mark Doliner <mark@kingant.net>
parents: 32290
diff changeset
629 const char *acct_name, *proto, *mode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631 acct_name = xmlnode_get_attrib(anode, "name");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 proto = xmlnode_get_attrib(anode, "proto");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633 mode = xmlnode_get_attrib(anode, "mode");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634
32292
507e7721c5e4 Don't bother reading in the "protocol" attribute in blist.xml. As near as
Mark Doliner <mark@kingant.net>
parents: 32290
diff changeset
635 if (!acct_name || !proto || !mode)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637
32292
507e7721c5e4 Don't bother reading in the "protocol" attribute in blist.xml. As near as
Mark Doliner <mark@kingant.net>
parents: 32290
diff changeset
638 account = purple_accounts_find(acct_name, proto);
15374
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 if (!account)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 imode = atoi(mode);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
644 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
645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 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
647 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 if (x->type != XMLNODE_TYPE_TAG)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650
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
651 if (purple_strequal(x->name, "permit")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 name = xmlnode_get_data(x);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
653 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
654 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
655 } 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
656 name = xmlnode_get_data(x);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
657 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
658 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
664 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
665
c9b4ff420140 The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
666 /* 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
667 _purple_buddy_icons_blist_loaded_cb();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670
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 * Stuff *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
673 *********************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
674
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
675 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
676 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
677 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
678 PurpleBlistNode *bnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
679 PurpleBuddy *new_priority = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 g_return_if_fail(contact != NULL);
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 contact->priority = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
684 for (bnode = ((PurpleBlistNode*)contact)->child;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685 bnode != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 bnode = bnode->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
688 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
689
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
690 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
691 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
693 buddy = (PurpleBuddy*)bnode;
20633
4c910fcb5b0a Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents: 20550
diff changeset
694 if (new_priority == NULL)
4c910fcb5b0a Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents: 20550
diff changeset
695 {
4c910fcb5b0a Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents: 20550
diff changeset
696 new_priority = buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697 continue;
20633
4c910fcb5b0a Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents: 20550
diff changeset
698 }
4c910fcb5b0a Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents: 20550
diff changeset
699
4c910fcb5b0a Consider offline contacts when calculating the priority buddy. I
Mark Doliner <mark@kingant.net>
parents: 20550
diff changeset
700 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
701 {
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
702 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
703 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
704 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
705 purple_buddy_get_presence(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707 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
708 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
709 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 new_priority = buddy;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 }
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 }
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 contact->priority = new_priority;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 contact->priority_valid = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719
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 * Public API functions *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 *****************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
724 PurpleBuddyList *purple_blist_new()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
726 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
727 GList *account;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
728 PurpleBuddyList *gbl = g_new0(PurpleBuddyList, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
729 PURPLE_DBUS_REGISTER_POINTER(gbl, PurpleBuddyList);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
730
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
731 ui_ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
732
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
733 gbl->buddies = g_hash_table_new_full((GHashFunc)_purple_blist_hbuddy_hash,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
734 (GEqualFunc)_purple_blist_hbuddy_equal,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
735 (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
736
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
737 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
738 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
739
27645
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
740 groups_cache = g_hash_table_new_full((GHashFunc)g_str_hash,
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
741 (GEqualFunc)g_str_equal,
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
742 (GDestroyNotify)g_free, NULL);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
743
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
744 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
745 {
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
746 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
747 }
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
748
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749 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
750 ui_ops->new_list(gbl);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 return gbl;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
756 purple_set_blist(PurpleBuddyList *list)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
758 purplebuddylist = list;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
761 PurpleBuddyList *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
762 purple_get_blist()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
764 return purplebuddylist;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
767 PurpleBlistNode *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
768 purple_blist_get_root()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
770 return purplebuddylist ? purplebuddylist->root : NULL;
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
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
773 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
774 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
775 {
2b7604ede0e4 Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents: 26609
diff changeset
776 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
777 *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
778 }
2b7604ede0e4 Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents: 26609
diff changeset
779
2b7604ede0e4 Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents: 26609
diff changeset
780 GSList *
25297
b48f6d0ecdf7 Hide PurpleBlist
Gary Kramlich <grim@reaperworld.com>
parents: 25294
diff changeset
781 purple_blist_get_buddies()
b48f6d0ecdf7 Hide PurpleBlist
Gary Kramlich <grim@reaperworld.com>
parents: 25294
diff changeset
782 {
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
783 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
784
2b7604ede0e4 Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents: 26609
diff changeset
785 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
786 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
787
2b7604ede0e4 Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents: 26609
diff changeset
788 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
789 return buddies;
25297
b48f6d0ecdf7 Hide PurpleBlist
Gary Kramlich <grim@reaperworld.com>
parents: 25294
diff changeset
790 }
b48f6d0ecdf7 Hide PurpleBlist
Gary Kramlich <grim@reaperworld.com>
parents: 25294
diff changeset
791
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
792 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
793 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
794 {
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
795 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
796 }
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
797
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
798 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
799 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
800 {
2b8c85f74ede Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents: 25297
diff changeset
801 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
802 }
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
803
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
804 void purple_blist_show()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
806 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
807
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 if (ops && ops->show)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
809 ops->show(purplebuddylist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
812 void purple_blist_destroy()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
814 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
815
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
816 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
817
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 if (ops && ops->destroy)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
819 ops->destroy(purplebuddylist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
822 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
823 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
824 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
825
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826 if (ops && ops->set_visible)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
827 ops->set_visible(purplebuddylist, show);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
830 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
831 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832 if (node == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
834
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835 if (godeep && node->child)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
836 return node->child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
838 if (node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839 return node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
840
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
841 return get_next_node(node->parent, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
842 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
844 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
845 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
846 PurpleBlistNode *ret = node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848 if (offline)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
849 return get_next_node(ret, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 do
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
851 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
852 ret = get_next_node(ret, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
853 } while (ret && PURPLE_BLIST_NODE_IS_BUDDY(ret) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
854 !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
855
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858
22168
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
859 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
860 {
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
861 return node ? node->parent : NULL;
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
862 }
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
863
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
864 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
865 {
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
866 return node ? node->child : NULL;
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
867 }
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
868
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
869 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
870 {
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
871 return node? node->next : NULL;
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
872 }
2bff44d78523 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22007
diff changeset
873
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
874 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
875 {
6bb29f94862c Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22180
diff changeset
876 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
877 }
6bb29f94862c Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22180
diff changeset
878
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
879 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
880 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
881 {
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
882 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
883
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
884 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
885 }
2b8c85f74ede Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents: 25297
diff changeset
886
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
887 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
888 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
889 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
890
2b8c85f74ede Added purple_blist_get_ui_data, purple_blist_set_ui_data, purple_blist_node_get_ui_data, and purple_blist_node_set_ui_data functions.
Gary Kramlich <grim@reaperworld.com>
parents: 25297
diff changeset
891 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
892 }
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
893
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
895 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
896 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
897 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
898 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
899 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
900 PurpleBlistNode *cnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
904 presence = purple_buddy_get_presence(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
905 status = purple_presence_get_active_status(presence);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
906
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
907 purple_debug_info("blist", "Updating buddy status for %s (%s)\n",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
908 buddy->name, purple_account_get_protocol_name(buddy->account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
909
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
910 if (purple_status_is_online(status) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
911 !purple_status_is_online(old_status)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
912
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
913 purple_signal_emit(purple_blist_get_handle(), "buddy-signed-on", buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
914
25318
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 25312
diff changeset
915 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
916 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
917 PURPLE_GROUP(cnode->parent)->online++;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
918 } else if (!purple_status_is_online(status) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
919 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
920
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
921 purple_blist_node_set_int(&buddy->node, "last_seen", time(NULL));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
922 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
923
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 25312
diff changeset
924 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
925 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
926 PURPLE_GROUP(cnode->parent)->online--;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
928 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
929 "buddy-status-changed", buddy, old_status,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 * 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
935 * 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
936 * 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
937 * to away then no signal is triggered.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 * 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
940 * 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
941 * 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
942 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
943 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
944 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
945 ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
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
23117
d11c993700e6 Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents: 22677
diff changeset
948 void
d11c993700e6 Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents: 22677
diff changeset
949 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
950 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
951 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
952
23117
d11c993700e6 Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents: 22677
diff changeset
953 g_return_if_fail(node != NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 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
956 ops->update(purplebuddylist, node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958
23117
d11c993700e6 Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents: 22677
diff changeset
959 void
d11c993700e6 Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents: 22677
diff changeset
960 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
961 {
d11c993700e6 Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents: 22677
diff changeset
962 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
963 }
d11c993700e6 Add the purple_blist_update_node_icon function and deprecate the
Etan Reisner <pidgin@unreliablesource.net>
parents: 22677
diff changeset
964
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 * 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
967 * from oscar.c and toc.c instead?
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
969 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
970 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
971 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
972 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
973 GHashTable *account_buddies;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
976
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
977 hb = g_new(struct _purple_hbuddy, 1);
27660
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
978 hb->name = (gchar *)purple_normalize(buddy->account, buddy->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
979 hb->account = buddy->account;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
980 hb->group = ((PurpleBlistNode *)buddy)->parent->parent;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
981 g_hash_table_remove(purplebuddylist->buddies, hb);
27660
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
982
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
983 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
984 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
985
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
986 hb->name = g_strdup(purple_normalize(buddy->account, name));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
987 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
988
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
989 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
990 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
991 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
992 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
993
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
994 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
995
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 g_free(buddy->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 buddy->name = g_strdup(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
999 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1000 ops->save_node((PurpleBlistNode *) buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1003 ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005
20205
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1006 static gboolean
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1007 purple_strings_are_different(const char *one, const char *two)
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1008 {
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1009 return !((one && two && g_utf8_collate(one, two) == 0) ||
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1010 ((one == NULL || *one == '\0') && (two == NULL || *two == '\0')));
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1011 }
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1012
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1013 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
1014 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1015 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1016 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1017 PurpleBlistNode *bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018 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
1019 char *new_alias = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 g_return_if_fail(contact != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1023 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
1024 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
1025
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1026 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
1027 g_free(new_alias);
20205
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1028 return;
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1029 }
20205
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1030
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031 old_alias = contact->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1032
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1033 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
1034 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
1035 else {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1036 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
1037 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
1038 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1039
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1040 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1041 ops->save_node((PurpleBlistNode*) contact);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1042
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1043 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1044 ops->update(purplebuddylist, (PurpleBlistNode *)contact);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1045
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1046 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
1047 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1048 PurpleBuddy *buddy = (PurpleBuddy *)bnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1049
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1050 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
1051 buddy->account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 if (conv)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1053 purple_conversation_autoset_title(conv);
15374
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1056 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
1057 contact, old_alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058 g_free(old_alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1059 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1061 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
1062 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1063 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
1064 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
1065 char *new_alias = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1066
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 g_return_if_fail(chat != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1069 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
1070 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
1071
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1072 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
1073 g_free(new_alias);
20205
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1074 return;
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1075 }
20205
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1076
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 old_alias = chat->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1079 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
1080 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
1081 else {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 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
1083 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
1084 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1086 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1087 ops->save_node((PurpleBlistNode*) chat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1088
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1090 ops->update(purplebuddylist, (PurpleBlistNode *)chat);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1091
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
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 chat, 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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1097 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
1098 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1099 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
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'))
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->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->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'))
28531
f7bb03f0518e La la la, oops. HanzZ pointed this (leak) out.
Paul Aurich <paul@darkrain42.org>
parents: 28038
diff changeset
1117 buddy->alias = new_alias;
27106
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->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
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1123 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1124 ops->save_node((PurpleBlistNode*) buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1127 ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1128
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1129 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
1130 buddy->account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1131 if (conv)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1132 purple_conversation_autoset_title(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1133
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1134 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
1135 buddy, old_alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1136 g_free(old_alias);
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1139 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
1140 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1141 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1142 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1143 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
1144 char *new_alias = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1145
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1148 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
1149 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
1150
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1151 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
1152 g_free(new_alias);
20205
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1153 return;
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1154 }
20205
859087457089 applied changes from 8075949b7612e77d6eaa5f0d3cbf98f40715f948
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
1155
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156 old_alias = buddy->server_alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1158 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
1159 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
1160 else {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1161 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
1162 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
1163 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1164
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1165 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1166 ops->save_node((PurpleBlistNode*) buddy);
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 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1169 ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1170
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1171 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
1172 buddy->account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1173 if (conv)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1174 purple_conversation_autoset_title(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1175
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1176 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
1177 buddy, old_alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1178 g_free(old_alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1179 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1182 * 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
1183 */
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1184 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
1185 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1186 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1187 PurpleGroup *dest;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188 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
1189 gchar *new_name;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1190 GList *moved_buddies = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1191 GSList *accts;
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 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
1194 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
1195
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1196 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
1197
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1198 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
1199 g_free(new_name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1200 return;
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1201 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1202
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1203 dest = purple_find_group(new_name);
24830
fbfbebc9197e Fix two related bugs:
Mark Doliner <mark@kingant.net>
parents: 24771
diff changeset
1204 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
1205 /* We're merging two groups */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1206 PurpleBlistNode *prev, *child, *next;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1207
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1208 prev = purple_blist_get_last_child((PurpleBlistNode*)dest);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1209 child = ((PurpleBlistNode*)source)->child;
15374
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 * 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
1213 * 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
1214 * 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
1215 * each moved buddy...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1216 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1217 while (child)
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 next = child->next;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1220 if (PURPLE_BLIST_NODE_IS_CONTACT(child)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1221 PurpleBlistNode *bnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1222 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
1223 for (bnode = child->child; bnode != NULL; bnode = bnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1224 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
1225 NULL, bnode->prev);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226 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
1227 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1228 prev = child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1229 } else if (PURPLE_BLIST_NODE_IS_CHAT(child)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1230 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
1231 prev = child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1232 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1233 purple_debug(PURPLE_DEBUG_ERROR, "blist",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1234 "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
1235 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236 child = next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1237 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239 /* 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
1240 old_name = g_strdup(source->name);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1241 purple_blist_remove_group(source);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1242 source = dest;
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1243 g_free(new_name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245 /* A simple rename */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1246 PurpleBlistNode *cnode, *bnode;
27645
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
1247 gchar* key;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1249 /* Build a GList of all buddies in this group */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1250 for (cnode = ((PurpleBlistNode *)source)->child; cnode != NULL; cnode = cnode->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1251 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
1252 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
1253 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
1254 }
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 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
1257 source->name = new_name;
27645
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
1258
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
1259 key = g_utf8_collate_key(old_name, -1);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
1260 g_hash_table_remove(groups_cache, key);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
1261 g_free(key);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
1262
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
1263 key = g_utf8_collate_key(new_name, -1);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
1264 g_hash_table_insert(groups_cache, key, source);
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 /* Save our changes */
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1268 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1269 ops->save_node((PurpleBlistNode*) source);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271 /* Update the UI */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1273 ops->update(purplebuddylist, (PurpleBlistNode*)source);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1274
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1275 /* Notify all PRPLs */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1276 /* 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
1277 if(old_name && !purple_strequal(source->name, old_name)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1278 for (accts = purple_group_get_accounts(source); accts; accts = g_slist_remove(accts, accts->data)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1279 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
1280 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
1281 PurplePlugin *prpl = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1282 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1283 GList *l = NULL, *buddies = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1284
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
1285 gc = purple_account_get_connection(account);
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
1286
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
1287 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
1288 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
1289
edca47ee06c5 Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22219
diff changeset
1290 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
1291 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
1292
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1293 if(!prpl_info)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1294 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1295
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1296 for(l = moved_buddies; l; l = l->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1297 PurpleBuddy *buddy = (PurpleBuddy *)l->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1298
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1299 if(buddy && buddy->account == account)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1300 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
1301 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1302
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1303 if(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
1304 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
1305 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1306 GList *cur, *groups = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1307
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1308 /* 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
1309 for(cur = buddies; cur; cur = cur->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1310 PurpleBlistNode *node = (PurpleBlistNode *)cur->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1311 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
1312 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1313
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1314 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
1315 g_list_free(groups);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1316 purple_account_add_buddies(account, buddies);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1317 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1318
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1319 g_list_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1320 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1321 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1322 g_list_free(moved_buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1323 g_free(old_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1324 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1325
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1326 static void purple_blist_node_initialize_settings(PurpleBlistNode *node);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1327
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1328 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
1329 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1330 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1331 PurpleChat *chat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1332
27973
2e6482e80a16 Returning FALSE from a function that is suposed to return a PurpleChat * is
Etan Reisner <pidgin@unreliablesource.net>
parents: 27312
diff changeset
1333 g_return_val_if_fail(account != NULL, NULL);
2e6482e80a16 Returning FALSE from a function that is suposed to return a PurpleChat * is
Etan Reisner <pidgin@unreliablesource.net>
parents: 27312
diff changeset
1334 g_return_val_if_fail(components != NULL, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1335
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1336 chat = g_new0(PurpleChat, 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1337 chat->account = account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1338 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
1339 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
1340 chat->components = components;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1341 purple_blist_node_initialize_settings((PurpleBlistNode *)chat);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1342 ((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
1343
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1344 if (ops != NULL && ops->new_node != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1345 ops->new_node((PurpleBlistNode *)chat);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1346
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1347 PURPLE_DBUS_REGISTER_POINTER(chat, PurpleChat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1348 return chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1349 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
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 void
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1352 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
1353 {
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(chat->components);
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1355 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
1356 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
1357 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
1358 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
1359 }
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1360
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 25415
diff changeset
1361 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
1362 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1363 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1364 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1365
27106
c59918579c3a Strip unprintable UTF-8 characters from buddy list strings. Fixes #8776.
Paul Aurich <paul@darkrain42.org>
parents: 26967
diff changeset
1366 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
1367 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
1368
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1369 buddy = g_new0(PurpleBuddy, 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1370 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
1371 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
1372 buddy->alias = purple_utf8_strip_unprintables(alias);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1373 buddy->presence = purple_presence_new_for_buddy(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1374 ((PurpleBlistNode *)buddy)->type = PURPLE_BLIST_BUDDY_NODE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1375
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1376 purple_presence_set_status_active(buddy->presence, "offline", TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1377
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1378 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
1379
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1380 if (ops && ops->new_node)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1381 ops->new_node((PurpleBlistNode *)buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1382
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1383 PURPLE_DBUS_REGISTER_POINTER(buddy, PurpleBuddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1384 return buddy;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1387 void
26602
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1388 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
1389 {
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1390 PurplePlugin *prpl;
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1391 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
1392
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1393 /*
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1394 * 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
1395 * 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
1396 */
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1397 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
1398 if (prpl) {
9a2e4aebfa91 Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26602
diff changeset
1399 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
1400 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
1401 prpl_info->buddy_free(buddy);
9a2e4aebfa91 Fix purple_buddy_destroy crash on exit.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26602
diff changeset
1402 }
26602
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1403
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1404 /* 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
1405 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
1406 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
1407 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
1408 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
1409 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
1410 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
1411
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1412 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
1413 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
1414
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1415 /* 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
1416 * 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
1417 * 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
1418 * 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
1419 * be removed. */
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1420 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
1421 }
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1422
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1423 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1424 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
1425 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1426 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427
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
1428 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
1429 {
c9b4ff420140 The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
1430 purple_buddy_icon_unref(buddy->icon);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1431 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
1432 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1433
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1434 purple_signal_emit(purple_blist_get_handle(), "buddy-icon-changed", buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1435
23119
21636ef92dbb Update some calls to the functions I just deprecated.
Etan Reisner <pidgin@unreliablesource.net>
parents: 23117
diff changeset
1436 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
1437 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1438
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1439 PurpleAccount *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1440 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
1441 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1442 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
1443
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1444 return buddy->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1445 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1446
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1448 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
1449 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1450 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
1451
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1452 return buddy->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1453 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1455 PurpleBuddyIcon *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1456 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
1457 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1458 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
1459
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460 return buddy->icon;
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
25278
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1463 gpointer
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1464 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
1465 {
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1466 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
1467
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1468 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
1469 }
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1470
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1471 void
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1472 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
1473 {
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1474 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
1475
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1476 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
1477 }
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1478
12b8ccc3e9ec Add purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24275
diff changeset
1479
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1480 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
1481 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1482 PurpleBlistNode *cnode = (PurpleBlistNode*)chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1483 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
1484
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485 g_return_if_fail(chat != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1486 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
1487
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1488 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
1489 if (group == NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1490 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
1491
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
1492 /* 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
1493 if (!purple_find_group(group->name)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1494 purple_blist_add_group(group,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1495 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
1496 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1497 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1498 group = (PurpleGroup*)node->parent;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1501 /* 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
1502 if (cnode == node)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505 if (cnode->parent) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1506 /* 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
1507 * being moved.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1509 ((PurpleGroup *)cnode->parent)->totalsize--;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1510 if (purple_account_is_connected(chat->account)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1511 ((PurpleGroup *)cnode->parent)->online--;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1512 ((PurpleGroup *)cnode->parent)->currentsize--;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1513 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1514 if (cnode->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1515 cnode->next->prev = cnode->prev;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1516 if (cnode->prev)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1517 cnode->prev->next = cnode->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1518 if (cnode->parent->child == cnode)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1519 cnode->parent->child = cnode->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1520
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1521 if (ops && ops->remove)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1522 ops->remove(purplebuddylist, cnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1523 /* 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
1524 * reinitialize it */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525 if (ops && ops->new_node)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1526 ops->new_node(cnode);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1529 if (node != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1530 if (node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1531 node->next->prev = cnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1532 cnode->next = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1533 cnode->prev = node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1534 cnode->parent = node->parent;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1535 node->next = cnode;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1536 ((PurpleGroup *)node->parent)->totalsize++;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1537 if (purple_account_is_connected(chat->account)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1538 ((PurpleGroup *)node->parent)->online++;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1539 ((PurpleGroup *)node->parent)->currentsize++;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1540 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1541 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1542 if (((PurpleBlistNode *)group)->child)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1543 ((PurpleBlistNode *)group)->child->prev = cnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1544 cnode->next = ((PurpleBlistNode *)group)->child;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1545 cnode->prev = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1546 ((PurpleBlistNode *)group)->child = cnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1547 cnode->parent = (PurpleBlistNode *)group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 group->totalsize++;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1549 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
1550 group->online++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1551 group->currentsize++;
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1554
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1555 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1556 ops->save_node(cnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1559 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
1560
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26846
diff changeset
1561 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
1562 cnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1564
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1565 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
1566 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1567 PurpleBlistNode *cnode, *bnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1568 PurpleGroup *g;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1569 PurpleContact *c;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1570 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
1571 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
1572 GHashTable *account_buddies;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1573
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1574 g_return_if_fail(buddy != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1575 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY((PurpleBlistNode*)buddy));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1576
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1577 bnode = (PurpleBlistNode *)buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1578
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579 /* 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
1580 if (bnode == node || (!node && bnode->parent &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1581 contact && bnode->parent == (PurpleBlistNode*)contact
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582 && bnode == bnode->parent->child))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1584
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1585 if (node && PURPLE_BLIST_NODE_IS_BUDDY(node)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1586 c = (PurpleContact*)node->parent;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1587 g = (PurpleGroup*)node->parent->parent;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588 } else if (contact) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1589 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
1590 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
1591 } 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
1592 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
1593 if (g == NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1594 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
1595 /* 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
1596 if (!purple_find_group(g->name)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1597 purple_blist_add_group(g,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1598 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
1599 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1600 c = purple_contact_new();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1601 purple_blist_add_contact(c, g,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1602 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
1603 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1604
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1605 cnode = (PurpleBlistNode *)c;
15374
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 if (bnode->parent) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1608 if (PURPLE_BUDDY_IS_ONLINE(buddy)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1609 ((PurpleContact*)bnode->parent)->online--;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1610 if (((PurpleContact*)bnode->parent)->online == 0)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1611 ((PurpleGroup*)bnode->parent->parent)->online--;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1612 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1613 if (purple_account_is_connected(buddy->account)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1614 ((PurpleContact*)bnode->parent)->currentsize--;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1615 if (((PurpleContact*)bnode->parent)->currentsize == 0)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1616 ((PurpleGroup*)bnode->parent->parent)->currentsize--;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1617 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1618 ((PurpleContact*)bnode->parent)->totalsize--;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1619 /* 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
1620
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1621 if (bnode->parent->parent != (PurpleBlistNode*)g)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1622 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
1623
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1624 if (bnode->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625 bnode->next->prev = bnode->prev;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1626 if (bnode->prev)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1627 bnode->prev->next = bnode->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628 if (bnode->parent->child == bnode)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629 bnode->parent->child = bnode->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1631 if (ops && ops->remove)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1632 ops->remove(purplebuddylist, bnode);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1633
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1634 if (bnode->parent->parent != (PurpleBlistNode*)g) {
27660
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
1635 struct _purple_hbuddy hb;
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
1636 hb.name = (gchar *)purple_normalize(buddy->account, buddy->name);
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
1637 hb.account = buddy->account;
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
1638 hb.group = bnode->parent->parent;
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
1639 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
1640
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);
27660
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
1642 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
1643 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1644
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1645 if (!bnode->parent->child) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1646 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
1647 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1648 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
1649 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1650 ops->update(purplebuddylist, bnode->parent);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1651 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1652 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1654 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
1655 if (node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656 node->next->prev = bnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1657 bnode->next = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1658 bnode->prev = node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1659 bnode->parent = node->parent;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1660 node->next = bnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1661 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1662 if (cnode->child)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1663 cnode->child->prev = bnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1664 bnode->prev = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1665 bnode->next = cnode->child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1666 cnode->child = bnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1667 bnode->parent = cnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1668 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1669
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1670 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
1671 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
1672 PURPLE_GROUP(bnode->parent->parent)->online++;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1673 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1674 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
1675 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
1676 PURPLE_GROUP(bnode->parent->parent)->currentsize++;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1677 }
25318
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 25312
diff changeset
1678 PURPLE_CONTACT(bnode->parent)->totalsize++;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1679
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1680 hb = g_new(struct _purple_hbuddy, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1681 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
1682 hb->account = buddy->account;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1683 hb->group = ((PurpleBlistNode*)buddy)->parent->parent;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1684
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1685 g_hash_table_replace(purplebuddylist->buddies, hb, buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1686
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
1687 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
1688
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
1689 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
1690 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
1691 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
1692 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
1693
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
1694 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
1695
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1696 purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1697
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1698 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1699 ops->save_node((PurpleBlistNode*) buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1700
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1701 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1702 ops->update(purplebuddylist, (PurpleBlistNode*)buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1704 /* Signal that the buddy has been added */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1705 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
1706
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26846
diff changeset
1707 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
1708 PURPLE_BLIST_NODE(buddy));
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1711 PurpleContact *purple_contact_new()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1712 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1713 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1714
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1715 PurpleContact *contact = g_new0(PurpleContact, 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1716 contact->totalsize = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1717 contact->currentsize = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1718 contact->online = 0;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1719 purple_blist_node_initialize_settings((PurpleBlistNode *)contact);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1720 ((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
1721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1722 if (ops && ops->new_node)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1723 ops->new_node((PurpleBlistNode *)contact);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1724
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1725 PURPLE_DBUS_REGISTER_POINTER(contact, PurpleContact);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1726 return contact;
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
26602
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1729 void
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1730 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
1731 {
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1732 g_hash_table_destroy(contact->node.settings);
26630
3e274d6fcfaa Plug leak of PurpleContact->alias
Paul Aurich <paul@darkrain42.org>
parents: 26625
diff changeset
1733 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
1734 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
1735 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
1736 }
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1737
29729
e26af064fe8c added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents: 29727
diff changeset
1738 PurpleGroup *
e26af064fe8c added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents: 29727
diff changeset
1739 purple_contact_get_group(const PurpleContact *contact)
e26af064fe8c added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents: 29727
diff changeset
1740 {
e26af064fe8c added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents: 29727
diff changeset
1741 g_return_val_if_fail(contact, NULL);
e26af064fe8c added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents: 29727
diff changeset
1742
e26af064fe8c added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents: 29727
diff changeset
1743 return (PurpleGroup *)(((PurpleBlistNode *)contact)->parent);
e26af064fe8c added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents: 29727
diff changeset
1744 }
e26af064fe8c added purple_contact_get_group
Gary Kramlich <grim@reaperworld.com>
parents: 29727
diff changeset
1745
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1746 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
1747 {
20550
28493a27849b Looking at purple_contact_set_alias and purple_blist_alias_contact functions
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20205
diff changeset
1748 purple_blist_alias_contact(contact,alias);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1749 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1750
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1751 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
1752 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1753 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
1754
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1755 if (contact->alias)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1756 return contact->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1757
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1758 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
1759 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1760
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1761 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
1762 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1763 PurpleBlistNode *bnode, *cnode = (PurpleBlistNode *) c;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1764
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1765 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
1766 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
1767
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1768 for (bnode = cnode->child; bnode; bnode = bnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1769 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1770
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1771 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
1772 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1773
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1774 buddy = (PurpleBuddy *)bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1775 if (buddy->account == account)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1776 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1777 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1778 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1779 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1780
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1781 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
1782 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1783 g_return_if_fail(contact != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1784
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1785 contact->priority_valid = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1786 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1787
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1788 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
1789 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1790 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1791 PurpleGroup *group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1792
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1793 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
1794 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
1795
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1796 group = purple_find_group(name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1797 if (group != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1798 return group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1799
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1800 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
1801 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
1802 group->totalsize = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 group->currentsize = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804 group->online = 0;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1805 purple_blist_node_initialize_settings((PurpleBlistNode *)group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1806 ((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
1807
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1808 if (ops && ops->new_node)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1809 ops->new_node((PurpleBlistNode *)group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1810
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1811 PURPLE_DBUS_REGISTER_POINTER(group, PurpleGroup);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812 return group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1813 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1814
26602
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1815 void
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1816 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
1817 {
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1818 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
1819 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
1820 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
1821 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
1822 }
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
1823
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1824 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
1825 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1826 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1827 PurpleGroup *g;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1828 PurpleBlistNode *gnode, *cnode, *bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1829
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1830 g_return_if_fail(contact != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1831 g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT((PurpleBlistNode*)contact));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1832
25318
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 25312
diff changeset
1833 if (PURPLE_BLIST_NODE(contact) == node)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1834 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1836 if (node && (PURPLE_BLIST_NODE_IS_CONTACT(node) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1837 PURPLE_BLIST_NODE_IS_CHAT(node)))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1838 g = (PurpleGroup*)node->parent;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1839 else if (group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1840 g = group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841 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
1842 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
1843 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
1844 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
1845 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
1846 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
1847 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1848 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1849
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1850 gnode = (PurpleBlistNode*)g;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1851 cnode = (PurpleBlistNode*)contact;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1852
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1853 if (cnode->parent) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854 if (cnode->parent->child == cnode)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1855 cnode->parent->child = cnode->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1856 if (cnode->prev)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1857 cnode->prev->next = cnode->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1858 if (cnode->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1859 cnode->next->prev = cnode->prev;
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 if (cnode->parent != gnode) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1862 bnode = cnode->child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1863 while (bnode) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1864 PurpleBlistNode *next_bnode = bnode->next;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1865 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
1866 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
1867
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
1868 struct _purple_hbuddy *hb, *hb2;
27660
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
1869
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
1870 hb = g_new(struct _purple_hbuddy, 1);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1871 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
1872 hb->account = b->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1873 hb->group = cnode->parent;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1874
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1875 g_hash_table_remove(purplebuddylist->buddies, hb);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1876
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
1877 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
1878 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
1879
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1880 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
1881 hb->group = gnode;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1882 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
1883
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
1884 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
1885 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
1886 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
1887 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
1888
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
1889 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
1890
22317
6fc8f0c825e0 Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22262
diff changeset
1891 if (purple_account_get_connection(b->account))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1892 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
1893 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1894 gboolean empty_contact = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1895
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1896 /* 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
1897 * gonna delete it instead */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1898 g_free(hb->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1899 g_free(hb);
22317
6fc8f0c825e0 Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22262
diff changeset
1900 if (purple_account_get_connection(b->account))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1901 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
1902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1903 if (!cnode->child->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1904 empty_contact = TRUE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1905 purple_blist_remove_buddy(b);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1906
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1907 /** 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
1908 * 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
1909 * 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
1910 if (empty_contact)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1911 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1912 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1913 bnode = next_bnode;
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1916
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1917 if (contact->online > 0)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1918 ((PurpleGroup*)cnode->parent)->online--;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1919 if (contact->currentsize > 0)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1920 ((PurpleGroup*)cnode->parent)->currentsize--;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1921 ((PurpleGroup*)cnode->parent)->totalsize--;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1922
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1923 if (ops && ops->remove)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1924 ops->remove(purplebuddylist, cnode);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1925
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1926 if (ops && ops->remove_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1927 ops->remove_node(cnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1928 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1929
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1930 if (node && (PURPLE_BLIST_NODE_IS_CONTACT(node) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1931 PURPLE_BLIST_NODE_IS_CHAT(node))) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1932 if (node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1933 node->next->prev = cnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1934 cnode->next = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1935 cnode->prev = node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1936 cnode->parent = node->parent;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1937 node->next = cnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1938 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1939 if (gnode->child)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1940 gnode->child->prev = cnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1941 cnode->prev = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1942 cnode->next = gnode->child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1943 gnode->child = cnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1944 cnode->parent = gnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1945 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1946
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1947 if (contact->online > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1948 g->online++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1949 if (contact->currentsize > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1950 g->currentsize++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1951 g->totalsize++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1952
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1953 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1954 {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1955 if (cnode->child)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1956 ops->save_node(cnode);
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1957 for (bnode = cnode->child; bnode; bnode = bnode->next)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1958 ops->save_node(bnode);
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
1959 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1960
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1961 if (ops && ops->update)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1962 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1963 if (cnode->child)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1964 ops->update(purplebuddylist, cnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1965
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1966 for (bnode = cnode->child; bnode; bnode = bnode->next)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1967 ops->update(purplebuddylist, bnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1968 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1969 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1970
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1971 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
1972 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1973 PurpleBlistNode *sourcenode = (PurpleBlistNode*)source;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1974 PurpleBlistNode *prev, *cur, *next;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1975 PurpleContact *target;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1976
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1977 g_return_if_fail(source != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1978 g_return_if_fail(node != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1979
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1980 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1981 target = (PurpleContact *)node;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1982 prev = purple_blist_get_last_child(node);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1983 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1984 target = (PurpleContact *)node->parent;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1985 prev = node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1986 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1987 return;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1990 if (source == target || !target)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1991 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1992
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1993 next = sourcenode->child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1995 while (next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1996 cur = next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1997 next = cur->next;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1998 if (PURPLE_BLIST_NODE_IS_BUDDY(cur)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
1999 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
2000 prev = cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2001 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2002 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2003 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2004
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2005 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
2006 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2007 PurpleBlistUiOps *ops;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2008 PurpleBlistNode *gnode = (PurpleBlistNode*)group;
27645
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2009 gchar* key;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2010
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2011 g_return_if_fail(group != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2012 g_return_if_fail(PURPLE_BLIST_NODE_IS_GROUP((PurpleBlistNode *)group));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2013
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2014 ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2015
28679
ec2782028fc5 Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28531
diff changeset
2016 /* if we're moving to overtop of ourselves, do nothing */
ec2782028fc5 Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28531
diff changeset
2017 if (gnode == node) {
ec2782028fc5 Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28531
diff changeset
2018 if (!purplebuddylist->root)
ec2782028fc5 Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28531
diff changeset
2019 node = NULL;
ec2782028fc5 Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28531
diff changeset
2020 else
ec2782028fc5 Do not special case the first group added to the buddy list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28531
diff changeset
2021 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2022 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2023
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2024 if (purple_find_group(group->name)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2025 /* This is just being moved */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2026
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2027 if (ops && ops->remove)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2028 ops->remove(purplebuddylist, (PurpleBlistNode *)group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2029
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2030 if (gnode == purplebuddylist->root)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2031 purplebuddylist->root = gnode->next;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2032 if (gnode->prev)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2033 gnode->prev->next = gnode->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2034 if (gnode->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2035 gnode->next->prev = gnode->prev;
27688
b419196556c7 corner case: the first group wasn't being put into the hash table.
Paul Aurich <paul@darkrain42.org>
parents: 27668
diff changeset
2036 } else {
b419196556c7 corner case: the first group wasn't being put into the hash table.
Paul Aurich <paul@darkrain42.org>
parents: 27668
diff changeset
2037 key = g_utf8_collate_key(group->name, -1);
b419196556c7 corner case: the first group wasn't being put into the hash table.
Paul Aurich <paul@darkrain42.org>
parents: 27668
diff changeset
2038 g_hash_table_insert(groups_cache, key, group);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2039 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2041 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
2042 gnode->next = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2043 gnode->prev = node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2044 if (node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 node->next->prev = gnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2046 node->next = gnode;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2047 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2048 if (purplebuddylist->root)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2049 purplebuddylist->root->prev = gnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2050 gnode->next = purplebuddylist->root;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2051 gnode->prev = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2052 purplebuddylist->root = gnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2053 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2054
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2055 if (ops && ops->save_node) {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2056 ops->save_node(gnode);
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2057 for (node = gnode->child; node; node = node->next)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2058 ops->save_node(node);
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2059 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2060
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2061 if (ops && ops->update) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2062 ops->update(purplebuddylist, gnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2063 for (node = gnode->child; node; node = node->next)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2064 ops->update(purplebuddylist, node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2065 }
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26846
diff changeset
2066
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26846
diff changeset
2067 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
2068 gnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2070
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2071 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
2072 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2073 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2074 PurpleBlistNode *node, *gnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2075
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2076 g_return_if_fail(contact != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2077
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2078 node = (PurpleBlistNode *)contact;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2079 gnode = node->parent;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2081 if (node->child) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2082 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2083 * 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
2084 * 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
2085 * deleted.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2086 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2087 while (node->child->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2088 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
2089 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2090 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2091 * 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
2092 * 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
2093 * 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
2094 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2095 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
2096 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2097 /* Remove the node from its parent */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2098 if (gnode->child == node)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2099 gnode->child = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2100 if (node->prev)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2101 node->prev->next = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2102 if (node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2103 node->next->prev = node->prev;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2105 /* Update the UI */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2106 if (ops && ops->remove)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2107 ops->remove(purplebuddylist, node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2108
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2109 if (ops && ops->remove_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2110 ops->remove_node(node);
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2111
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26846
diff changeset
2112 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
2113 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
2114
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2115 /* 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
2116 purple_contact_destroy(contact);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2117 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2118 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2119
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2120 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
2121 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2122 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2123 PurpleBlistNode *node, *cnode, *gnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2124 PurpleContact *contact;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2125 PurpleGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2126 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
2127 GHashTable *account_buddies;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2129 g_return_if_fail(buddy != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2130
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2131 node = (PurpleBlistNode *)buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2132 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
2133 gnode = (cnode != NULL) ? cnode->parent : NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2134 contact = (PurpleContact *)cnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2135 group = (PurpleGroup *)gnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2136
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2137 /* Remove the node from its parent */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2138 if (node->prev)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2139 node->prev->next = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2140 if (node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2141 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
2142 if ((cnode != NULL) && (cnode->child == node))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2143 cnode->child = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2144
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2145 /* 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
2146 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
2147 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
2148 contact->online--;
9fafe265567f Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents: 16809
diff changeset
2149 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
2150 group->online--;
9fafe265567f Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents: 16809
diff changeset
2151 }
9fafe265567f Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents: 16809
diff changeset
2152 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
2153 contact->currentsize--;
9fafe265567f Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents: 16809
diff changeset
2154 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
2155 group->currentsize--;
9fafe265567f Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents: 16809
diff changeset
2156 }
9fafe265567f Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents: 16809
diff changeset
2157 contact->totalsize--;
9fafe265567f Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents: 16809
diff changeset
2158
9fafe265567f Fix purple_blist_remove_buddy() so it doesn't crash (NULL pointer
Stu Tomlinson <stu@nosnilmot.com>
parents: 16809
diff changeset
2159 /* 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
2160 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
2161 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
2162 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
2163 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
2164 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2165 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2166
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2167 /* Remove this buddy from the buddies hash table */
27660
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
2168 hb.name = (gchar *)purple_normalize(buddy->account, buddy->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2169 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
2170 hb.group = gnode;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2171 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
2172
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
2173 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
2174 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
2175
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2176 /* Update the UI */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2177 if (ops && ops->remove)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2178 ops->remove(purplebuddylist, node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2179
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2180 if (ops && ops->remove_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2181 ops->remove_node(node);
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2182
31907
4076f53cdd84 Delete buddy pounces when removing a buddy. Fixes #1131.
kartikmohta@gmail.com
parents: 29729
diff changeset
2183 /* Remove this buddy's pounces */
4076f53cdd84 Delete buddy pounces when removing a buddy. Fixes #1131.
kartikmohta@gmail.com
parents: 29729
diff changeset
2184 purple_pounce_destroy_all_by_buddy(buddy);
4076f53cdd84 Delete buddy pounces when removing a buddy. Fixes #1131.
kartikmohta@gmail.com
parents: 29729
diff changeset
2185
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2186 /* Signal that the buddy has been removed before freeing the memory for it */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2187 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
2188
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26846
diff changeset
2189 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
2190 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
2191
26602
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
2192 purple_buddy_destroy(buddy);
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 /* 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
2195 if ((contact != NULL) && !cnode->child)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2196 purple_blist_remove_contact(contact);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2197 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2198
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2199 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
2200 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2201 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2202 PurpleBlistNode *node, *gnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2203 PurpleGroup *group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2204
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2205 g_return_if_fail(chat != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2206
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2207 node = (PurpleBlistNode *)chat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2208 gnode = node->parent;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2209 group = (PurpleGroup *)gnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2210
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2211 if (gnode != NULL)
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 /* Remove the node from its parent */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2214 if (gnode->child == node)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2215 gnode->child = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2216 if (node->prev)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2217 node->prev->next = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2218 if (node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2219 node->next->prev = node->prev;
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 /* Adjust size counts */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2222 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
2223 group->online--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2224 group->currentsize--;
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 group->totalsize--;
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2229
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2230 /* Update the UI */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2231 if (ops && ops->remove)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2232 ops->remove(purplebuddylist, node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2233
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2234 if (ops && ops->remove_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2235 ops->remove_node(node);
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2236
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26846
diff changeset
2237 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
2238 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
2239
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2240 /* 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
2241 purple_chat_destroy(chat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2242 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2243
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2244 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
2245 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2246 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2247 PurpleBlistNode *node;
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
2248 GList *l;
27645
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2249 gchar* key;
15374
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 g_return_if_fail(group != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2252
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2253 node = (PurpleBlistNode *)group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2254
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2255 /* 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
2256 if (node->child)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2257 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2258
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2259 /* Remove the node from its parent */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2260 if (purplebuddylist->root == node)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2261 purplebuddylist->root = node->next;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2262 if (node->prev)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2263 node->prev->next = node->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2264 if (node->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2265 node->next->prev = node->prev;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2266
27645
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2267 key = g_utf8_collate_key(group->name, -1);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2268 g_hash_table_remove(groups_cache, key);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2269 g_free(key);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2270
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2271 /* Update the UI */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2272 if (ops && ops->remove)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2273 ops->remove(purplebuddylist, node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2274
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2275 if (ops && ops->remove_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2276 ops->remove_node(node);
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2277
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26846
diff changeset
2278 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
2279 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
2280
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2281 /* Remove the group from all accounts that are online */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2282 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
2283 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2284 PurpleConnection *gc = (PurpleConnection *)l->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2285
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2286 if (purple_connection_get_state(gc) == PURPLE_CONNECTED)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2287 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
2288 }
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 /* 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
2291 purple_group_destroy(group);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2292 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2293
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2294 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
2295 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2296 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
2297
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2298 if (!contact->priority_valid)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2299 purple_contact_compute_priority_buddy(contact);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2300
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2301 return contact->priority;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2302 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2303
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2304 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
2305 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2306 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
2307
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2308 if ((buddy->alias != NULL) && (*buddy->alias != '\0')) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2309 return buddy->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2310 } else if ((buddy->server_alias != NULL) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2311 (*buddy->server_alias != '\0')) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2312
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2313 return buddy->server_alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2314 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2315
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2316 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2317 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2318
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2319
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2320 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
2321 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2322 PurpleContact *c;
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(buddy != 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 /* 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
2327 /* The buddy alias */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2328 if (buddy->alias != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2329 return buddy->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2330
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2331 /* The contact alias */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2332 c = purple_buddy_get_contact(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2333 if ((c != NULL) && (c->alias != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2334 return c->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2335
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2336 /* The server alias */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2337 if ((buddy->server_alias) && (*buddy->server_alias))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2338 return buddy->server_alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2339
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2340 /* 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
2341 return buddy->name;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2344
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2345 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
2346 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2347 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
2348
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2349 /* 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
2350 /* The buddy alias */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2351 if (buddy->alias != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2352 return buddy->alias;
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 /* The server alias */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2355 if ((buddy->server_alias) && (*buddy->server_alias))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2356 return buddy->server_alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2357
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2358 /* 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
2359 return buddy->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2360 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2361
25294
8aa7d8bcbc7d Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25288
diff changeset
2362 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
2363 {
8aa7d8bcbc7d Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25288
diff changeset
2364 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
2365 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
2366 }
8aa7d8bcbc7d Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25288
diff changeset
2367
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2368 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
2369 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2370 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
2371
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2372 if ((buddy->server_alias) && (*buddy->server_alias))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2373 return buddy->server_alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2375 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2376 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2377
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2378 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
2379 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2380 PurpleContact *c;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2382 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
2383
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2384 /* 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
2385 /* The buddy alias */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2386 if (buddy->alias != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2387 return buddy->alias;
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 /* The contact alias */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2390 c = purple_buddy_get_contact(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2391 if ((c != NULL) && (c->alias != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2392 return c->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2393
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2394 /* 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
2395 return buddy->name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2396 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2397
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2398 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
2399 {
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
2400 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
2401 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
2402 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2403
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2404 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
2405
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2406 if ((chat->alias != NULL) && (*chat->alias != '\0'))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2407 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
2408
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
2409 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
2410 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
2411
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
2412 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
2413 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
2414 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
2415 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
2416 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
2417 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
2418 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
2419 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2420
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2421 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2422 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2423
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2424 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
2425 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2426 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2427 struct _purple_hbuddy hb;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2428 PurpleBlistNode *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2429
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2430 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
2431 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
2432 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
2433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2434 hb.account = account;
27579
c7812bda30f1 Fix a warning.
Paul Aurich <paul@darkrain42.org>
parents: 27578
diff changeset
2435 hb.name = (gchar *)purple_normalize(account, name);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2436
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2437 for (group = purplebuddylist->root; group; group = group->next) {
28038
12ab4c1112e5 Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents: 28035
diff changeset
2438 if (!group->child)
12ab4c1112e5 Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents: 28035
diff changeset
2439 continue;
12ab4c1112e5 Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents: 28035
diff changeset
2440
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2441 hb.group = group;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2442 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
2443 return buddy;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2444 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2445 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2446
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2447 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2448 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2449
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2450 PurpleBuddy *purple_find_buddy_in_group(PurpleAccount *account, const char *name,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2451 PurpleGroup *group)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2452 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2453 struct _purple_hbuddy hb;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2454
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
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(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2457 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
2458
27660
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
2459 hb.name = (gchar *)purple_normalize(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2460 hb.account = account;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2461 hb.group = (PurpleBlistNode*)group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2462
27660
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
2463 return 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
2464 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2465
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2466 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
2467 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2468 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
2469 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
2470
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
2471 *list = g_slist_prepend(*list, buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2472 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2473
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2474 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
2475 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2476 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2477 PurpleBlistNode *node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2478 GSList *ret = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2479
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2480 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
2481 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
2482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2483 if ((name != NULL) && (*name != '\0')) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2484 struct _purple_hbuddy hb;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2485
27660
b84f51988365 Further minor optimizations to blist-lookup code.
Paul Aurich <paul@darkrain42.org>
parents: 27645
diff changeset
2486 hb.name = (gchar *)purple_normalize(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2487 hb.account = account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2488
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2489 for (node = purplebuddylist->root; node != NULL; node = node->next) {
28038
12ab4c1112e5 Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents: 28035
diff changeset
2490 if (!node->child)
12ab4c1112e5 Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents: 28035
diff changeset
2491 continue;
12ab4c1112e5 Optimize blist searching with lots and lots of empty groups
aman@tmm1.net
parents: 28035
diff changeset
2492
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2493 hb.group = node;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2494 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
2495 ret = g_slist_prepend(ret, buddy);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2496 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2497 } 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
2498 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
2499 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
2500 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
2501 ret = list;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2502 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2503
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2504 return ret;
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2507 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
2508 {
27645
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2509 gchar* key;
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2510 PurpleGroup *group;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2511
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2512 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
2513 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
2514
27645
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2515 key = g_utf8_collate_key(name, -1);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2516 group = g_hash_table_lookup(groups_cache, key);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2517 g_free(key);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2518
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
2519 return group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2520 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2521
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2522 PurpleChat *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2523 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
2524 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2525 char *chat_name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2526 PurpleChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2527 PurplePlugin *prpl;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2528 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2529 struct proto_chat_entry *pce;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2530 PurpleBlistNode *node, *group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2531 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
2532 char *normname;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2533
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2534 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
2535 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
2536
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2537 if (!purple_account_is_connected(account))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2538 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2539
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2540 prpl = purple_find_prpl(purple_account_get_protocol_id(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2541 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
2542
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2543 if (prpl_info->find_blist_chat != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2544 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
2545
24387
123c78e48663 Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24292
diff changeset
2546 normname = g_strdup(purple_normalize(account, name));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2547 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
2548 for (node = group->child; node != NULL; node = node->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2549 if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2550
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2551 chat = (PurpleChat*)node;
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 if (account != chat->account)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2554 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2555
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2556 parts = prpl_info->chat_info(
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2557 purple_account_get_connection(chat->account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2558
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2559 pce = parts->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2560 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
2561 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
2562 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
2563 g_list_free(parts);
15374
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 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
2566 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
2567 g_free(normname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2568 return chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2569 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2570 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2571 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2572 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2573
24387
123c78e48663 Use normalized chat names when searching for chats. This fixes an issue
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24292
diff changeset
2574 g_free(normname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2575 return NULL;
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2578 PurpleGroup *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2579 purple_chat_get_group(PurpleChat *chat)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2580 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2581 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
2582
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2583 return (PurpleGroup *)(((PurpleBlistNode *)chat)->parent);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2584 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2585
22169
8c5d0180c326 Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22168
diff changeset
2586 PurpleAccount *
8c5d0180c326 Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22168
diff changeset
2587 purple_chat_get_account(PurpleChat *chat)
8c5d0180c326 Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22168
diff changeset
2588 {
8c5d0180c326 Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22168
diff changeset
2589 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
2590
8c5d0180c326 Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22168
diff changeset
2591 return chat->account;
8c5d0180c326 Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22168
diff changeset
2592 }
8c5d0180c326 Add an accessor function for PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22168
diff changeset
2593
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
2594 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
2595 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
2596 {
797230b3e48e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22212
diff changeset
2597 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
2598
797230b3e48e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22212
diff changeset
2599 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
2600 }
797230b3e48e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22212
diff changeset
2601
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2602 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
2603 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2604 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
2605
25318
0e08c847517d Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents: 25312
diff changeset
2606 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
2607 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2608
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2609 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
2610 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2611 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
2612 return buddy->presence;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2613 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2614
29727
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2615 PurpleMediaCaps purple_buddy_get_media_caps(const PurpleBuddy *buddy)
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2616 {
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2617 g_return_val_if_fail(buddy != NULL, 0);
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2618 return buddy->media_caps;
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2619 }
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2620
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2621 void purple_buddy_set_media_caps(PurpleBuddy *buddy, PurpleMediaCaps media_caps)
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2622 {
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2623 g_return_if_fail(buddy != NULL);
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2624 buddy->media_caps = media_caps;
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2625 }
4055d0f7f1ea added some api for the media caps member of PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 29527
diff changeset
2626
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2627 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
2628 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2629 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
2630
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2631 if (((PurpleBlistNode *)buddy)->parent == NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2632 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2633
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2634 return (PurpleGroup *)(((PurpleBlistNode*)buddy)->parent->parent);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2635 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2636
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2637 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
2638 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2639 GSList *l = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2640 PurpleBlistNode *gnode, *cnode, *bnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2641
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2642 gnode = (PurpleBlistNode *)group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2643
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2644 for (cnode = gnode->child; cnode; cnode = cnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2645 if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2646 if (!g_slist_find(l, ((PurpleChat *)cnode)->account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2647 l = g_slist_append(l, ((PurpleChat *)cnode)->account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2648 } 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
2649 for (bnode = cnode->child; bnode; bnode = bnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2650 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2651 if (!g_slist_find(l, ((PurpleBuddy *)bnode)->account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2652 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
2653 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2654 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2655 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2656 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2657
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2658 return l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2659 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2660
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2661 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
2662 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2663 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2664 PurpleBlistNode *gnode, *cnode, *bnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2665
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2666 g_return_if_fail(purplebuddylist != NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2667
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2668 if (!ops || !ops->update)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2669 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2670
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2671 for (gnode = purplebuddylist->root; gnode; gnode = gnode->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2672 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
2673 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2674 for (cnode = gnode->child; cnode; cnode = cnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2675 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
2676 gboolean recompute = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2677 for (bnode = cnode->child; bnode; bnode = bnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2678 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2679 ((PurpleBuddy*)bnode)->account == account) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2680 recompute = TRUE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2681 ((PurpleContact*)cnode)->currentsize++;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2682 if (((PurpleContact*)cnode)->currentsize == 1)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2683 ((PurpleGroup*)gnode)->currentsize++;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2684 ops->update(purplebuddylist, bnode);
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 if (recompute ||
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2688 purple_blist_node_get_bool(cnode, "show_offline")) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2689 purple_contact_invalidate_priority_buddy((PurpleContact*)cnode);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2690 ops->update(purplebuddylist, cnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2691 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2692 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2693 ((PurpleChat*)cnode)->account == account) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2694 ((PurpleGroup *)gnode)->online++;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2695 ((PurpleGroup *)gnode)->currentsize++;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2696 ops->update(purplebuddylist, cnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2697 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2698 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2699 ops->update(purplebuddylist, gnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2700 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2701 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2702
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2703 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
2704 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2705 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2706 PurpleBlistNode *gnode, *cnode, *bnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2707 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2708 PurpleChat *chat;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2709 PurpleContact *contact;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2710 PurpleGroup *group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2711 GList *list = NULL, *iter = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2712
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2713 g_return_if_fail(purplebuddylist != NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2714
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2715 for (gnode = purplebuddylist->root; gnode; gnode = gnode->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2716 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
2717 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2718
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2719 group = (PurpleGroup *)gnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2720
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2721 for (cnode = gnode->child; cnode; cnode = cnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2722 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
2723 gboolean recompute = FALSE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2724 contact = (PurpleContact *)cnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2725
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2726 for (bnode = cnode->child; bnode; bnode = bnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2727 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
2728 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2729
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2730 buddy = (PurpleBuddy *)bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2731 if (account == buddy->account) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2732 PurplePresence *presence;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2733
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2734 presence = purple_buddy_get_presence(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2735
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2736 if(purple_presence_is_online(presence)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2737 contact->online--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2738 if (contact->online == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2739 group->online--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2740
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2741 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
2742 "last_seen", time(NULL));
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 contact->currentsize--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2746 if (contact->currentsize == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2747 group->currentsize--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2748
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2749 if (!g_list_find(list, presence))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2750 list = g_list_prepend(list, presence);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2751
16518
f1513338fbdb A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
2752 if (contact->priority == buddy)
f1513338fbdb A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
2753 purple_contact_invalidate_priority_buddy(contact);
f1513338fbdb A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
2754 else
f1513338fbdb A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
2755 recompute = TRUE;
f1513338fbdb A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
2756
f1513338fbdb A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
2757 if (ops && ops->remove) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2758 ops->remove(purplebuddylist, bnode);
16518
f1513338fbdb A patch from khc in ticket #87
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
2759 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2760 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2761 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2762 if (recompute) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2763 purple_contact_invalidate_priority_buddy(contact);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2764 if (ops && ops->update)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2765 ops->update(purplebuddylist, cnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2766 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2767 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2768 chat = (PurpleChat *)cnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2769
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2770 if(chat->account == account) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2771 group->currentsize--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2772 group->online--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2773
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2774 if (ops && ops->remove)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2775 ops->remove(purplebuddylist, cnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2776 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2777 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2778 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2779 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2780
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2781 for (iter = list; iter; iter = iter->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2782 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2783 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
2784 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2785 g_list_free(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2786 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2787
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2788 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
2789 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2790 PurpleBlistNode *cnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2791 for (cnode = ((PurpleBlistNode *)g)->child; cnode; cnode = cnode->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2792 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2793 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
2794 return TRUE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2795 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2796 PurpleChat *chat = (PurpleChat *)cnode;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2797 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
2798 || chat->account == account)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2799 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2800 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2801 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2802 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2803 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2804
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
2805 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
2806 {
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
2807 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
2808
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
2809 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
2810 }
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
2811
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2812 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2813 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
2814 const char *group, const char *alias)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2815 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2816 PurpleBlistUiOps *ui_ops;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2817
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2818 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
2819
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2820 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
2821 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
2822 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2823
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2824 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2825 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
2826 const char *alias, const char *name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2827 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2828 PurpleBlistUiOps *ui_ops;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2829
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2830 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
2831
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2832 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
2833 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
2834 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2836 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2837 purple_blist_request_add_group(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2838 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2839 PurpleBlistUiOps *ui_ops;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2840
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2841 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
2842
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2843 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
2844 ui_ops->request_add_group();
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2847 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
2848 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
2849 {
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
2850 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
2851 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
2852
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
2853 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
2854 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
2855 while (child) {
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
2856 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
2857 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
2858 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
2859 }
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
2860
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
2861 /* 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
2862 node->parent = NULL;
73eeb91911f3 Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents: 26899
diff changeset
2863 node->child = NULL;
73eeb91911f3 Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents: 26899
diff changeset
2864 node->next = NULL;
73eeb91911f3 Break the links before telling the UI to remove the node
Paul Aurich <paul@darkrain42.org>
parents: 26899
diff changeset
2865 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
2866 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
2867 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
2868
26602
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
2869 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
2870 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
2871 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
2872 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
2873 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
2874 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
2875 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
2876 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
2877 }
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
2878
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
2879 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2880 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
2881 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2882 PurpleValue *value;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2883
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2884 value = (PurpleValue *)data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2885
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2886 purple_value_destroy(value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2887 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2888
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2889 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
2890 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2891 if (node->settings)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2892 return;
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 node->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2895 (GDestroyNotify)purple_blist_node_setting_free);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2896 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2897
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2898 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
2899 {
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2900 PurpleBlistUiOps *ops;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2901 g_return_if_fail(node != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902 g_return_if_fail(node->settings != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2903 g_return_if_fail(key != NULL);
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 g_hash_table_remove(node->settings, key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2906
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2907 ops = purple_blist_get_ui_ops();
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2908 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2909 ops->save_node(node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2910 }
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 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2913 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
2914 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2915 g_return_if_fail(node != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2916
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2917 node->flags = flags;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2918 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2919
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2920 PurpleBlistNodeFlags
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2921 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
2922 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2923 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
2924
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2925 return node->flags;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2926 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2927
17534
79c1f60ece2e New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16809
diff changeset
2928 PurpleBlistNodeType
79c1f60ece2e New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16809
diff changeset
2929 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
2930 {
79c1f60ece2e New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16809
diff changeset
2931 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
2932 return node->type;
79c1f60ece2e New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16809
diff changeset
2933 }
79c1f60ece2e New function purple_blist_node_get_type.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16809
diff changeset
2934
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2935 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2936 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
2937 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2938 PurpleValue *value;
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2939 PurpleBlistUiOps *ops;
15374
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 g_return_if_fail(node != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2942 g_return_if_fail(node->settings != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2943 g_return_if_fail(key != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2944
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2945 value = purple_value_new(PURPLE_TYPE_BOOLEAN);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2946 purple_value_set_boolean(value, data);
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 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
2949
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2950 ops = purple_blist_get_ui_ops();
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2951 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2952 ops->save_node(node);
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2955 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2956 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
2957 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2958 PurpleValue *value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2959
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2960 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
2961 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
2962 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
2963
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2964 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
2965
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2966 if (value == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2967 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2968
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2969 g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN, FALSE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2970
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2971 return purple_value_get_boolean(value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2972 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2973
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2974 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2975 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
2976 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2977 PurpleValue *value;
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2978 PurpleBlistUiOps *ops;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2979
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2980 g_return_if_fail(node != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2981 g_return_if_fail(node->settings != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2982 g_return_if_fail(key != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2983
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2984 value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2985 purple_value_set_int(value, data);
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 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
2988
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2989 ops = purple_blist_get_ui_ops();
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2990 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
2991 ops->save_node(node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2992 }
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 int
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2995 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
2996 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
2997 PurpleValue *value;
15374
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 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
3000 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
3001 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
3002
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3003 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
3004
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3005 if (value == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3006 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3007
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3008 g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_INT, 0);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3009
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3010 return purple_value_get_int(value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3011 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3012
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3013 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3014 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
3015 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3016 PurpleValue *value;
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3017 PurpleBlistUiOps *ops;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3018
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3019 g_return_if_fail(node != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3020 g_return_if_fail(node->settings != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3021 g_return_if_fail(key != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3022
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3023 value = purple_value_new(PURPLE_TYPE_STRING);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3024 purple_value_set_string(value, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3026 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
3027
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3028 ops = purple_blist_get_ui_ops();
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3029 if (ops && ops->save_node)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3030 ops->save_node(node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3031 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3032
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3033 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3034 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
3035 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3036 PurpleValue *value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3037
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3038 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
3039 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
3040 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
3041
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3042 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
3043
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3044 if (value == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3045 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3046
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3047 g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_STRING, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3048
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3049 return purple_value_get_string(value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3050 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3051
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3052 GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3053 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
3054 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3055 GList *menu = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3056
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3057 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
3058
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3059 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
3060 "blist-node-extended-menu",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3061 n, &menu);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3062 return menu;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3063 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3064
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3065 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
3066 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3067 if (!group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3068 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3069
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3070 return offline ? group->totalsize : group->currentsize;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3071 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3072
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3073 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
3074 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3075 if (!group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3076 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3077
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3078 return group->online;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3079 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3081 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3082 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
3083 {
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3084 gboolean overrode = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3085 blist_ui_ops = ops;
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3086
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3087 if (!ops)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3088 return;
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3089
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3090 if (!ops->save_node) {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3091 ops->save_node = purple_blist_save_node;
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3092 overrode = TRUE;
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3093 }
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3094 if (!ops->remove_node) {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3095 ops->remove_node = purple_blist_save_node;
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3096 overrode = TRUE;
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3097 }
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3098 if (!ops->save_account) {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3099 ops->save_account = purple_blist_save_account;
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3100 overrode = TRUE;
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3101 }
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3102
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3103 if (overrode && (ops->save_node != purple_blist_save_node ||
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3104 ops->remove_node != purple_blist_save_node ||
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3105 ops->save_account != purple_blist_save_account)) {
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3106 purple_debug_warning("blist", "Only some of the blist saving UI ops "
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3107 "were overridden. This probably is not what you want!\n");
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27993
diff changeset
3108 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3109 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3110
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3111 PurpleBlistUiOps *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3112 purple_blist_get_ui_ops(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3113 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3114 return blist_ui_ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3115 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3116
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3118 void *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3119 purple_blist_get_handle(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3120 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3121 static int handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3123 return &handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3124 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3126 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3127 purple_blist_init(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3128 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3129 void *handle = purple_blist_get_handle();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3130
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3131 purple_signal_register(handle, "buddy-status-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3132 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
3133 3,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3134 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3135 PURPLE_SUBTYPE_BLIST_BUDDY),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3136 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3137 PURPLE_SUBTYPE_STATUS),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3138 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3139 PURPLE_SUBTYPE_STATUS));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3140 purple_signal_register(handle, "buddy-privacy-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3141 purple_marshal_VOID__POINTER, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3142 1,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3143 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3144 PURPLE_SUBTYPE_BLIST_BUDDY));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3145
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3146 purple_signal_register(handle, "buddy-idle-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3147 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
3148 3,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3149 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3150 PURPLE_SUBTYPE_BLIST_BUDDY),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3151 purple_value_new(PURPLE_TYPE_INT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3152 purple_value_new(PURPLE_TYPE_INT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3153
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3154
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3155 purple_signal_register(handle, "buddy-signed-on",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3156 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3157 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3158 PURPLE_SUBTYPE_BLIST_BUDDY));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3159
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3160 purple_signal_register(handle, "buddy-signed-off",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3161 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3162 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3163 PURPLE_SUBTYPE_BLIST_BUDDY));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3164
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3165 purple_signal_register(handle, "buddy-got-login-time",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3166 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3167 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3168 PURPLE_SUBTYPE_BLIST_BUDDY));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3169
26878
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26846
diff changeset
3170 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
3171 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
3172 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
3173 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
3174
0924698e2362 Add blist-node-(added|removed) and deprecate buddy-(added|removed). Closes #8309
Paul Aurich <paul@darkrain42.org>
parents: 26846
diff changeset
3175 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
3176 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
3177 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
3178 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
3179
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3180 purple_signal_register(handle, "buddy-added",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3181 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3182 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3183 PURPLE_SUBTYPE_BLIST_BUDDY));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3184
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3185 purple_signal_register(handle, "buddy-removed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3186 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3187 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3188 PURPLE_SUBTYPE_BLIST_BUDDY));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3189
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3190 purple_signal_register(handle, "buddy-icon-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3191 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3192 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3193 PURPLE_SUBTYPE_BLIST_BUDDY));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3194
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3195 purple_signal_register(handle, "update-idle", purple_marshal_VOID, NULL, 0);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3196
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3197 purple_signal_register(handle, "blist-node-extended-menu",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3198 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3199 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3200 PURPLE_SUBTYPE_BLIST_NODE),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3201 purple_value_new(PURPLE_TYPE_BOXED, "GList **"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3202
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3203 purple_signal_register(handle, "blist-node-aliased",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3204 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3205 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3206 PURPLE_SUBTYPE_BLIST_NODE),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3207 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
3208
29527
c855d321fc78 Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents: 28679
diff changeset
3209 purple_signal_register(handle, "buddy-caps-changed",
c855d321fc78 Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents: 28679
diff changeset
3210 purple_marshal_VOID__POINTER_INT_INT, NULL,
c855d321fc78 Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents: 28679
diff changeset
3211 3, purple_value_new(PURPLE_TYPE_SUBTYPE,
c855d321fc78 Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents: 28679
diff changeset
3212 PURPLE_SUBTYPE_BLIST_BUDDY),
c855d321fc78 Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents: 28679
diff changeset
3213 purple_value_new(PURPLE_TYPE_INT),
c855d321fc78 Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents: 28679
diff changeset
3214 purple_value_new(PURPLE_TYPE_INT));
c855d321fc78 Add the buddy-caps-changed signal in order to tell when a buddy's media caps
maiku@pidgin.im
parents: 28679
diff changeset
3215
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
3216 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
3217 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
3218 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
3219 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
3220
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
3221 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
3222 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
3223 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
3224 NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3225 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3226
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3227 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3228 purple_blist_uninit(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3229 {
26602
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
3230 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
3231
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
3232 /* 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
3233 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
3234 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
3235
26602
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
3236 if (save_timer != 0) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3237 purple_timeout_remove(save_timer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3238 save_timer = 0;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3239 purple_blist_sync();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3240 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3241
27556
cbee8aecc90a Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents: 27312
diff changeset
3242 purple_blist_destroy();
cbee8aecc90a Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents: 27312
diff changeset
3243
26602
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
3244 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
3245 while (node) {
0cbdc2639ce2 Add purple_{buddy,chat,group,contact}_destroy to the blist API, free
Nick Hebner <hebnern@gmail.com>
parents: 25416
diff changeset
3246 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
3247 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
3248 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
3249 }
26622
384eaba9974e Reset some global data when uninit-ing. Fixes a crash on quit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26609
diff changeset
3250 purplebuddylist->root = NULL;
27556
cbee8aecc90a Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents: 27312
diff changeset
3251
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
3252 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
3253 g_hash_table_destroy(buddies_cache);
27645
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
3254 g_hash_table_destroy(groups_cache);
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
3255
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
3256 buddies_cache = NULL;
36aa9ed8cd39 Use a hash table for looking up PurpleGroup:s.
aman@tmm1.net
parents: 27579
diff changeset
3257 groups_cache = 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
3258
27556
cbee8aecc90a Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents: 27312
diff changeset
3259 PURPLE_DBUS_UNREGISTER_POINTER(purplebuddylist);
cbee8aecc90a Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents: 27312
diff changeset
3260 g_free(purplebuddylist);
cbee8aecc90a Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <paul@darkrain42.org>
parents: 27312
diff changeset
3261 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
3262
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
3263 purple_signals_disconnect_by_handle(purple_blist_get_handle());
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15679
diff changeset
3264 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
3265 }