finch/gntblist.c

Fri, 14 Nov 2008 05:32:35 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Fri, 14 Nov 2008 05:32:35 +0000
branch
next.minor
changeset 24974
a81952e9babb
parent 24951
d0837696fd3a
child 24990
e2fdc2cd23a4
permissions
-rw-r--r--

Update some casts (that the script didn't fix correctly) to GObject macros.

14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
1 /**
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
2 * @file gntblist.c GNT BuddyList API
16255
fa61ee19f526 Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@pidgin.im>
parents: 16166
diff changeset
3 * @ingroup finch
20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
4 */
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
5
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
6 /* finch
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
7 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15908
diff changeset
8 * Finch is the legal property of its developers, whose names are too numerous
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
10 * source distribution.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
11 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
12 * This program is free software; you can redistribute it and/or modify
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
13 * it under the terms of the GNU General Public License as published by
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
15 * (at your option) any later version.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
16 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
17 * This program is distributed in the hope that it will be useful,
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
20 * GNU General Public License for more details.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
21 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
22 * You should have received a copy of the GNU General Public License
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
23 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19555
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14555
diff changeset
25 */
18273
e61c53184c52 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18134
diff changeset
26 #include "finch.h"
e61c53184c52 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18134
diff changeset
27
13939
76fa1e736c99 [gaim-migrate @ 16354]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13931
diff changeset
28 #include <account.h>
76fa1e736c99 [gaim-migrate @ 16354]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13931
diff changeset
29 #include <blist.h>
22376
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
30 #include <log.h>
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
31 #include <notify.h>
22378
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
32 #include <privacy.h>
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
33 #include <request.h>
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
34 #include <savedstatuses.h>
13939
76fa1e736c99 [gaim-migrate @ 16354]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13931
diff changeset
35 #include <server.h>
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
36 #include <signal.h>
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
37 #include <status.h>
13939
76fa1e736c99 [gaim-migrate @ 16354]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13931
diff changeset
38 #include <util.h>
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
39 #include "debug.h"
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
40
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
41 #include "gntbox.h"
21804
931ef2cc7cfb Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents: 21630
diff changeset
42 #include "gntcolors.h"
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
43 #include "gntcombobox.h"
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
44 #include "gntentry.h"
15702
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
45 #include "gntft.h"
13958
bd1c3bb3f33d [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13947
diff changeset
46 #include "gntlabel.h"
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
47 #include "gntline.h"
22376
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
48 #include "gntlog.h"
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
49 #include "gntmenu.h"
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
50 #include "gntmenuitem.h"
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
51 #include "gntmenuitemcheck.h"
15702
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
52 #include "gntpounce.h"
21804
931ef2cc7cfb Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents: 21630
diff changeset
53 #include "gntstyle.h"
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
54 #include "gnttree.h"
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
55 #include "gntutils.h"
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
56 #include "gntwindow.h"
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
57
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
58 #include "gntblist.h"
14450
1ac2b6e98ef8 [gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14447
diff changeset
59 #include "gntconv.h"
14188
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
60 #include "gntstatus.h"
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
61 #include <string.h>
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
62
16478
19107605c565 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents: 16344
diff changeset
63 #define PREF_ROOT "/finch/blist"
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
64 #define TYPING_TIMEOUT 4000
14072
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
65
24450
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
66 #define SHOW_EMPTY_GROUP_TIMEOUT 60
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
67
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
68 typedef struct
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
69 {
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
70 GntWidget *window;
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
71 GntWidget *tree;
13919
94caf5dc02b4 [gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13915
diff changeset
72
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
73 GntWidget *tooltip;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
74 PurpleBlistNode *tnode; /* Who is the tooltip being displayed for? */
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
75 GList *tagged; /* A list of tagged blistnodes */
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
76
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
77 GntWidget *context;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
78 PurpleBlistNode *cnode;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
79
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
80 /* XXX: I am KISSing */
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
81 GntWidget *status; /* Dropdown with the statuses */
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
82 GntWidget *statustext; /* Status message */
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
83 int typing;
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
84
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
85 GntWidget *menu;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
86 /* These are the menuitems that get regenerated */
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
87 GntMenuItem *accounts;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
88 GntMenuItem *plugins;
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
89 GntMenuItem *grouping;
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
90
24450
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
91 /* When a new group is manually added, it is empty, but we still want to show it
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
92 * for a while (SHOW_EMPTY_GROUP_TIMEOUT seconds) even if 'show empty groups' is
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
93 * not selected.
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
94 */
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
95 GList *new_group;
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
96 guint new_group_timeout;
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
97
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
98 FinchBlistManager *manager;
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
99 } FinchBlist;
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
100
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
101 typedef struct
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
102 {
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
103 gpointer row; /* the row in the GntTree */
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
104 guint signed_timer; /* used when 'recently' signed on/off */
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
105 } FinchBlistNode;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
106
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
107 typedef enum
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
108 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
109 STATUS_PRIMITIVE = 0,
14188
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
110 STATUS_SAVED_POPULAR,
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
111 STATUS_SAVED_ALL,
14194
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
112 STATUS_SAVED_NEW
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
113 } StatusType;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
114
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
115 typedef struct
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
116 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
117 StatusType type;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
118 union
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
119 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
120 PurpleStatusPrimitive prim;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
121 PurpleSavedStatus *saved;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
122 } u;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
123 } StatusBoxItem;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
124
18850
8242ced9d971 We don't need dynamic things here.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18831
diff changeset
125 static FinchBlist *ggblist;
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
126
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
127 static void add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
128 static void add_contact(PurpleContact *contact, FinchBlist *ggblist);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
129 static void add_group(PurpleGroup *group, FinchBlist *ggblist);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
130 static void add_chat(PurpleChat *chat, FinchBlist *ggblist);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
131 static void add_node(PurpleBlistNode *node, FinchBlist *ggblist);
17876
e22e8884af80 Fix for the bug Alver reported:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17862
diff changeset
132 static void node_update(PurpleBuddyList *list, PurpleBlistNode *node);
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
133 #if 0
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
134 static gboolean is_contact_online(PurpleContact *contact);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
135 static gboolean is_group_online(PurpleGroup *group);
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
136 #endif
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
137 static void draw_tooltip(FinchBlist *ggblist);
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
138 static void tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full);
14109
1af2b9d5ef3f [gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14104
diff changeset
139 static gboolean remove_typing_cb(gpointer null);
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
140 static void remove_peripherals(FinchBlist *ggblist);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
141 static const char * get_display_name(PurpleBlistNode *node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
142 static void savedstatus_changed(PurpleSavedStatus *now, PurpleSavedStatus *old);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
143 static void blist_show(PurpleBuddyList *list);
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
144 static void update_node_display(PurpleBlistNode *buddy, FinchBlist *ggblist);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
145 static void update_buddy_display(PurpleBuddy *buddy, FinchBlist *ggblist);
16828
0501ee8b8220 Fix this spectacularly braindead code. I must've been on the good stuff when I wrote this. Fixes #364.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16719
diff changeset
146 static void account_signed_on_cb(PurpleConnection *pc, gpointer null);
17295
9bb95ea7e95f Re-show the add buddy request dialog if something went wrong. It's easy to lose the buddy who just added you otherwise.
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
147 static void finch_request_add_buddy(PurpleAccount *account, const char *username, const char *grp, const char *alias);
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
148 static void menu_group_set_cb(GntMenuItem *item, gpointer null);
13919
94caf5dc02b4 [gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13915
diff changeset
149
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
150 /* Sort functions */
16555
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
151 static int blist_node_compare_position(PurpleBlistNode *n1, PurpleBlistNode *n2);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
152 static int blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
153 static int blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
154 static int blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2);
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
155
21804
931ef2cc7cfb Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents: 21630
diff changeset
156 static int color_available;
931ef2cc7cfb Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents: 21630
diff changeset
157 static int color_away;
931ef2cc7cfb Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents: 21630
diff changeset
158 static int color_offline;
931ef2cc7cfb Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents: 21630
diff changeset
159 static int color_idle;
931ef2cc7cfb Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents: 21630
diff changeset
160
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
161 /**
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
162 * Buddy List Manager functions.
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
163 */
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
164
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
165 static gboolean default_can_add_node(PurpleBlistNode *node)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
166 {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
167 gboolean offline = purple_prefs_get_bool(PREF_ROOT "/showoffline");
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
168
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
169 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
170 PurpleBuddy *buddy = (PurpleBuddy*)node;
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
171 FinchBlistNode *fnode = FINCH_GET_DATA(node);
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
172 if (!purple_buddy_get_contact(buddy))
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
173 return FALSE; /* When a new buddy is added and show-offline is set */
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
174 if (PURPLE_BUDDY_IS_ONLINE(buddy))
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
175 return TRUE; /* The buddy is online */
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
176 if (!purple_account_is_connected(purple_buddy_get_account(buddy)))
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
177 return FALSE; /* The account is disconnected. Do not show */
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
178 if (offline)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
179 return TRUE; /* We want to see offline buddies too */
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
180 if (fnode && fnode->signed_timer)
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
181 return TRUE; /* Show if the buddy just signed off */
22314
850c1c5e24b9 Pay attention to the 'show_offline' setting for the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22312
diff changeset
182 if (purple_blist_node_get_bool(node, "show_offline"))
850c1c5e24b9 Pay attention to the 'show_offline' setting for the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22312
diff changeset
183 return TRUE;
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
184 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
185 PurpleBlistNode *nd;
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
186 for (nd = purple_blist_node_get_first_child(node);
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
187 nd; nd = purple_blist_node_get_sibling_next(nd)) {
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
188 if (default_can_add_node(nd))
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
189 return TRUE;
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
190 }
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
191 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
192 PurpleChat *chat = (PurpleChat*)node;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
193 if (purple_account_is_connected(purple_chat_get_account(chat)))
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
194 return TRUE; /* Show whenever the account is online */
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
195 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
196 PurpleBlistNode *nd;
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
197 gboolean empty = purple_prefs_get_bool(PREF_ROOT "/emptygroups");
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
198 if (empty)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
199 return TRUE; /* If we want to see empty groups, we can show any group */
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
200
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
201 for (nd = purple_blist_node_get_first_child(node);
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
202 nd; nd = purple_blist_node_get_sibling_next(nd)) {
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
203 if (default_can_add_node(nd))
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
204 return TRUE;
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
205 }
24450
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
206
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
207 if (ggblist && ggblist->new_group && g_list_find(ggblist->new_group, node))
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
208 return TRUE;
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
209 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
210
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
211 return FALSE;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
212 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
213
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
214 static gpointer default_find_parent(PurpleBlistNode *node)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
215 {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
216 gpointer ret = NULL;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
217 switch (purple_blist_node_get_type(node)) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
218 case PURPLE_BLIST_BUDDY_NODE:
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
219 case PURPLE_BLIST_CONTACT_NODE:
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
220 case PURPLE_BLIST_CHAT_NODE:
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
221 ret = purple_blist_node_get_parent(node);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
222 break;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
223 default:
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
224 break;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
225 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
226 if (ret)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
227 add_node(ret, ggblist);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
228 return ret;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
229 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
230
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
231 static gboolean default_create_tooltip(gpointer selected_row, GString **body, char **tool_title)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
232 {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
233 GString *str;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
234 PurpleBlistNode *node = selected_row;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
235 int lastseen = 0;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
236 char *title;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
237
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
238 if (!node ||
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
239 purple_blist_node_get_type(node) == PURPLE_BLIST_OTHER_NODE)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
240 return FALSE;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
241
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
242 str = g_string_new("");
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
243
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
244 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
245 PurpleBuddy *pr = purple_contact_get_priority_buddy((PurpleContact*)node);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
246 gboolean offline = !PURPLE_BUDDY_IS_ONLINE(pr);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
247 gboolean showoffline = purple_prefs_get_bool(PREF_ROOT "/showoffline");
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
248 const char *name = purple_buddy_get_name(pr);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
249
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
250 title = g_strdup(name);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
251 tooltip_for_buddy(pr, str, TRUE);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
252 for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node)) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
253 PurpleBuddy *buddy = (PurpleBuddy*)node;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
254 if (offline) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
255 int value = purple_blist_node_get_int(node, "last_seen");
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
256 if (value > lastseen)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
257 lastseen = value;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
258 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
259 if (node == (PurpleBlistNode*)pr)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
260 continue;
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
261 if (!purple_account_is_connected(purple_buddy_get_account(buddy)))
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
262 continue;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
263 if (!showoffline && !PURPLE_BUDDY_IS_ONLINE(buddy))
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
264 continue;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
265 str = g_string_append(str, "\n----------\n");
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
266 tooltip_for_buddy(buddy, str, FALSE);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
267 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
268 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
269 PurpleBuddy *buddy = (PurpleBuddy *)node;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
270 tooltip_for_buddy(buddy, str, TRUE);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
271 title = g_strdup(purple_buddy_get_name(buddy));
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
272 if (!PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node))
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
273 lastseen = purple_blist_node_get_int(node, "last_seen");
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
274 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
275 PurpleGroup *group = (PurpleGroup *)node;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
276
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
277 g_string_append_printf(str, _("Online: %d\nTotal: %d"),
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
278 purple_blist_get_group_online_count(group),
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
279 purple_blist_get_group_size(group, FALSE));
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
280
22342
916c989bd2c0 Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22341
diff changeset
281 title = g_strdup(purple_group_get_name(group));
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
282 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
283 PurpleChat *chat = (PurpleChat *)node;
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
284 PurpleAccount *account = purple_chat_get_account(chat);
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
286 g_string_append_printf(str, _("Account: %s (%s)"),
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
287 purple_account_get_username(account),
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
288 purple_account_get_protocol_name(account));
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
289
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
290 title = g_strdup(purple_chat_get_name(chat));
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
291 } else {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
292 g_string_free(str, TRUE);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
293 return FALSE;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
294 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
295
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
296 if (lastseen > 0) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
297 char *tmp = purple_str_seconds_to_string(time(NULL) - lastseen);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
298 g_string_append_printf(str, _("\nLast Seen: %s ago"), tmp);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
299 g_free(tmp);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
300 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
301
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
302 if (tool_title)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
303 *tool_title = title;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
304 else
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
305 g_free(title);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
306
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
307 if (body)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
308 *body = str;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
309 else
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
310 g_string_free(str, TRUE);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
311
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
312 return TRUE;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
313 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
314
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
315 static FinchBlistManager default_manager =
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
316 {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
317 "default",
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
318 N_("Default"),
22312
dae4ed366fcb Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22303
diff changeset
319 NULL,
dae4ed366fcb Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22303
diff changeset
320 NULL,
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
321 default_can_add_node,
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
322 default_find_parent,
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
323 default_create_tooltip,
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
324 {NULL, NULL, NULL, NULL}
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
325 };
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
326 static GList *managers;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
327
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
328 static FinchBlistNode *
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
329 create_finch_blist_node(PurpleBlistNode *node, gpointer row)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
330 {
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
331 FinchBlistNode *fnode = FINCH_GET_DATA(node);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
332 if (!fnode) {
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
333 fnode = g_new0(FinchBlistNode, 1);
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
334 fnode->signed_timer = 0;
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
335 FINCH_SET_DATA(node, fnode);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
336 }
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
337 fnode->row = row;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
338 return fnode;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
339 }
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
340
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
341 static void
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
342 reset_blist_node_ui_data(PurpleBlistNode *node)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
343 {
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
344 FinchBlistNode *fnode = FINCH_GET_DATA(node);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
345 if (fnode == NULL)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
346 return;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
347 if (fnode->signed_timer)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
348 purple_timeout_remove(fnode->signed_timer);
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
349 g_free(fnode);
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
350 FINCH_SET_DATA(node, NULL);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
351 }
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
352
21808
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
353 static int
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
354 get_display_color(PurpleBlistNode *node)
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
355 {
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
356 PurpleBuddy *buddy;
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
357 int color = 0;
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
358
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
359 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
360 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node)));
21808
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
361 if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
362 return 0;
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
363
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
364 buddy = (PurpleBuddy*)node;
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
365 if (purple_presence_is_idle(purple_buddy_get_presence(buddy))) {
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
366 color = color_idle;
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
367 } else if (purple_presence_is_available(purple_buddy_get_presence(buddy))) {
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
368 color = color_available;
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
369 } else if (purple_presence_is_online(purple_buddy_get_presence(buddy)) &&
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
370 !purple_presence_is_available(purple_buddy_get_presence(buddy))) {
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
371 color = color_away;
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
372 } else if (!purple_presence_is_online(purple_buddy_get_presence(buddy))) {
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
373 color = color_offline;
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
374 }
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
375
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
376 return color;
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
377 }
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
378
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
379 static GntTextFormatFlags
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
380 get_blist_node_flag(PurpleBlistNode *node)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
381 {
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
382 GntTextFormatFlags flag = 0;
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
383 FinchBlistNode *fnode = FINCH_GET_DATA(node);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
384
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
385 if (ggblist->tagged && g_list_find(ggblist->tagged, node))
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
386 flag |= GNT_TEXT_FLAG_BOLD;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
387
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
388 if (fnode && fnode->signed_timer)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
389 flag |= GNT_TEXT_FLAG_BLINK;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
390 else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
391 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node)));
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
392 fnode = FINCH_GET_DATA(node);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
393 if (fnode && fnode->signed_timer)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
394 flag |= GNT_TEXT_FLAG_BLINK;
22935
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
395 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
396 /* If the node is collapsed, then check to see if any of the priority buddies of
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
397 * any of the contacts within this group recently signed on/off, and set the blink
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
398 * flag appropriately. */
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
399 /* XXX: Refs #5444 */
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
400 /* XXX: there's no way I can ask if the node is expanded or not? *sigh*
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
401 * API addition would be necessary */
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
402 #if 0
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
403 if (!gnt_tree_get_expanded(GNT_TREE(ggblist->tree), node)) {
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
404 for (node = purple_blist_node_get_first_child(node); node;
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
405 node = purple_blist_node_get_sibling_next(node)) {
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
406 PurpleBlistNode *pnode;
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
407 pnode = purple_contact_get_priority_buddy((PurpleContact*)node);
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
408 fnode = FINCH_GET_DATA(node);
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
409 if (fnode && fnode->signed_timer) {
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
410 flag |= GNT_TEXT_FLAG_BLINK;
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
411 break;
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
412 }
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
413 }
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
414 }
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
415 #endif
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
416 }
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
417
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
418 return flag;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
419 }
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
420
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
421 static void
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
422 blist_update_row_flags(PurpleBlistNode *node)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
423 {
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
424 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), node, get_blist_node_flag(node));
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
425 gnt_tree_set_row_color(GNT_TREE(ggblist->tree), node, get_display_color(node));
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
426 }
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
427
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
428 #if 0
14469
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
429 static gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
430 is_contact_online(PurpleContact *contact)
14469
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
431 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
432 PurpleBlistNode *node;
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
433 for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)contact)); node;
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
434 node = purple_blist_node_get_sibling_next(node)) {
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
435 FinchBlistNode *fnode = FINCH_GET_DATA(node);
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
436 if (PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node) ||
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
437 (fnode && fnode->signed_timer))
14469
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
438 return TRUE;
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
439 }
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
440 return FALSE;
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
441 }
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
442
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
443 static gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
444 is_group_online(PurpleGroup *group)
14469
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
445 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
446 PurpleBlistNode *node;
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
447 for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)group)); node;
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
448 node = purple_blist_node_get_sibling_next(node)) {
18738
730acacb64e1 Chats aren't shown if their account is offline, so a group of offline chats shouldn't be either
Richard Nelson <wabz@pidgin.im>
parents: 18626
diff changeset
449 if (PURPLE_BLIST_NODE_IS_CHAT(node) &&
730acacb64e1 Chats aren't shown if their account is offline, so a group of offline chats shouldn't be either
Richard Nelson <wabz@pidgin.im>
parents: 18626
diff changeset
450 purple_account_is_connected(((PurpleChat *)node)->account))
14469
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
451 return TRUE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
452 else if (is_contact_online((PurpleContact*)node))
14469
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
453 return TRUE;
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
454 }
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
455 return FALSE;
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
456 }
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
457 #endif
14469
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
458
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
459 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
460 new_node(PurpleBlistNode *node)
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
461 {
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
462 }
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
463
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
464 static void
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
465 add_node(PurpleBlistNode *node, FinchBlist *ggblist)
13927
c2f57a00bc1f [gaim-migrate @ 16331]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13926
diff changeset
466 {
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
467 if (FINCH_GET_DATA(node))
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
468 return;
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
469
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
470 if (!ggblist->manager->can_add_node(node))
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
471 return;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
472
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
473 if (PURPLE_BLIST_NODE_IS_BUDDY(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
474 add_buddy((PurpleBuddy*)node, ggblist);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
475 else if (PURPLE_BLIST_NODE_IS_CONTACT(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
476 add_contact((PurpleContact*)node, ggblist);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
477 else if (PURPLE_BLIST_NODE_IS_GROUP(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
478 add_group((PurpleGroup*)node, ggblist);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
479 else if (PURPLE_BLIST_NODE_IS_CHAT(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
480 add_chat((PurpleChat *)node, ggblist);
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
481
13927
c2f57a00bc1f [gaim-migrate @ 16331]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13926
diff changeset
482 draw_tooltip(ggblist);
c2f57a00bc1f [gaim-migrate @ 16331]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13926
diff changeset
483 }
c2f57a00bc1f [gaim-migrate @ 16331]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13926
diff changeset
484
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
485 void finch_blist_manager_add_node(PurpleBlistNode *node)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
486 {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
487 add_node(node, ggblist);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
488 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
489
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
490 static void
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
491 remove_tooltip(FinchBlist *ggblist)
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
492 {
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
493 gnt_widget_destroy(ggblist->tooltip);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
494 ggblist->tooltip = NULL;
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
495 ggblist->tnode = NULL;
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
496 }
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
497
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
498 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
499 node_remove(PurpleBuddyList *list, PurpleBlistNode *node)
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
500 {
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
501 FinchBlist *ggblist = FINCH_GET_DATA(list);
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
502 PurpleBlistNode *parent;
13919
94caf5dc02b4 [gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13915
diff changeset
503
24450
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
504 if (ggblist == NULL || FINCH_GET_DATA(node) == NULL)
13919
94caf5dc02b4 [gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13915
diff changeset
505 return;
94caf5dc02b4 [gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13915
diff changeset
506
24450
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
507 if (PURPLE_BLIST_NODE_IS_GROUP(node) && ggblist->new_group) {
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
508 ggblist->new_group = g_list_remove(ggblist->new_group, node);
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
509 }
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
510
13919
94caf5dc02b4 [gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13915
diff changeset
511 gnt_tree_remove(GNT_TREE(ggblist->tree), node);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
512 reset_blist_node_ui_data(node);
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
513 if (ggblist->tagged)
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
514 ggblist->tagged = g_list_remove(ggblist->tagged, node);
13919
94caf5dc02b4 [gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13915
diff changeset
515
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
516 parent = purple_blist_node_get_parent(node);
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
517 for (node = purple_blist_node_get_first_child(node); node;
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
518 node = purple_blist_node_get_sibling_next(node))
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
519 node_remove(list, node);
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
520
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
521 if (parent) {
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
522 if (!ggblist->manager->can_add_node(parent))
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
523 node_remove(list, parent);
17876
e22e8884af80 Fix for the bug Alver reported:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17862
diff changeset
524 else
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
525 node_update(list, parent);
13919
94caf5dc02b4 [gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13915
diff changeset
526 }
14910
a51aca2259d0 [gaim-migrate @ 17617]
Richard Nelson <wabz@pidgin.im>
parents: 14909
diff changeset
527
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
528 draw_tooltip(ggblist);
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
529 }
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
530
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
531 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
532 node_update(PurpleBuddyList *list, PurpleBlistNode *node)
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
533 {
14455
dec960030def [gaim-migrate @ 17101]
Ethan Blanton <elb@pidgin.im>
parents: 14450
diff changeset
534 /* It really looks like this should never happen ... but it does.
dec960030def [gaim-migrate @ 17101]
Ethan Blanton <elb@pidgin.im>
parents: 14450
diff changeset
535 This will at least emit a warning to the log when it
dec960030def [gaim-migrate @ 17101]
Ethan Blanton <elb@pidgin.im>
parents: 14450
diff changeset
536 happens, so maybe someone will figure it out. */
dec960030def [gaim-migrate @ 17101]
Ethan Blanton <elb@pidgin.im>
parents: 14450
diff changeset
537 g_return_if_fail(node != NULL);
dec960030def [gaim-migrate @ 17101]
Ethan Blanton <elb@pidgin.im>
parents: 14450
diff changeset
538
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
539 if (FINCH_GET_DATA(list)== NULL)
14458
b49cf8395bfa [gaim-migrate @ 17104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14455
diff changeset
540 return; /* XXX: this is probably the place to auto-join chats */
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
541
17862
32f49f3a139a Fix a crash exposed by nullprpl.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17845
diff changeset
542 if (ggblist->window == NULL)
32f49f3a139a Fix a crash exposed by nullprpl.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17845
diff changeset
543 return;
32f49f3a139a Fix a crash exposed by nullprpl.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17845
diff changeset
544
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
545 if (FINCH_GET_DATA(node)!= NULL) {
14080
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
546 gnt_tree_change_text(GNT_TREE(ggblist->tree), node,
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
547 0, get_display_name(node));
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
548 gnt_tree_sort_row(GNT_TREE(ggblist->tree), node);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
549 blist_update_row_flags(node);
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
550 if (gnt_tree_get_parent_key(GNT_TREE(ggblist->tree), node) !=
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
551 ggblist->manager->find_parent(node))
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
552 node_remove(list, node);
14080
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
553 }
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
554
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
555 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
556 PurpleBuddy *buddy = (PurpleBuddy*)node;
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
557 add_node((PurpleBlistNode*)buddy, FINCH_GET_DATA(list));
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
558 node_update(list, purple_blist_node_get_parent(node));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
559 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
560 add_node(node, FINCH_GET_DATA(list));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
561 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
562 if (FINCH_GET_DATA(node)== NULL) {
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
563 /* The core seems to expect the UI to add the buddies. */
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
564 for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node))
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
565 add_node(node, FINCH_GET_DATA(list));
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
566 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
567 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
568 if (!ggblist->manager->can_add_node(node))
14469
3b398f75a695 [gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14467
diff changeset
569 node_remove(list, node);
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
570 else
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
571 add_node(node, FINCH_GET_DATA(list));
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
572 }
24198
a8cf4ef3982a Update the tooltip if the status of the selected node changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23485
diff changeset
573 if (ggblist->tnode == node) {
a8cf4ef3982a Update the tooltip if the status of the selected node changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23485
diff changeset
574 draw_tooltip(ggblist);
a8cf4ef3982a Update the tooltip if the status of the selected node changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23485
diff changeset
575 }
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
576 }
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
577
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
578 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
579 new_list(PurpleBuddyList *list)
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
580 {
14909
d72792eb7575 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14908
diff changeset
581 if (ggblist)
d72792eb7575 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14908
diff changeset
582 return;
d72792eb7575 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14908
diff changeset
583
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
584 ggblist = g_new0(FinchBlist, 1);
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
585 FINCH_SET_DATA(list, ggblist);
22300
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
586 ggblist->manager = finch_blist_manager_find(purple_prefs_get_string(PREF_ROOT "/grouping"));
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
587 if (!ggblist->manager)
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
588 ggblist->manager = &default_manager;
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
589 }
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
590
24450
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
591 static gboolean
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
592 remove_new_empty_group(gpointer data)
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
593 {
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
594 PurpleBuddyList *list;
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
595
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
596 if (!ggblist)
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
597 return FALSE;
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
598
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
599 list = purple_get_blist();
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
600 g_return_val_if_fail(list, FALSE);
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
601
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
602 ggblist->new_group_timeout = 0;
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
603 while (ggblist->new_group) {
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
604 PurpleBlistNode *group = ggblist->new_group->data;
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
605 ggblist->new_group = g_list_delete_link(ggblist->new_group, ggblist->new_group);
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
606 node_update(list, group);
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
607 }
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
608
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
609 return FALSE;
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
610 }
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
611
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
612 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
613 add_buddy_cb(void *data, PurpleRequestFields *allfields)
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
614 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
615 const char *username = purple_request_fields_get_string(allfields, "screenname");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
616 const char *alias = purple_request_fields_get_string(allfields, "alias");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
617 const char *group = purple_request_fields_get_string(allfields, "group");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
618 PurpleAccount *account = purple_request_fields_get_account(allfields, "account");
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
619 const char *error = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
620 PurpleGroup *grp;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
621 PurpleBuddy *buddy;
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
622
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
623 if (!username)
22942
2bf494f8e2a4 Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents: 22935
diff changeset
624 error = _("You must provide a username for the buddy.");
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
625 else if (!group)
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
626 error = _("You must provide a group.");
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
627 else if (!account)
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
628 error = _("You must select an account.");
16982
febd8a44dce7 Show an error message when trying to add a buddy from an offline account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16981
diff changeset
629 else if (!purple_account_is_connected(account))
febd8a44dce7 Show an error message when trying to add a buddy from an offline account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16981
diff changeset
630 error = _("The selected account is not online.");
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
631
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
632 if (error)
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
633 {
17295
9bb95ea7e95f Re-show the add buddy request dialog if something went wrong. It's easy to lose the buddy who just added you otherwise.
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
634 finch_request_add_buddy(account, username, group, alias);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
635 purple_notify_error(NULL, _("Error"), _("Error adding buddy"), error);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
636 return;
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
637 }
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
638
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
639 grp = purple_find_group(group);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
640 if (!grp)
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
641 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
642 grp = purple_group_new(group);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
643 purple_blist_add_group(grp, NULL);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
644 }
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
645
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
646 /* XXX: Ask if there's already the same buddy in the same group (#4553) */
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
647
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
648 buddy = purple_buddy_new(account, username, alias);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
649 purple_blist_add_buddy(buddy, NULL, grp, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
650 purple_account_add_buddy(account, buddy);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
651 }
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
652
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
653 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
654 finch_request_add_buddy(PurpleAccount *account, const char *username, const char *grp, const char *alias)
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
655 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
656 PurpleRequestFields *fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
657 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
658 PurpleRequestField *field;
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
659
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
660 purple_request_fields_add_group(fields, group);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
661
22942
2bf494f8e2a4 Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents: 22935
diff changeset
662 field = purple_request_field_string_new("screenname", _("Username"), username, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
663 purple_request_field_group_add_field(group, field);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
664
22431
06ae5eb33844 Right-clicking on a widget should trigger the context-menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22379
diff changeset
665 field = purple_request_field_string_new("alias", _("Alias (optional)"), alias, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
666 purple_request_field_group_add_field(group, field);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
667
22431
06ae5eb33844 Right-clicking on a widget should trigger the context-menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22379
diff changeset
668 field = purple_request_field_string_new("group", _("Add in group"), grp, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
669 purple_request_field_group_add_field(group, field);
15908
d5b3f76ff418 Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents: 15906
diff changeset
670 purple_request_field_set_type_hint(field, "group");
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
671
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
672 field = purple_request_field_account_new("account", _("Account"), NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
673 purple_request_field_account_set_show_all(field, FALSE);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
674 if (account)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
675 purple_request_field_account_set_value(field, account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
676 purple_request_field_group_add_field(group, field);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
677
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
678 purple_request_fields(NULL, _("Add Buddy"), NULL, _("Please enter buddy information."),
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
679 fields,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
680 _("Add"), G_CALLBACK(add_buddy_cb),
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
681 _("Cancel"), NULL,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
682 account, NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
683 NULL);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
684 }
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
685
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
686 static void
22986
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
687 join_chat(PurpleChat *chat)
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
688 {
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
689 PurpleAccount *account = purple_chat_get_account(chat);
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
690 const char *name;
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
691 PurpleConversation *conv;
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
692 const char *alias;
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
693
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
694 /* This hack here is to work around the fact that there's no good way of
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
695 * getting the actual name of a chat. I don't understand why we return
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
696 * the alias for a chat when all we want is the name. */
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
697 alias = chat->alias;
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
698 chat->alias = NULL;
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
699 name = purple_chat_get_name(chat);
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
700 conv = purple_find_conversation_with_account(
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
701 PURPLE_CONV_TYPE_CHAT, name, account);
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
702 chat->alias = (char *)alias;
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
703
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
704 if (!conv || purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) {
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
705 serv_join_chat(purple_account_get_connection(account),
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
706 purple_chat_get_components(chat));
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
707 } else if (conv) {
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
708 purple_conversation_present(conv);
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
709 }
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
710 }
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
711
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
712 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
713 add_chat_cb(void *data, PurpleRequestFields *allfields)
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
714 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
715 PurpleAccount *account;
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
716 const char *alias, *name, *group;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
717 PurpleChat *chat;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
718 PurpleGroup *grp;
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
719 GHashTable *hash = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
720 PurpleConnection *gc;
18852
cc1891434459 Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18851
diff changeset
721 gboolean autojoin;
22336
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
722 PurplePluginProtocolInfo *info;
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
723
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
724 account = purple_request_fields_get_account(allfields, "account");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
725 name = purple_request_fields_get_string(allfields, "name");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
726 alias = purple_request_fields_get_string(allfields, "alias");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
727 group = purple_request_fields_get_string(allfields, "group");
18852
cc1891434459 Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18851
diff changeset
728 autojoin = purple_request_fields_get_bool(allfields, "autojoin");
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
729
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
730 if (!purple_account_is_connected(account) || !name || !*name)
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
731 return;
22336
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
732
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
733 if (!group || !*group)
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
734 group = _("Chats");
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
735
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
736 gc = purple_account_get_connection(account);
22336
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
737 info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
738 if (info->chat_info_defaults != NULL)
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
739 hash = info->chat_info_defaults(gc, name);
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
740
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
741 chat = purple_chat_new(account, name, hash);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
742
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
743 if (chat != NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
744 if ((grp = purple_find_group(group)) == NULL) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
745 grp = purple_group_new(group);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
746 purple_blist_add_group(grp, NULL);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
747 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
748 purple_blist_add_chat(chat, grp, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
749 purple_blist_alias_chat(chat, alias);
18852
cc1891434459 Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18851
diff changeset
750 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gnt-autojoin", autojoin);
22986
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
751 if (autojoin) {
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
752 join_chat(chat);
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
753 }
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
754 }
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
755 }
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
756
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
757 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
758 finch_request_add_chat(PurpleAccount *account, PurpleGroup *grp, const char *alias, const char *name)
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
759 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
760 PurpleRequestFields *fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
761 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
762 PurpleRequestField *field;
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
763
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
764 purple_request_fields_add_group(fields, group);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
765
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
766 field = purple_request_field_account_new("account", _("Account"), NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
767 purple_request_field_account_set_show_all(field, FALSE);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
768 if (account)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
769 purple_request_field_account_set_value(field, account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
770 purple_request_field_group_add_field(group, field);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
771
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
772 field = purple_request_field_string_new("name", _("Name"), name, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
773 purple_request_field_group_add_field(group, field);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
774
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
775 field = purple_request_field_string_new("alias", _("Alias"), alias, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
776 purple_request_field_group_add_field(group, field);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
777
22342
916c989bd2c0 Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22341
diff changeset
778 field = purple_request_field_string_new("group", _("Group"), grp ? purple_group_get_name(grp) : NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
779 purple_request_field_group_add_field(group, field);
22976
df744a1b1bbe Setup tab-completion for groups in the 'Add Chat' dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
780 purple_request_field_set_type_hint(field, "group");
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
781
18852
cc1891434459 Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18851
diff changeset
782 field = purple_request_field_bool_new("autojoin", _("Auto-join"), FALSE);
cc1891434459 Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18851
diff changeset
783 purple_request_field_group_add_field(group, field);
cc1891434459 Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18851
diff changeset
784
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
785 purple_request_fields(NULL, _("Add Chat"), NULL,
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
786 _("You can edit more information from the context menu later."),
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
787 fields, _("Add"), G_CALLBACK(add_chat_cb), _("Cancel"), NULL,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
788 NULL, NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
789 NULL);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
790 }
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
791
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
792 static void
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
793 add_group_cb(gpointer null, const char *group)
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
794 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
795 PurpleGroup *grp;
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
796
24458
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
797 if (!group || !*group) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
798 purple_notify_error(NULL, _("Error"), _("Error adding group"),
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
799 _("You must give a name for the group to add."));
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
800 return;
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
801 }
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
802
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
803 grp = purple_find_group(group);
24458
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
804 if (!grp) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
805 grp = purple_group_new(group);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
806 purple_blist_add_group(grp, NULL);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
807 }
24458
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
808
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
809 if (!ggblist)
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
810 return;
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
811
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
812 /* Treat the group as a new group even if it had existed before. This should
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
813 * make things easier to add buddies to empty groups (new or old) without having
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
814 * to turn on 'show empty groups' setting */
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
815 ggblist->new_group = g_list_prepend(ggblist->new_group, grp);
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
816 if (ggblist->new_group_timeout)
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
817 purple_timeout_remove(ggblist->new_group_timeout);
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
818 ggblist->new_group_timeout = purple_timeout_add_seconds(SHOW_EMPTY_GROUP_TIMEOUT,
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
819 remove_new_empty_group, NULL);
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
820
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
821 /* Select the group */
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
822 if (ggblist->tree) {
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
823 FinchBlistNode *fnode = FINCH_GET_DATA((PurpleBlistNode*)grp);
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
824 if (!fnode)
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
825 add_node((PurpleBlistNode*)grp, ggblist);
7706c9b08d5e Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24450
diff changeset
826 gnt_tree_set_selected(GNT_TREE(ggblist->tree), grp);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
827 }
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
828 }
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
829
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
830 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21855
diff changeset
831 finch_request_add_group(void)
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
832 {
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
833 purple_request_input(NULL, _("Add Group"), NULL, _("Enter the name of the group"),
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
834 NULL, FALSE, FALSE, NULL,
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
835 _("Add"), G_CALLBACK(add_group_cb), _("Cancel"), NULL,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
836 NULL, NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
837 NULL);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
838 }
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
839
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
840 static PurpleBlistUiOps blist_ui_ops =
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
841 {
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
842 new_list,
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
843 new_node,
14909
d72792eb7575 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14908
diff changeset
844 blist_show,
14447
32f854416012 [gaim-migrate @ 17091]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14446
diff changeset
845 node_update,
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
846 node_remove,
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
847 NULL,
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
848 NULL,
17164
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 17018
diff changeset
849 finch_request_add_buddy,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 17018
diff changeset
850 finch_request_add_chat,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 17018
diff changeset
851 finch_request_add_group,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 17018
diff changeset
852 NULL,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 17018
diff changeset
853 NULL,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 17018
diff changeset
854 NULL,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 17018
diff changeset
855 NULL
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
856 };
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
857
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
858 static gpointer
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21855
diff changeset
859 finch_blist_get_handle(void)
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
860 {
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
861 static int handle;
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
862
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
863 return &handle;
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
864 }
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
865
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
866 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
867 add_group(PurpleGroup *group, FinchBlist *ggblist)
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
868 {
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
869 gpointer parent;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
870 PurpleBlistNode *node = (PurpleBlistNode *)group;
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
871 if (FINCH_GET_DATA(node))
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
872 return;
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
873 parent = ggblist->manager->find_parent((PurpleBlistNode*)group);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
874 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group,
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
875 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)),
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
876 parent, NULL));
16165
24ec117bc52c Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents: 15991
diff changeset
877 gnt_tree_set_expanded(GNT_TREE(ggblist->tree), node,
24ec117bc52c Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents: 15991
diff changeset
878 !purple_blist_node_get_bool(node, "collapsed"));
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
879 }
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
880
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
881 static const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
882 get_display_name(PurpleBlistNode *node)
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
883 {
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
884 static char text[2096];
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
885 char status[8] = " ";
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
886 const char *name = NULL;
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
887
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
888 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
889 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); /* XXX: this can return NULL?! */
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
890
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
891 if (node == NULL)
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
892 return NULL;
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
893
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
894 if (PURPLE_BLIST_NODE_IS_BUDDY(node))
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
895 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
896 PurpleBuddy *buddy = (PurpleBuddy *)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
897 PurpleStatusPrimitive prim;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
898 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
899 PurpleStatus *now;
13989
9a647311c9ac [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13978
diff changeset
900 gboolean ascii = gnt_ascii_only();
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
901
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
902 presence = purple_buddy_get_presence(buddy);
18614
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
903 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE))
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
904 strncpy(status, ascii ? ":" : "☎", sizeof(status) - 1);
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
905 else {
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
906 now = purple_presence_get_active_status(presence);
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
907
18614
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
908 prim = purple_status_type_get_primitive(purple_status_get_type(now));
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
909
18614
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
910 switch(prim) {
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
911 case PURPLE_STATUS_OFFLINE:
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
912 strncpy(status, ascii ? "x" : "⊗", sizeof(status) - 1);
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
913 break;
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
914 case PURPLE_STATUS_AVAILABLE:
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
915 strncpy(status, ascii ? "o" : "â—¯", sizeof(status) - 1);
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
916 break;
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
917 default:
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
918 strncpy(status, ascii ? "." : "⊖", sizeof(status) - 1);
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
919 break;
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
920 }
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
921 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
922 name = purple_buddy_get_alias(buddy);
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
923 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
924 else if (PURPLE_BLIST_NODE_IS_CHAT(node))
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
925 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
926 PurpleChat *chat = (PurpleChat*)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
927 name = purple_chat_get_name(chat);
13947
a77f6f615c20 [gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13946
diff changeset
928
a77f6f615c20 [gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13946
diff changeset
929 strncpy(status, "~", sizeof(status) - 1);
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
930 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
931 else if (PURPLE_BLIST_NODE_IS_GROUP(node))
22342
916c989bd2c0 Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22341
diff changeset
932 return purple_group_get_name((PurpleGroup*)node);
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
933
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
934 snprintf(text, sizeof(text) - 1, "%s %s", status, name);
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
935
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
936 return text;
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
937 }
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
938
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
939 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
940 add_chat(PurpleChat *chat, FinchBlist *ggblist)
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
941 {
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
942 gpointer parent;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
943 PurpleBlistNode *node = (PurpleBlistNode *)chat;
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
944 if (FINCH_GET_DATA(node))
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
945 return;
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
946 if (!purple_account_is_connected(purple_chat_get_account(chat)))
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
947 return;
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
948
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
949 parent = ggblist->manager->find_parent((PurpleBlistNode*)chat);
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
950
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
951 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), chat,
14026
ad91ce0effe2 [gaim-migrate @ 16520]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14021
diff changeset
952 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)),
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
953 parent, NULL));
13946
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
954 }
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
955
c895c1eeb4d7 [gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13939
diff changeset
956 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
957 add_contact(PurpleContact *contact, FinchBlist *ggblist)
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
958 {
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
959 gpointer parent;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
960 PurpleBlistNode *node = (PurpleBlistNode*)contact;
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
961 const char *name;
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
962
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
963 if (FINCH_GET_DATA(node))
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
964 return;
21808
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
965
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
966 name = get_display_name(node);
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
967 if (name == NULL)
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
968 return;
21808
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
969
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
970 parent = ggblist->manager->find_parent((PurpleBlistNode*)contact);
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
971
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
972 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), contact,
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
973 gnt_tree_create_row(GNT_TREE(ggblist->tree), name),
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
974 parent, NULL));
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
975
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
976 gnt_tree_set_expanded(GNT_TREE(ggblist->tree), contact, FALSE);
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
977 }
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
978
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
979 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
980 add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist)
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
981 {
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
982 gpointer parent;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
983 PurpleBlistNode *node = (PurpleBlistNode *)buddy;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
984 PurpleContact *contact;
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
985
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
986 if (FINCH_GET_DATA(node))
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
987 return;
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
988
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
989 contact = purple_buddy_get_contact(buddy);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
990 parent = ggblist->manager->find_parent((PurpleBlistNode*)buddy);
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
991
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
992 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy,
14026
ad91ce0effe2 [gaim-migrate @ 16520]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14021
diff changeset
993 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)),
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
994 parent, NULL));
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
995
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
996 blist_update_row_flags((PurpleBlistNode*)buddy);
21808
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
997 if (buddy == purple_contact_get_priority_buddy(contact))
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
998 blist_update_row_flags((PurpleBlistNode*)contact);
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
999 }
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1000
13959
49d3a87c2679 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13958
diff changeset
1001 #if 0
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1002 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1003 buddy_signed_on(PurpleBuddy *buddy, FinchBlist *ggblist)
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
1004 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1005 add_node((PurpleBlistNode*)buddy, ggblist);
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
1006 }
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
1007
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
1008 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1009 buddy_signed_off(PurpleBuddy *buddy, FinchBlist *ggblist)
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1010 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1011 node_remove(purple_get_blist(), (PurpleBlistNode*)buddy);
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1012 }
13959
49d3a87c2679 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13958
diff changeset
1013 #endif
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1014
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1015 PurpleBlistUiOps *finch_blist_get_ui_ops()
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1016 {
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1017 return &blist_ui_ops;
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1018 }
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1019
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1020 static void
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1021 selection_activate(GntWidget *widget, FinchBlist *ggblist)
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1022 {
13958
bd1c3bb3f33d [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13947
diff changeset
1023 GntTree *tree = GNT_TREE(ggblist->tree);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1024 PurpleBlistNode *node = gnt_tree_get_selection_data(tree);
13958
bd1c3bb3f33d [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13947
diff changeset
1025
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13993
diff changeset
1026 if (!node)
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13993
diff changeset
1027 return;
22986
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
1028
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1029 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
1030 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node)));
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13993
diff changeset
1031
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1032 if (PURPLE_BLIST_NODE_IS_BUDDY(node))
13958
bd1c3bb3f33d [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13947
diff changeset
1033 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1034 PurpleBuddy *buddy = (PurpleBuddy *)node;
18134
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1035 PurpleConversation *conv;
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1036 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1037 purple_buddy_get_name(buddy),
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1038 purple_buddy_get_account(buddy));
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1039 if (!conv) {
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1040 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM,
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1041 purple_buddy_get_account(buddy),
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1042 purple_buddy_get_name(buddy));
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1043 } else {
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
1044 FinchConv *ggconv = FINCH_GET_DATA(conv);
18134
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1045 gnt_window_present(ggconv->window);
47b947e1c8f1 present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents: 18132
diff changeset
1046 }
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1047 finch_conversation_set_active(conv);
13958
bd1c3bb3f33d [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13947
diff changeset
1048 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1049 else if (PURPLE_BLIST_NODE_IS_CHAT(node))
13958
bd1c3bb3f33d [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13947
diff changeset
1050 {
22986
a02bb7b14dca Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22976
diff changeset
1051 join_chat((PurpleChat*)node);
13958
bd1c3bb3f33d [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13947
diff changeset
1052 }
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1053 }
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1054
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1055 static void
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1056 context_menu_callback(GntMenuItem *item, gpointer data)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1057 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1058 PurpleMenuAction *action = data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1059 PurpleBlistNode *node = ggblist->cnode;
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1060 if (action) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1061 void (*callback)(PurpleBlistNode *, gpointer);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1062 callback = (void (*)(PurpleBlistNode *, gpointer))action->callback;
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1063 if (callback)
18765
84e78da62173 I can pretty much swear this worked at some point. I am not sure when this
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18738
diff changeset
1064 callback(node, action->data);
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1065 else
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1066 return;
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1067 }
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1068 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1069
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1070 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1071 gnt_append_menu_action(GntMenu *menu, PurpleMenuAction *action, gpointer parent)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1072 {
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1073 GList *list;
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1074 GntMenuItem *item;
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1075
14072
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
1076 if (action == NULL)
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
1077 return;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
1078
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1079 item = gnt_menuitem_new(action->label);
14912
176bce6dc803 [gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14910
diff changeset
1080 if (action->callback)
15991
1efb6bd8ba3f Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15931
diff changeset
1081 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), context_menu_callback, action);
1efb6bd8ba3f Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15931
diff changeset
1082 gnt_menu_add_item(menu, GNT_MENU_ITEM(item));
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1083
14912
176bce6dc803 [gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14910
diff changeset
1084 if (action->children) {
176bce6dc803 [gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14910
diff changeset
1085 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP);
176bce6dc803 [gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14910
diff changeset
1086 gnt_menuitem_set_submenu(item, GNT_MENU(sub));
176bce6dc803 [gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14910
diff changeset
1087 for (list = action->children; list; list = list->next)
176bce6dc803 [gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14910
diff changeset
1088 gnt_append_menu_action(GNT_MENU(sub), list->data, action);
176bce6dc803 [gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14910
diff changeset
1089 }
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1090 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1091
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1092 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1093 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1094 {
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1095 GList *list;
22336
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
1096 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1097
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1098 if(!prpl_info || !prpl_info->blist_node_menu)
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1099 return;
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1100
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1101 for(list = prpl_info->blist_node_menu(node); list;
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1102 list = g_list_delete_link(list, list))
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1103 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1104 PurpleMenuAction *act = (PurpleMenuAction *) list->data;
14532
c80424b94347 [gaim-migrate @ 17186]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14531
diff changeset
1105 act->data = node;
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1106 gnt_append_menu_action(menu, act, NULL);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1107 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1108 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1109
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1110 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1111 add_custom_action(GntMenu *menu, const char *label, PurpleCallback callback,
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1112 gpointer data)
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1113 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1114 PurpleMenuAction *action = purple_menu_action_new(label, callback, data, NULL);
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1115 gnt_append_menu_action(menu, action, NULL);
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1116 g_signal_connect_swapped(G_OBJECT(menu), "destroy",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1117 G_CALLBACK(purple_menu_action_free), action);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1118 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1119
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1120 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1121 chat_components_edit_ok(PurpleChat *chat, PurpleRequestFields *allfields)
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1122 {
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1123 GList *groups, *fields;
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1124
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1125 for (groups = purple_request_fields_get_groups(allfields); groups; groups = groups->next) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1126 fields = purple_request_field_group_get_fields(groups->data);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1127 for (; fields; fields = fields->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1128 PurpleRequestField *field = fields->data;
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1129 const char *id;
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1130 char *val;
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1131
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1132 id = purple_request_field_get_id(field);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1133 if (purple_request_field_get_type(field) == PURPLE_REQUEST_FIELD_INTEGER)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1134 val = g_strdup_printf("%d", purple_request_field_int_get_value(field));
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1135 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1136 val = g_strdup(purple_request_field_string_get_value(field));
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1137
22935
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
1138 if (!val) {
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
1139 g_hash_table_remove(purple_chat_get_components(chat), id);
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
1140 } else {
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
1141 g_hash_table_replace(purple_chat_get_components(chat), g_strdup(id), val); /* val should not be free'd */
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
1142 }
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1143 }
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1144 }
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1145 }
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1146
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1147 static void
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1148 chat_components_edit(PurpleBlistNode *selected, PurpleChat *chat)
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1149 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1150 PurpleRequestFields *fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1151 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1152 PurpleRequestField *field;
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1153 GList *parts, *iter;
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1154 struct proto_chat_entry *pce;
22335
f6715418a9a8 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22334
diff changeset
1155 PurpleConnection *gc;
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1156
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1157 purple_request_fields_add_group(fields, group);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1158
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1159 gc = purple_account_get_connection(purple_chat_get_account(chat));
22336
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
1160 parts = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info(gc);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1161
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1162 for (iter = parts; iter; iter = iter->next) {
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1163 pce = iter->data;
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1164 if (pce->is_int) {
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1165 int val;
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1166 const char *str = g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1167 if (!str || sscanf(str, "%d", &val) != 1)
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1168 val = pce->min;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1169 field = purple_request_field_int_new(pce->identifier, pce->label, val);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1170 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1171 field = purple_request_field_string_new(pce->identifier, pce->label,
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1172 g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier), FALSE);
22935
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
1173 if (pce->secret)
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
1174 purple_request_field_string_set_masked(field, TRUE);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1175 }
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1176
22935
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
1177 if (pce->required)
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
1178 purple_request_field_set_required(field, TRUE);
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22579
diff changeset
1179
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1180 purple_request_field_group_add_field(group, field);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1181 g_free(pce);
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1182 }
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1183
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1184 g_list_free(parts);
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1185
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1186 purple_request_fields(NULL, _("Edit Chat"), NULL, _("Please Update the necessary fields."),
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1187 fields, _("Edit"), G_CALLBACK(chat_components_edit_ok), _("Cancel"), NULL,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1188 NULL, NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1189 chat);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1190 }
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1191
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1192 static void
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1193 autojoin_toggled(GntMenuItem *item, gpointer data)
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1194 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1195 PurpleMenuAction *action = data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1196 purple_blist_node_set_bool(action->data, "gnt-autojoin",
15991
1efb6bd8ba3f Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15931
diff changeset
1197 gnt_menuitem_check_get_checked(GNT_MENU_ITEM_CHECK(item)));
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1198 }
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1199
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1200 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1201 create_chat_menu(GntMenu *menu, PurpleChat *chat)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1202 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1203 PurpleMenuAction *action = purple_menu_action_new(_("Auto-join"), NULL, chat, NULL);
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1204 GntMenuItem *check = gnt_menuitem_check_new(action->label);
15991
1efb6bd8ba3f Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15931
diff changeset
1205 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(check),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1206 purple_blist_node_get_bool((PurpleBlistNode*)chat, "gnt-autojoin"));
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1207 gnt_menu_add_item(menu, check);
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1208 gnt_menuitem_set_callback(check, autojoin_toggled, action);
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1209 g_signal_connect_swapped(G_OBJECT(menu), "destroy",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1210 G_CALLBACK(purple_menu_action_free), action);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1211
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1212 add_custom_action(menu, _("Edit Settings"), (PurpleCallback)chat_components_edit, chat);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1213 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1214
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1215 static void
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1216 finch_add_buddy(PurpleBlistNode *selected, PurpleGroup *grp)
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
1217 {
22342
916c989bd2c0 Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22341
diff changeset
1218 purple_blist_request_add_buddy(NULL, NULL, grp ? purple_group_get_name(grp) : NULL, NULL);
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
1219 }
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
1220
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
1221 static void
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1222 finch_add_group(PurpleBlistNode *selected, PurpleGroup *grp)
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
1223 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1224 purple_blist_request_add_group();
14124
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
1225 }
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
1226
181ebb961493 [gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
1227 static void
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1228 finch_add_chat(PurpleBlistNode *selected, PurpleGroup *grp)
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1229 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1230 purple_blist_request_add_chat(NULL, grp, NULL, NULL);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1231 }
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1232
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
1233 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1234 create_group_menu(GntMenu *menu, PurpleGroup *group)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1235 {
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1236 add_custom_action(menu, _("Add Buddy"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1237 PURPLE_CALLBACK(finch_add_buddy), group);
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1238 add_custom_action(menu, _("Add Chat"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1239 PURPLE_CALLBACK(finch_add_chat), group);
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1240 add_custom_action(menu, _("Add Group"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1241 PURPLE_CALLBACK(finch_add_group), group);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1242 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1243
17845
8ac5337e8f6d Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17366
diff changeset
1244 gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name)
17360
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17295
diff changeset
1245 {
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17295
diff changeset
1246 PurpleNotifyUserInfo *info = purple_notify_user_info_new();
17845
8ac5337e8f6d Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17366
diff changeset
1247 gpointer uihandle;
17360
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17295
diff changeset
1248 purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving..."));
17845
8ac5337e8f6d Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17366
diff changeset
1249 uihandle = purple_notify_userinfo(conn, name, info, NULL, NULL);
17360
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17295
diff changeset
1250 purple_notify_user_info_destroy(info);
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17295
diff changeset
1251
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17295
diff changeset
1252 serv_get_info(conn, name);
17845
8ac5337e8f6d Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17366
diff changeset
1253 return uihandle;
17360
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17295
diff changeset
1254 }
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17295
diff changeset
1255
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1256 static void
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1257 finch_blist_get_buddy_info_cb(PurpleBlistNode *selected, PurpleBuddy *buddy)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1258 {
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1259 finch_retrieve_user_info(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy));
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1260 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1261
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1262 static void
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1263 finch_blist_menu_send_file_cb(PurpleBlistNode *selected, PurpleBuddy *buddy)
15702
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1264 {
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1265 serv_send_file(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy), NULL);
15702
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1266 }
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1267
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1268 static void
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1269 finch_blist_pounce_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node)
15702
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1270 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1271 PurpleBuddy *b;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1272 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1273 b = purple_contact_get_priority_buddy((PurpleContact *)node);
15702
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1274 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1275 b = (PurpleBuddy *)node;
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1276 finch_pounce_editor_show(purple_buddy_get_account(b), purple_buddy_get_name(b), NULL);
15702
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1277 }
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1278
22378
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1279 static void
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1280 toggle_block_buddy(GntMenuItem *item, gpointer buddy)
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1281 {
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1282 gboolean block = gnt_menuitem_check_get_checked(GNT_MENU_ITEM_CHECK(item));
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1283 PurpleAccount *account = purple_buddy_get_account(buddy);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1284 const char *name = purple_buddy_get_name(buddy);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1285
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1286 block ? purple_privacy_deny(account, name, FALSE, FALSE) :
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1287 purple_privacy_allow(account, name, FALSE, FALSE);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1288 }
15702
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1289
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1290 static void
24504
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1291 toggle_show_offline(GntMenuItem *item, gpointer buddy)
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1292 {
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1293 purple_blist_node_set_bool(buddy, "show_offline",
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1294 !purple_blist_node_get_bool(buddy, "show_offline"));
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1295 if (!ggblist->manager->can_add_node(buddy))
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1296 node_remove(purple_get_blist(), buddy);
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1297 else
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1298 node_update(purple_get_blist(), buddy);
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1299 }
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1300
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1301 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1302 create_buddy_menu(GntMenu *menu, PurpleBuddy *buddy)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1303 {
22378
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1304 PurpleAccount *account;
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1305 gboolean permitted;
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1306 GntMenuItem *item;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1307 PurplePluginProtocolInfo *prpl_info;
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1308 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy));
22335
f6715418a9a8 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22334
diff changeset
1309
22336
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
1310 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1311 if (prpl_info && prpl_info->get_info)
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1312 {
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1313 add_custom_action(menu, _("Get Info"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1314 PURPLE_CALLBACK(finch_blist_get_buddy_info_cb), buddy);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1315 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1316
15702
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1317 add_custom_action(menu, _("Add Buddy Pounce"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1318 PURPLE_CALLBACK(finch_blist_pounce_node_cb), buddy);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1319
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1320 if (prpl_info && prpl_info->send_file)
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1321 {
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1322 if (!prpl_info->can_receive_file ||
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1323 prpl_info->can_receive_file(gc, purple_buddy_get_name(buddy)))
15702
111fdd9108cc Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15564
diff changeset
1324 add_custom_action(menu, _("Send File"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1325 PURPLE_CALLBACK(finch_blist_menu_send_file_cb), buddy);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1326 }
22378
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1327
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1328 account = purple_buddy_get_account(buddy);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1329 permitted = purple_privacy_check(account, purple_buddy_get_name(buddy));
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1330
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1331 item = gnt_menuitem_check_new(_("Blocked"));
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1332 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), !permitted);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1333 gnt_menuitem_set_callback(item, toggle_block_buddy, buddy);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1334 gnt_menu_add_item(menu, item);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
1335
24504
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1336 item = gnt_menuitem_check_new(_("Show when offline"));
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1337 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline"));
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1338 gnt_menuitem_set_callback(item, toggle_show_offline, buddy);
7cc4ea958ea8 Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24458
diff changeset
1339 gnt_menu_add_item(menu, item);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
1340
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1341 /* Protocol actions */
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1342 append_proto_menu(menu,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1343 purple_account_get_connection(purple_buddy_get_account(buddy)),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1344 (PurpleBlistNode*)buddy);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1345 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1346
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1347 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1348 append_extended_menu(GntMenu *menu, PurpleBlistNode *node)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1349 {
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1350 GList *iter;
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1351
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1352 for (iter = purple_blist_node_get_extended_menu(node);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1353 iter; iter = g_list_delete_link(iter, iter))
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1354 {
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1355 gnt_append_menu_action(menu, iter->data, NULL);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1356 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1357 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1358
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1359 /* Xerox'd from gtkdialogs.c:purple_gtkdialogs_remove_contact_cb */
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1360 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1361 remove_contact(PurpleContact *contact)
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1362 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1363 PurpleBlistNode *bnode, *cnode;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1364 PurpleGroup *group;
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1365
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1366 cnode = (PurpleBlistNode *)contact;
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1367 group = (PurpleGroup*)purple_blist_node_get_parent(cnode);
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1368 for (bnode = purple_blist_node_get_first_child(cnode); bnode; bnode = purple_blist_node_get_sibling_next(bnode)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1369 PurpleBuddy *buddy = (PurpleBuddy*)bnode;
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1370 PurpleAccount *account = purple_buddy_get_account(buddy);
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1371 if (purple_account_is_connected(account))
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1372 purple_account_remove_buddy(account, buddy, group);
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1373 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1374 purple_blist_remove_contact(contact);
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1375 }
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1376
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1377 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1378 rename_blist_node(PurpleBlistNode *node, const char *newname)
14080
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1379 {
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1380 const char *name = newname;
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1381 if (name && !*name)
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1382 name = NULL;
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1383
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1384 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1385 PurpleContact *contact = (PurpleContact*)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1386 PurpleBuddy *buddy = purple_contact_get_priority_buddy(contact);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1387 purple_blist_alias_contact(contact, name);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1388 purple_blist_alias_buddy(buddy, name);
14537
90c314c22c8e [gaim-migrate @ 17191]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14532
diff changeset
1389 serv_alias_buddy(buddy);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1390 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1391 purple_blist_alias_buddy((PurpleBuddy*)node, name);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1392 serv_alias_buddy((PurpleBuddy*)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1393 } else if (PURPLE_BLIST_NODE_IS_CHAT(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1394 purple_blist_alias_chat((PurpleChat*)node, name);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1395 else if (PURPLE_BLIST_NODE_IS_GROUP(node) && (name != NULL))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1396 purple_blist_rename_group((PurpleGroup*)node, name);
14080
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1397 else
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1398 g_return_if_reached();
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1399 }
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1400
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1401 static void
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1402 finch_blist_rename_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1403 {
14080
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1404 const char *name = NULL;
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1405 char *prompt;
16344
4f2b448b7559 Use 'alias' instead of 'rename' for non-group nodes. Thankfully, this does not introduce new strings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
1406 const char *text;
14080
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1407
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1408 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1409 name = purple_contact_get_alias((PurpleContact*)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1410 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1411 name = purple_buddy_get_contact_alias((PurpleBuddy*)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1412 else if (PURPLE_BLIST_NODE_IS_CHAT(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1413 name = purple_chat_get_name((PurpleChat*)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1414 else if (PURPLE_BLIST_NODE_IS_GROUP(node))
22342
916c989bd2c0 Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22341
diff changeset
1415 name = purple_group_get_name((PurpleGroup*)node);
14080
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1416 else
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1417 g_return_if_reached();
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
1418
14080
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1419 prompt = g_strdup_printf(_("Please enter the new name for %s"), name);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
1420
17018
18b76ac05780 Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16982
diff changeset
1421 text = PURPLE_BLIST_NODE_IS_GROUP(node) ? _("Rename") : _("Set Alias");
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1422 purple_request_input(node, text, prompt, _("Enter empty string to reset the name."),
16344
4f2b448b7559 Use 'alias' instead of 'rename' for non-group nodes. Thankfully, this does not introduce new strings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
1423 name, FALSE, FALSE, NULL, text, G_CALLBACK(rename_blist_node),
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1424 _("Cancel"), NULL,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1425 NULL, NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1426 node);
14080
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1427
7fad848bbe7b [gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
1428 g_free(prompt);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1429 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1430
22376
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1431
22491
06d2ee82aa58 Fix showing a contact's log, and don't access struct internals
Richard Nelson <wabz@pidgin.im>
parents: 22431
diff changeset
1432 static void showlog_cb(PurpleBlistNode *sel, PurpleBlistNode *node)
22376
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1433 {
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1434 PurpleLogType type;
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1435 PurpleAccount *account;
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1436 char *name = NULL;
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1437
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1438 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1439 PurpleBuddy *b = (PurpleBuddy*) node;
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1440 type = PURPLE_LOG_IM;
24951
d0837696fd3a Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24504
diff changeset
1441 name = g_strdup(purple_buddy_get_name(b));
d0837696fd3a Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24504
diff changeset
1442 account = purple_buddy_get_account(b);
22376
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1443 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1444 PurpleChat *c = (PurpleChat*) node;
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1445 PurplePluginProtocolInfo *prpl_info = NULL;
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1446 type = PURPLE_LOG_CHAT;
24951
d0837696fd3a Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24504
diff changeset
1447 account = purple_chat_get_account(c);
22376
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1448 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account)));
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1449 if (prpl_info && prpl_info->get_chat_name) {
24951
d0837696fd3a Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24504
diff changeset
1450 name = prpl_info->get_chat_name(purple_chat_get_components(c));
22376
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1451 }
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1452 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1453 finch_log_show_contact((PurpleContact *)node);
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1454 return;
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1455 } else {
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1456 /* This callback should not have been registered for a node
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1457 * that doesn't match the type of one of the blocks above. */
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1458 g_return_if_reached();
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1459 }
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1460
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1461 if (name && account) {
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1462 finch_log_show(type, name, account);
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1463 g_free(name);
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1464 }
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1465 }
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1466
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1467
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1468 /* Xeroxed from gtkdialogs.c:purple_gtkdialogs_remove_group_cb*/
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1469 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1470 remove_group(PurpleGroup *group)
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1471 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1472 PurpleBlistNode *cnode, *bnode;
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1473
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1474 cnode = purple_blist_node_get_first_child(((PurpleBlistNode*)group));
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1475
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1476 while (cnode) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1477 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1478 bnode = purple_blist_node_get_first_child(cnode);
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1479 cnode = purple_blist_node_get_sibling_next(cnode);
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1480 while (bnode) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1481 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1482 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) {
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1483 PurpleAccount *account;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1484 buddy = (PurpleBuddy*)bnode;
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1485 bnode = purple_blist_node_get_sibling_next(bnode);
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1486 account = purple_buddy_get_account(buddy);
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1487 if (purple_account_is_connected(account)) {
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1488 purple_account_remove_buddy(account, buddy, group);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1489 purple_blist_remove_buddy(buddy);
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1490 }
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1491 } else {
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1492 bnode = purple_blist_node_get_sibling_next(bnode);
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1493 }
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1494 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1495 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1496 PurpleChat *chat = (PurpleChat *)cnode;
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1497 cnode = purple_blist_node_get_sibling_next(cnode);
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
1498 if (purple_account_is_connected(purple_chat_get_account(chat)))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1499 purple_blist_remove_chat(chat);
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1500 } else {
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1501 cnode = purple_blist_node_get_sibling_next(cnode);
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1502 }
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1503 }
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1504
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1505 purple_blist_remove_group(group);
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1506 }
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1507
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1508 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1509 finch_blist_remove_node(PurpleBlistNode *node)
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1510 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1511 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1512 remove_contact((PurpleContact*)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1513 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1514 PurpleBuddy *buddy = (PurpleBuddy*)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1515 PurpleGroup *group = purple_buddy_get_group(buddy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1516 purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1517 purple_blist_remove_buddy(buddy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1518 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1519 purple_blist_remove_chat((PurpleChat*)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1520 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1521 remove_group((PurpleGroup*)node);
14125
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1522 }
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1523 }
2a14281b124b [gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14124
diff changeset
1524
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1525 static void
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1526 finch_blist_remove_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1527 {
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1528 PurpleAccount *account = NULL;
14260
a21577fbb4d2 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14194
diff changeset
1529 char *primary;
a21577fbb4d2 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14194
diff changeset
1530 const char *name, *sec = NULL;
14126
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1531
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1532 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1533 PurpleContact *c = (PurpleContact*)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1534 name = purple_contact_get_alias(c);
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1535 if (c->totalsize > 1)
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1536 sec = _("Removing this contact will also remove all the buddies in the contact");
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1537 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1538 name = purple_buddy_get_name((PurpleBuddy*)node);
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1539 account = purple_buddy_get_account((PurpleBuddy*)node);
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1540 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1541 name = purple_chat_get_name((PurpleChat*)node);
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1542 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
22342
916c989bd2c0 Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22341
diff changeset
1543 name = purple_group_get_name((PurpleGroup*)node);
14126
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1544 sec = _("Removing this group will also remove all the buddies in the group");
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1545 }
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1546 else
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1547 return;
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1548
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1549 primary = g_strdup_printf(_("Are you sure you want to remove %s?"), name);
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1550
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1551 /* XXX: anything to do with the returned ui-handle? */
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1552 purple_request_action(node, _("Confirm Remove"),
14126
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1553 primary, sec,
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1554 1,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
1555 account, name, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1556 node, 2,
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1557 _("Remove"), finch_blist_remove_node,
14126
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1558 _("Cancel"), NULL);
176d35315165 [gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14125
diff changeset
1559 g_free(primary);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1560 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1561
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1562 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1563 finch_blist_toggle_tag_buddy(PurpleBlistNode *node)
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1564 {
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1565 GList *iter;
15377
f45f57e922a7 [gaim-migrate @ 18106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15244
diff changeset
1566 if (node == NULL)
f45f57e922a7 [gaim-migrate @ 18106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15244
diff changeset
1567 return;
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1568 if (ggblist->tagged && (iter = g_list_find(ggblist->tagged, node)) != NULL) {
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1569 ggblist->tagged = g_list_delete_link(ggblist->tagged, iter);
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1570 } else {
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1571 ggblist->tagged = g_list_prepend(ggblist->tagged, node);
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1572 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1573 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
1574 update_buddy_display(purple_contact_get_priority_buddy(PURPLE_CONTACT(node)), ggblist);
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
1575 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1576 update_buddy_display((PurpleBuddy*)node, ggblist);
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1577 else
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1578 update_node_display(node, ggblist);
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1579 }
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1580
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1581 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1582 finch_blist_place_tagged(PurpleBlistNode *target)
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1583 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1584 PurpleGroup *tg = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1585 PurpleContact *tc = NULL;
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1586
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
1587 if (target == NULL ||
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
1588 purple_blist_node_get_type(target) == PURPLE_BLIST_OTHER_NODE)
15377
f45f57e922a7 [gaim-migrate @ 18106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15244
diff changeset
1589 return;
f45f57e922a7 [gaim-migrate @ 18106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15244
diff changeset
1590
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1591 if (PURPLE_BLIST_NODE_IS_GROUP(target))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1592 tg = (PurpleGroup*)target;
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1593 else if (PURPLE_BLIST_NODE_IS_BUDDY(target)) {
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1594 tc = (PurpleContact*)purple_blist_node_get_parent(target);
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1595 tg = (PurpleGroup*)purple_blist_node_get_parent((PurpleBlistNode*)tc);
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1596 } else {
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1597 if (PURPLE_BLIST_NODE_IS_CONTACT(target))
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1598 tc = (PurpleContact*)target;
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
1599 tg = (PurpleGroup*)purple_blist_node_get_parent(target);
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1600 }
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1601
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1602 if (ggblist->tagged) {
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1603 GList *list = ggblist->tagged;
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1604 ggblist->tagged = NULL;
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1605 while (list) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1606 PurpleBlistNode *node = list->data;
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1607 list = g_list_delete_link(list, list);
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1608
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1609 if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1610 update_node_display(node, ggblist);
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1611 /* Add the group after the current group */
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1612 purple_blist_add_group((PurpleGroup*)node, (PurpleBlistNode*)tg);
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1613 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1614 update_buddy_display(purple_contact_get_priority_buddy((PurpleContact*)node), ggblist);
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
1615 if (PURPLE_BLIST_NODE(tg) == target) {
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1616 /* The target is a group, just add the contact to the group. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1617 purple_blist_add_contact((PurpleContact*)node, tg, NULL);
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1618 } else if (tc) {
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1619 /* The target is either a buddy, or a contact. Merge with that contact. */
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1620 purple_blist_merge_contact((PurpleContact*)node, (PurpleBlistNode*)tc);
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1621 } else {
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1622 /* The target is a chat. Add the contact to the group after this chat. */
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1623 purple_blist_add_contact((PurpleContact*)node, NULL, target);
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1624 }
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1625 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1626 update_buddy_display((PurpleBuddy*)node, ggblist);
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
1627 if (PURPLE_BLIST_NODE(tg) == target) {
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1628 /* The target is a group. Add this buddy in a new contact under this group. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1629 purple_blist_add_buddy((PurpleBuddy*)node, NULL, tg, NULL);
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1630 } else if (PURPLE_BLIST_NODE_IS_CONTACT(target)) {
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1631 /* Add to the contact. */
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1632 purple_blist_add_buddy((PurpleBuddy*)node, tc, NULL, NULL);
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1633 } else if (PURPLE_BLIST_NODE_IS_BUDDY(target)) {
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1634 /* Add to the contact after the selected buddy. */
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1635 purple_blist_add_buddy((PurpleBuddy*)node, NULL, NULL, target);
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1636 } else if (PURPLE_BLIST_NODE_IS_CHAT(target)) {
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1637 /* Add to the selected chat's group. */
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1638 purple_blist_add_buddy((PurpleBuddy*)node, NULL, tg, NULL);
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1639 }
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1640 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1641 update_node_display(node, ggblist);
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
1642 if (PURPLE_BLIST_NODE(tg) == target)
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1643 purple_blist_add_chat((PurpleChat*)node, tg, NULL);
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1644 else
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1645 purple_blist_add_chat((PurpleChat*)node, NULL, target);
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1646 }
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1647 }
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1648 }
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1649 }
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1650
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1651 static void
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1652 context_menu_destroyed(GntWidget *widget, FinchBlist *ggblist)
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1653 {
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1654 ggblist->context = NULL;
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1655 }
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1656
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1657 static void
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1658 draw_context_menu(FinchBlist *ggblist)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1659 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1660 PurpleBlistNode *node = NULL;
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1661 GntWidget *context = NULL;
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1662 GntTree *tree = NULL;
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1663 int x, y, top, width;
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1664 char *title = NULL;
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1665
16869
f35dce8e5bc3 Do not build the context menu if one is already being shown.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16837
diff changeset
1666 if (ggblist->context)
f35dce8e5bc3 Do not build the context menu if one is already being shown.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16837
diff changeset
1667 return;
f35dce8e5bc3 Do not build the context menu if one is already being shown.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16837
diff changeset
1668
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1669 tree = GNT_TREE(ggblist->tree);
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1670
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1671 node = gnt_tree_get_selection_data(tree);
22286
c97b158bd4f4 Do not show a context menu for an unknown node.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22285
diff changeset
1672 if (node && purple_blist_node_get_type(node) == PURPLE_BLIST_OTHER_NODE)
c97b158bd4f4 Do not show a context menu for an unknown node.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22285
diff changeset
1673 return;
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1674
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1675 if (ggblist->tooltip)
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1676 remove_tooltip(ggblist);
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1677
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1678 ggblist->cnode = node;
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1679
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1680 ggblist->context = context = gnt_menu_new(GNT_MENU_POPUP);
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1681 g_signal_connect(G_OBJECT(context), "destroy", G_CALLBACK(context_menu_destroyed), ggblist);
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1682 g_signal_connect(G_OBJECT(context), "hide", G_CALLBACK(gnt_widget_destroy), NULL);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1683
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1684 if (!node) {
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1685 create_group_menu(GNT_MENU(context), NULL);
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1686 title = g_strdup(_("Buddy List"));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1687 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
1688 ggblist->cnode = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node)));
18831
ed4592c036ec Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18787
diff changeset
1689 create_buddy_menu(GNT_MENU(context), (PurpleBuddy*)ggblist->cnode);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1690 title = g_strdup(purple_contact_get_alias((PurpleContact*)node));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1691 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1692 PurpleBuddy *buddy = (PurpleBuddy *)node;
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1693 create_buddy_menu(GNT_MENU(context), buddy);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1694 title = g_strdup(purple_buddy_get_name(buddy));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1695 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1696 PurpleChat *chat = (PurpleChat*)node;
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1697 create_chat_menu(GNT_MENU(context), chat);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1698 title = g_strdup(purple_chat_get_name(chat));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1699 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1700 PurpleGroup *group = (PurpleGroup *)node;
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1701 create_group_menu(GNT_MENU(context), group);
22342
916c989bd2c0 Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22341
diff changeset
1702 title = g_strdup(purple_group_get_name(group));
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1703 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1704
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1705 append_extended_menu(GNT_MENU(context), node);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1706
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1707 /* These are common for everything */
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1708 if (node) {
16344
4f2b448b7559 Use 'alias' instead of 'rename' for non-group nodes. Thankfully, this does not introduce new strings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
1709 add_custom_action(GNT_MENU(context),
4f2b448b7559 Use 'alias' instead of 'rename' for non-group nodes. Thankfully, this does not introduce new strings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
1710 PURPLE_BLIST_NODE_IS_GROUP(node) ? _("Rename") : _("Alias"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1711 PURPLE_CALLBACK(finch_blist_rename_node_cb), node);
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1712 add_custom_action(GNT_MENU(context), _("Remove"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1713 PURPLE_CALLBACK(finch_blist_remove_node_cb), node);
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1714
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1715 if (ggblist->tagged && (PURPLE_BLIST_NODE_IS_CONTACT(node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1716 || PURPLE_BLIST_NODE_IS_GROUP(node))) {
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1717 add_custom_action(GNT_MENU(context), _("Place tagged"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1718 PURPLE_CALLBACK(finch_blist_place_tagged), node);
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1719 }
15564
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
1720
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1721 if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) {
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1722 add_custom_action(GNT_MENU(context), _("Toggle Tag"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1723 PURPLE_CALLBACK(finch_blist_toggle_tag_buddy), node);
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1724 }
22376
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1725 if (!PURPLE_BLIST_NODE_IS_GROUP(node)) {
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1726 add_custom_action(GNT_MENU(context), _("View Log"),
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1727 PURPLE_CALLBACK(showlog_cb), node);
25a17b6b69c2 Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents: 22342
diff changeset
1728 }
14756
bd7ebc1641e1 [gaim-migrate @ 17446]
Richard Nelson <wabz@pidgin.im>
parents: 14753
diff changeset
1729 }
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1730
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1731 /* Set the position for the popup */
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1732 gnt_widget_get_position(GNT_WIDGET(tree), &x, &y);
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1733 gnt_widget_get_size(GNT_WIDGET(tree), &width, NULL);
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1734 top = gnt_tree_get_selection_visible_line(tree);
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1735
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1736 x += width;
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1737 y += top - 1;
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1738
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1739 gnt_widget_set_position(context, x, y);
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1740 gnt_screen_menu_show(GNT_MENU(context));
14021
a633de85f90e [gaim-migrate @ 16511]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14020
diff changeset
1741 g_free(title);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1742 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1743
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1744 static void
18391
a51451368934 Show better tooltips for contacts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18369
diff changeset
1745 tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full)
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1746 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1747 PurplePlugin *prpl;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1748 PurplePluginProtocolInfo *prpl_info;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1749 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1750 PurpleNotifyUserInfo *user_info;
18614
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
1751 PurplePresence *presence;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1752 const char *alias = purple_buddy_get_alias(buddy);
15207
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 15113
diff changeset
1753 char *tmp, *strip;
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 15113
diff changeset
1754
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1755 user_info = purple_notify_user_info_new();
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1756
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1757 account = purple_buddy_get_account(buddy);
18614
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
1758 presence = purple_buddy_get_presence(buddy);
15113
956d8ac87bf6 [gaim-migrate @ 17835]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15083
diff changeset
1759
19425
07be487bc354 Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18909
diff changeset
1760 if (!full || g_utf8_collate(purple_buddy_get_name(buddy), alias)) {
07be487bc354 Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18909
diff changeset
1761 char *esc = g_markup_escape_text(alias, -1);
07be487bc354 Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18909
diff changeset
1762 purple_notify_user_info_add_pair(user_info, _("Nickname"), esc);
07be487bc354 Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18909
diff changeset
1763 g_free(esc);
07be487bc354 Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18909
diff changeset
1764 }
15207
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 15113
diff changeset
1765
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 15113
diff changeset
1766 tmp = g_strdup_printf("%s (%s)",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1767 purple_account_get_username(account),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1768 purple_account_get_protocol_name(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1769 purple_notify_user_info_add_pair(user_info, _("Account"), tmp);
15207
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 15113
diff changeset
1770 g_free(tmp);
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
1771
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1772 prpl = purple_find_prpl(purple_account_get_protocol_id(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1773 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1774 if (prpl_info && prpl_info->tooltip_text) {
18391
a51451368934 Show better tooltips for contacts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18369
diff changeset
1775 prpl_info->tooltip_text(buddy, user_info, full);
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1776 }
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1777
16478
19107605c565 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents: 16344
diff changeset
1778 if (purple_prefs_get_bool("/finch/blist/idletime")) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1779 PurplePresence *pre = purple_buddy_get_presence(buddy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1780 if (purple_presence_is_idle(pre)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1781 time_t idle = purple_presence_get_idle_time(pre);
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1782 if (idle > 0) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1783 char *st = purple_str_seconds_to_string(time(NULL) - idle);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1784 purple_notify_user_info_add_pair(user_info, _("Idle"), st);
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1785 g_free(st);
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1786 }
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1787 }
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1788 }
15207
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 15113
diff changeset
1789
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1790 tmp = purple_notify_user_info_get_text_with_newline(user_info, "<BR>");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1791 purple_notify_user_info_destroy(user_info);
15207
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 15113
diff changeset
1792
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1793 strip = purple_markup_strip_html(tmp);
15207
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 15113
diff changeset
1794 g_string_append(str, strip);
18614
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
1795
18909
ebc3cc277277 Insert a newline in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18852
diff changeset
1796 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE)) {
ebc3cc277277 Insert a newline in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18852
diff changeset
1797 g_string_append(str, "\n");
18614
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
1798 g_string_append(str, _("On Mobile"));
18909
ebc3cc277277 Insert a newline in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18852
diff changeset
1799 }
18614
186b07bbc7a3 Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18607
diff changeset
1800
15207
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 15113
diff changeset
1801 g_free(strip);
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 15113
diff changeset
1802 g_free(tmp);
14446
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1803 }
5f36f08183e8 [gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14441
diff changeset
1804
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1805 static GString*
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1806 make_sure_text_fits(GString *string)
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1807 {
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1808 int maxw = getmaxx(stdscr) - 3;
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1809 char *str = gnt_util_onscreen_fit_string(string->str, maxw);
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1810 string = g_string_assign(string, str);
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1811 g_free(str);
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1812 return string;
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1813 }
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1814
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1815 static gboolean
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1816 draw_tooltip_real(FinchBlist *ggblist)
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1817 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1818 PurpleBlistNode *node;
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1819 int x, y, top, width, w, h;
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
1820 GString *str = NULL;
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1821 GntTree *tree;
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1822 GntWidget *widget, *box, *tv;
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1823 char *title = NULL;
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1824
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1825 widget = ggblist->tree;
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1826 tree = GNT_TREE(widget);
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1827
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
1828 if (!gnt_widget_has_focus(ggblist->tree) ||
14981
2db0dea6fc9e [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14951
diff changeset
1829 (ggblist->context && !GNT_WIDGET_IS_FLAG_SET(ggblist->context, GNT_WIDGET_INVISIBLE)))
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1830 return FALSE;
13958
bd1c3bb3f33d [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13947
diff changeset
1831
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1832 if (ggblist->tooltip)
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1833 {
13931
a0a91e17f899 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13927
diff changeset
1834 /* XXX: Once we can properly redraw on expose events, this can be removed at the end
a0a91e17f899 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13927
diff changeset
1835 * to avoid the blinking*/
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1836 remove_tooltip(ggblist);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1837 }
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1838
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1839 node = gnt_tree_get_selection_data(tree);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1840 if (!node)
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1841 return FALSE;
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1842
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
1843 if (!ggblist->manager->create_tooltip(node, &str, &title))
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1844 return FALSE;
14489
99fb5724b4b1 [gaim-migrate @ 17137]
Richard Nelson <wabz@pidgin.im>
parents: 14469
diff changeset
1845
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1846 gnt_widget_get_position(widget, &x, &y);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1847 gnt_widget_get_size(widget, &width, NULL);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1848 top = gnt_tree_get_selection_visible_line(tree);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1849
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1850 x += width;
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1851 y += top - 1;
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1852
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1853 box = gnt_box_new(FALSE, FALSE);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1854 gnt_box_set_toplevel(GNT_BOX(box), TRUE);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1855 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_NO_SHADOW);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1856 gnt_box_set_title(GNT_BOX(box), title);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1857
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1858 str = make_sure_text_fits(str);
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1859 gnt_util_get_text_bound(str->str, &w, &h);
18369
5a713a62b959 Use the new flags to make the tooltip look better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
1860 h = MAX(1, h);
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1861 tv = gnt_text_view_new();
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1862 gnt_widget_set_size(tv, w + 1, h);
18369
5a713a62b959 Use the new flags to make the tooltip look better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
1863 gnt_text_view_set_flag(GNT_TEXT_VIEW(tv), GNT_TEXT_VIEW_NO_SCROLL);
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1864 gnt_box_add_widget(GNT_BOX(box), tv);
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1865
22579
a84da60f3748 Move the tooltip to the left of the buddylist if there's not enough room to show it on the right.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22556
diff changeset
1866 if (x + w >= getmaxx(stdscr))
a84da60f3748 Move the tooltip to the left of the buddylist if there's not enough room to show it on the right.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22556
diff changeset
1867 x -= w + width + 2;
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1868 gnt_widget_set_position(box, x, y);
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
1869 GNT_WIDGET_UNSET_FLAGS(box, GNT_WIDGET_CAN_TAKE_FOCUS);
14104
31fd1353462d [gaim-migrate @ 16648]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
1870 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_TRANSIENT);
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1871 gnt_widget_draw(box);
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1872
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1873 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(tv), str->str, GNT_TEXT_FLAG_NORMAL);
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1874 gnt_text_view_scroll(GNT_TEXT_VIEW(tv), 0);
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1875
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1876 g_free(title);
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1877 g_string_free(str, TRUE);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1878 ggblist->tooltip = box;
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1879 ggblist->tnode = node;
13931
a0a91e17f899 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13927
diff changeset
1880
a0a91e17f899 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13927
diff changeset
1881 gnt_widget_set_name(ggblist->tooltip, "tooltip");
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1882 return FALSE;
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1883 }
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1884
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1885 static void
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1886 draw_tooltip(FinchBlist *ggblist)
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1887 {
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1888 /* When an account has signed off, it removes one buddy at a time.
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1889 * Drawing the tooltip after removing each buddy is expensive. On
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1890 * top of that, if the selected buddy belongs to the disconnected
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1891 * account, then retreiving the tooltip for that causes crash. So
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1892 * let's make sure we wait for all the buddies to be removed first.*/
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1893 int id = g_timeout_add(0, (GSourceFunc)draw_tooltip_real, ggblist);
14997
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1894 g_object_set_data_full(G_OBJECT(ggblist->window), "draw_tooltip_calback",
197138c20527 [gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14981
diff changeset
1895 GINT_TO_POINTER(id), (GDestroyNotify)g_source_remove);
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1896 }
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1897
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1898 static void
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1899 selection_changed(GntWidget *widget, gpointer old, gpointer current, FinchBlist *ggblist)
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1900 {
16837
d3b8ba967fdc Fix context menu unusualness in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16828
diff changeset
1901 remove_peripherals(ggblist);
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1902 draw_tooltip(ggblist);
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1903 }
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1904
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1905 static gboolean
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1906 context_menu(GntWidget *widget, FinchBlist *ggblist)
14896
bcc0f594ed15 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14774
diff changeset
1907 {
bcc0f594ed15 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14774
diff changeset
1908 draw_context_menu(ggblist);
bcc0f594ed15 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14774
diff changeset
1909 return TRUE;
bcc0f594ed15 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14774
diff changeset
1910 }
bcc0f594ed15 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14774
diff changeset
1911
bcc0f594ed15 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14774
diff changeset
1912 static gboolean
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1913 key_pressed(GntWidget *widget, const char *text, FinchBlist *ggblist)
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1914 {
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1915 if (text[0] == 27 && text[1] == 0) {
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1916 /* Escape was pressed */
21472
7c77d4a1921d Cancel the typeahead search when escape is pressed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21233
diff changeset
1917 if (gnt_tree_is_searching(GNT_TREE(ggblist->tree)))
7c77d4a1921d Cancel the typeahead search when escape is pressed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21233
diff changeset
1918 gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "end-search", NULL);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1919 remove_peripherals(ggblist);
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1920 } else if (strcmp(text, GNT_KEY_CTRL_O) == 0) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1921 purple_prefs_set_bool(PREF_ROOT "/showoffline",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1922 !purple_prefs_get_bool(PREF_ROOT "/showoffline"));
20666
4521cf45c8e3 Pressing INSERT in the buddy list brings up the 'Add Buddy' dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20628
diff changeset
1923 } else if (strcmp(text, GNT_KEY_INS) == 0) {
4521cf45c8e3 Pressing INSERT in the buddy list brings up the 'Add Buddy' dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20628
diff changeset
1924 purple_blist_request_add_buddy(NULL, NULL, NULL, NULL);
18787
a96af97dc501 New feature: successful compilation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18765
diff changeset
1925 } else if (!gnt_tree_is_searching(GNT_TREE(ggblist->tree))) {
15222
7662507d2b35 [gaim-migrate @ 17946]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15207
diff changeset
1926 if (strcmp(text, "t") == 0) {
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1927 finch_blist_toggle_tag_buddy(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)));
15222
7662507d2b35 [gaim-migrate @ 17946]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15207
diff changeset
1928 gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "move-down");
7662507d2b35 [gaim-migrate @ 17946]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15207
diff changeset
1929 } else if (strcmp(text, "a") == 0) {
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1930 finch_blist_place_tagged(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)));
15228
b3a992ff3e5f [gaim-migrate @ 17952]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15222
diff changeset
1931 } else
b3a992ff3e5f [gaim-migrate @ 17952]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15222
diff changeset
1932 return FALSE;
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1933 } else
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1934 return FALSE;
13947
a77f6f615c20 [gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13946
diff changeset
1935
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1936 return TRUE;
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1937 }
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
1938
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1939 static void
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1940 update_node_display(PurpleBlistNode *node, FinchBlist *ggblist)
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1941 {
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
1942 GntTextFormatFlags flag = get_blist_node_flag(node);
16636
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1943 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), node, flag);
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1944 }
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1945
7f37767fa737 This makes it possible to rearrange chats and groups using the tag+attach system. Thanks a bunch to wabz for testing this. Fixes #379.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16555
diff changeset
1946 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1947 update_buddy_display(PurpleBuddy *buddy, FinchBlist *ggblist)
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1948 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1949 PurpleContact *contact;
21808
2684d3deb32e Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21807
diff changeset
1950
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1951 contact = purple_buddy_get_contact(buddy);
14447
32f854416012 [gaim-migrate @ 17091]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14446
diff changeset
1952
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1953 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((PurpleBlistNode*)buddy));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1954 gnt_tree_change_text(GNT_TREE(ggblist->tree), contact, 0, get_display_name((PurpleBlistNode*)contact));
14447
32f854416012 [gaim-migrate @ 17091]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14446
diff changeset
1955
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
1956 blist_update_row_flags((PurpleBlistNode *)buddy);
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
1957 if (buddy == purple_contact_get_priority_buddy(contact))
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
1958 blist_update_row_flags((PurpleBlistNode *)contact);
15039
20a0d0117a47 [gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14997
diff changeset
1959
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1960 if (ggblist->tnode == (PurpleBlistNode*)buddy)
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1961 draw_tooltip(ggblist);
13993
8c12e7d15b40 [gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13989
diff changeset
1962 }
8c12e7d15b40 [gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13989
diff changeset
1963
8c12e7d15b40 [gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13989
diff changeset
1964 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1965 buddy_status_changed(PurpleBuddy *buddy, PurpleStatus *old, PurpleStatus *now, FinchBlist *ggblist)
13993
8c12e7d15b40 [gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13989
diff changeset
1966 {
8c12e7d15b40 [gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13989
diff changeset
1967 update_buddy_display(buddy, ggblist);
8c12e7d15b40 [gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13989
diff changeset
1968 }
8c12e7d15b40 [gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13989
diff changeset
1969
8c12e7d15b40 [gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13989
diff changeset
1970 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1971 buddy_idle_changed(PurpleBuddy *buddy, int old, int new, FinchBlist *ggblist)
13993
8c12e7d15b40 [gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13989
diff changeset
1972 {
8c12e7d15b40 [gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13989
diff changeset
1973 update_buddy_display(buddy, ggblist);
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1974 }
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
1975
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1976 static void
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
1977 remove_peripherals(FinchBlist *ggblist)
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1978 {
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1979 if (ggblist->tooltip)
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1980 remove_tooltip(ggblist);
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1981 else if (ggblist->context)
14905
23f31a7acc73 [gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14896
diff changeset
1982 gnt_widget_destroy(ggblist->context);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1983 }
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
1984
14072
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
1985 static void
14908
0ccb73d4e584 [gaim-migrate @ 17615]
Richard Nelson <wabz@pidgin.im>
parents: 14905
diff changeset
1986 size_changed_cb(GntWidget *w, int wi, int h)
14072
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
1987 {
14908
0ccb73d4e584 [gaim-migrate @ 17615]
Richard Nelson <wabz@pidgin.im>
parents: 14905
diff changeset
1988 int width, height;
0ccb73d4e584 [gaim-migrate @ 17615]
Richard Nelson <wabz@pidgin.im>
parents: 14905
diff changeset
1989 gnt_widget_get_size(w, &width, &height);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1990 purple_prefs_set_int(PREF_ROOT "/size/width", width);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1991 purple_prefs_set_int(PREF_ROOT "/size/height", height);
14072
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
1992 }
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
1993
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
1994 static void
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
1995 save_position_cb(GntWidget *w, int x, int y)
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
1996 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1997 purple_prefs_set_int(PREF_ROOT "/position/x", x);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
1998 purple_prefs_set_int(PREF_ROOT "/position/y", y);
14072
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
1999 }
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
2000
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2001 static void
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2002 reset_blist_window(GntWidget *window, gpointer null)
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2003 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2004 PurpleBlistNode *node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2005 purple_signals_disconnect_by_handle(finch_blist_get_handle());
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
2006 FINCH_SET_DATA(purple_get_blist(), NULL);
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2007
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2008 node = purple_blist_get_root();
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2009 while (node) {
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2010 reset_blist_node_ui_data(node);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2011 node = purple_blist_node_next(node, TRUE);
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2012 }
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2013
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
2014 if (ggblist->typing)
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
2015 g_source_remove(ggblist->typing);
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2016 remove_peripherals(ggblist);
15046
e17788e5403a [gaim-migrate @ 17763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15039
diff changeset
2017 if (ggblist->tagged)
e17788e5403a [gaim-migrate @ 17763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15039
diff changeset
2018 g_list_free(ggblist->tagged);
24450
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
2019
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
2020 if (ggblist->new_group_timeout)
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
2021 purple_timeout_remove(ggblist->new_group_timeout);
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
2022 if (ggblist->new_group)
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
2023 g_list_free(ggblist->new_group);
b41b4278c53a Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24198
diff changeset
2024
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2025 g_free(ggblist);
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2026 ggblist = NULL;
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2027 }
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2028
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2029 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21855
diff changeset
2030 populate_buddylist(void)
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2031 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2032 PurpleBlistNode *node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2033 PurpleBuddyList *list;
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2034
22312
dae4ed366fcb Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22303
diff changeset
2035 if (ggblist->manager->init)
dae4ed366fcb Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22303
diff changeset
2036 ggblist->manager->init();
dae4ed366fcb Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22303
diff changeset
2037
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2038 if (strcmp(purple_prefs_get_string(PREF_ROOT "/sort_type"), "text") == 0) {
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2039 gnt_tree_set_compare_func(GNT_TREE(ggblist->tree),
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2040 (GCompareFunc)blist_node_compare_text);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2041 } else if (strcmp(purple_prefs_get_string(PREF_ROOT "/sort_type"), "status") == 0) {
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2042 gnt_tree_set_compare_func(GNT_TREE(ggblist->tree),
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2043 (GCompareFunc)blist_node_compare_status);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2044 } else if (strcmp(purple_prefs_get_string(PREF_ROOT "/sort_type"), "log") == 0) {
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2045 gnt_tree_set_compare_func(GNT_TREE(ggblist->tree),
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2046 (GCompareFunc)blist_node_compare_log);
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2047 }
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2048
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2049 list = purple_get_blist();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2050 node = purple_blist_get_root();
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2051 while (node)
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2052 {
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2053 node_update(list, node);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2054 node = purple_blist_node_next(node, FALSE);
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2055 }
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2056 }
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2057
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2058 static void
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2059 destroy_status_list(GList *list)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2060 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2061 g_list_foreach(list, (GFunc)g_free, NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2062 g_list_free(list);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2063 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2064
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2065 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21855
diff changeset
2066 populate_status_dropdown(void)
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2067 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2068 int i;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2069 GList *iter;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2070 GList *items = NULL;
14188
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2071 StatusBoxItem *item = NULL;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2072
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2073 /* First the primitives */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2074 PurpleStatusPrimitive prims[] = {PURPLE_STATUS_AVAILABLE, PURPLE_STATUS_AWAY,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2075 PURPLE_STATUS_INVISIBLE, PURPLE_STATUS_OFFLINE, PURPLE_STATUS_UNSET};
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2076
14555
0d6ef581e3ac [gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14539
diff changeset
2077 gnt_combo_box_remove_all(GNT_COMBO_BOX(ggblist->status));
0d6ef581e3ac [gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14539
diff changeset
2078
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2079 for (i = 0; prims[i] != PURPLE_STATUS_UNSET; i++)
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2080 {
14188
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2081 item = g_new0(StatusBoxItem, 1);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2082 item->type = STATUS_PRIMITIVE;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2083 item->u.prim = prims[i];
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2084 items = g_list_prepend(items, item);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2085 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2086 purple_primitive_get_name_from_type(prims[i]));
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2087 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2088
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2089 /* Now the popular statuses */
18851
87634d109f57 Memory leak fix.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18850
diff changeset
2090 for (iter = purple_savedstatuses_get_popular(6); iter; iter = g_list_delete_link(iter, iter))
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2091 {
14188
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2092 item = g_new0(StatusBoxItem, 1);
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2093 item->type = STATUS_SAVED_POPULAR;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2094 item->u.saved = iter->data;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2095 items = g_list_prepend(items, item);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2096 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2097 purple_savedstatus_get_title(iter->data));
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2098 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2099
14194
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2100 /* New savedstatus */
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2101 item = g_new0(StatusBoxItem, 1);
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2102 item->type = STATUS_SAVED_NEW;
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2103 items = g_list_prepend(items, item);
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2104 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item,
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2105 _("New..."));
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2106
14188
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2107 /* More savedstatuses */
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2108 item = g_new0(StatusBoxItem, 1);
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2109 item->type = STATUS_SAVED_ALL;
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2110 items = g_list_prepend(items, item);
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2111 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item,
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2112 _("Saved..."));
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2113
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2114 /* The keys for the combobox are created here, and never used
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2115 * anywhere else. So make sure the keys are freed when the widget
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2116 * is destroyed. */
14188
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2117 g_object_set_data_full(G_OBJECT(ggblist->status), "list of statuses",
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2118 items, (GDestroyNotify)destroy_status_list);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2119 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2120
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2121 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2122 redraw_blist(const char *name, PurplePrefType type, gconstpointer val, gpointer data)
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2123 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2124 PurpleBlistNode *node, *sel;
22300
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2125 FinchBlistManager *manager;
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2126
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2127 if (ggblist == NULL)
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2128 return;
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2129
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2130 manager = finch_blist_manager_find(purple_prefs_get_string(PREF_ROOT "/grouping"));
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2131 if (manager == NULL)
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2132 manager = &default_manager;
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2133 if (ggblist->manager != manager) {
22312
dae4ed366fcb Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22303
diff changeset
2134 if (ggblist->manager->uninit)
dae4ed366fcb Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22303
diff changeset
2135 ggblist->manager->uninit();
dae4ed366fcb Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22303
diff changeset
2136
22300
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2137 ggblist->manager = manager;
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2138 if (manager->can_add_node == NULL)
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2139 manager->can_add_node = default_can_add_node;
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2140 if (manager->find_parent == NULL)
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2141 manager->find_parent = default_find_parent;
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2142 if (manager->create_tooltip == NULL)
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2143 manager->create_tooltip = default_create_tooltip;
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2144 }
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2145
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2146 if (ggblist->window == NULL)
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2147 return;
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2148
14531
4beceb49b547 [gaim-migrate @ 17185]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14489
diff changeset
2149 sel = gnt_tree_get_selection_data(GNT_TREE(ggblist->tree));
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2150 gnt_tree_remove_all(GNT_TREE(ggblist->tree));
22312
dae4ed366fcb Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22303
diff changeset
2151
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2152 node = purple_blist_get_root();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2153 for (; node; node = purple_blist_node_next(node, TRUE))
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2154 reset_blist_node_ui_data(node);
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2155 populate_buddylist();
14531
4beceb49b547 [gaim-migrate @ 17185]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14489
diff changeset
2156 gnt_tree_set_selected(GNT_TREE(ggblist->tree), sel);
4beceb49b547 [gaim-migrate @ 17185]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14489
diff changeset
2157 draw_tooltip(ggblist);
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2158 }
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2159
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
2160 void finch_blist_init()
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
2161 {
21855
fc93ce6595e4 Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents: 21808
diff changeset
2162 color_available = gnt_style_get_color(NULL, "color-available");
21807
3d64cf4a1601 Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21804
diff changeset
2163 if (!color_available)
3d64cf4a1601 Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21804
diff changeset
2164 color_available = gnt_color_add_pair(COLOR_GREEN, -1);
21855
fc93ce6595e4 Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents: 21808
diff changeset
2165 color_away = gnt_style_get_color(NULL, "color-away");
21807
3d64cf4a1601 Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21804
diff changeset
2166 if (!color_away)
3d64cf4a1601 Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21804
diff changeset
2167 color_away = gnt_color_add_pair(COLOR_BLUE, -1);
21855
fc93ce6595e4 Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents: 21808
diff changeset
2168 color_idle = gnt_style_get_color(NULL, "color-idle");
21807
3d64cf4a1601 Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21804
diff changeset
2169 if (!color_idle)
3d64cf4a1601 Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21804
diff changeset
2170 color_idle = gnt_color_add_pair(COLOR_CYAN, -1);
21855
fc93ce6595e4 Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents: 21808
diff changeset
2171 color_offline = gnt_style_get_color(NULL, "color-offline");
21807
3d64cf4a1601 Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21804
diff changeset
2172 if (!color_offline)
3d64cf4a1601 Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21804
diff changeset
2173 color_offline = gnt_color_add_pair(COLOR_RED, -1);
3d64cf4a1601 Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21804
diff changeset
2174
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2175 purple_prefs_add_none(PREF_ROOT);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2176 purple_prefs_add_none(PREF_ROOT "/size");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2177 purple_prefs_add_int(PREF_ROOT "/size/width", 20);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2178 purple_prefs_add_int(PREF_ROOT "/size/height", 17);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2179 purple_prefs_add_none(PREF_ROOT "/position");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2180 purple_prefs_add_int(PREF_ROOT "/position/x", 0);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2181 purple_prefs_add_int(PREF_ROOT "/position/y", 0);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2182 purple_prefs_add_bool(PREF_ROOT "/idletime", TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2183 purple_prefs_add_bool(PREF_ROOT "/showoffline", FALSE);
18625
775baeaa9f1a Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18614
diff changeset
2184 purple_prefs_add_bool(PREF_ROOT "/emptygroups", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2185 purple_prefs_add_string(PREF_ROOT "/sort_type", "text");
22300
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2186 purple_prefs_add_string(PREF_ROOT "/grouping", "default");
14072
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
2187
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2188 purple_prefs_connect_callback(finch_blist_get_handle(),
18625
775baeaa9f1a Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18614
diff changeset
2189 PREF_ROOT "/emptygroups", redraw_blist, NULL);
775baeaa9f1a Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18614
diff changeset
2190 purple_prefs_connect_callback(finch_blist_get_handle(),
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2191 PREF_ROOT "/showoffline", redraw_blist, NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2192 purple_prefs_connect_callback(finch_blist_get_handle(),
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2193 PREF_ROOT "/sort_type", redraw_blist, NULL);
22300
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2194 purple_prefs_connect_callback(finch_blist_get_handle(),
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2195 PREF_ROOT "/grouping", redraw_blist, NULL);
14461
ed494fb68279 [gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14458
diff changeset
2196
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2197 purple_signal_connect(purple_connections_get_handle(), "signed-on", purple_blist_get_handle(),
15242
4f4b5d66f9af [gaim-migrate @ 17967]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15241
diff changeset
2198 G_CALLBACK(account_signed_on_cb), NULL);
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
2199
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
2200 finch_blist_install_manager(&default_manager);
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
2201
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2202 return;
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2203 }
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
2204
14109
1af2b9d5ef3f [gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14104
diff changeset
2205 static gboolean
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2206 remove_typing_cb(gpointer null)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2207 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2208 PurpleSavedStatus *current;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2209 const char *message, *newmessage;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2210 PurpleStatusPrimitive prim, newprim;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2211 StatusBoxItem *item;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2212
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2213 current = purple_savedstatus_get_current();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2214 message = purple_savedstatus_get_message(current);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2215 prim = purple_savedstatus_get_type(current);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2216
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2217 newmessage = gnt_entry_get_text(GNT_ENTRY(ggblist->statustext));
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2218 item = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(ggblist->status));
16719
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2219
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2220 switch (item->type) {
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2221 case STATUS_PRIMITIVE:
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2222 newprim = item->u.prim;
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2223 break;
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2224 case STATUS_SAVED_POPULAR:
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2225 newprim = purple_savedstatus_get_type(item->u.saved);
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2226 break;
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2227 default:
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2228 goto end; /* 'New' or 'Saved' is selected, but this should never happen. */
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2229 }
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2230
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2231 if (newprim != prim || ((message && !newmessage) ||
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2232 (!message && newmessage) ||
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2233 (message && newmessage && g_utf8_collate(message, newmessage) != 0)))
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2234 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2235 PurpleSavedStatus *status = purple_savedstatus_find_transient_by_type_and_message(newprim, newmessage);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2236 /* Holy Crap! That's a LAWNG function name */
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2237 if (status == NULL)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2238 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2239 status = purple_savedstatus_new(NULL, newprim);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2240 purple_savedstatus_set_message(status, newmessage);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2241 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2242
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2243 purple_savedstatus_activate(status);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2244 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2245
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2246 gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree);
16719
b54dafede4bd A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16636
diff changeset
2247 end:
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14109
diff changeset
2248 if (ggblist->typing)
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14109
diff changeset
2249 g_source_remove(ggblist->typing);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2250 ggblist->typing = 0;
14109
1af2b9d5ef3f [gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14104
diff changeset
2251 return FALSE;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2252 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2253
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2254 static void
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2255 status_selection_changed(GntComboBox *box, StatusBoxItem *old, StatusBoxItem *now, gpointer null)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2256 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2257 gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), NULL);
14188
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2258 if (now->type == STATUS_SAVED_POPULAR)
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2259 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2260 /* Set the status immediately */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2261 purple_savedstatus_activate(now->u.saved);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2262 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2263 else if (now->type == STATUS_PRIMITIVE)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2264 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2265 /* Move the focus to the entry box */
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14109
diff changeset
2266 /* XXX: Make sure the selected status can have a message */
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2267 gnt_box_move_focus(GNT_BOX(ggblist->window), 1);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2268 ggblist->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2269 }
14188
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2270 else if (now->type == STATUS_SAVED_ALL)
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2271 {
14193
fcfd3eea2160 [gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14188
diff changeset
2272 /* Restore the selection to reflect current status. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2273 savedstatus_changed(purple_savedstatus_get_current(), NULL);
14193
fcfd3eea2160 [gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14188
diff changeset
2274 gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree);
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
2275 finch_savedstatus_show_all();
14188
cff503f91616 [gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
2276 }
14194
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2277 else if (now->type == STATUS_SAVED_NEW)
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2278 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2279 savedstatus_changed(purple_savedstatus_get_current(), NULL);
14194
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2280 gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree);
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
2281 finch_savedstatus_edit(NULL);
14194
b371a53b1695 [gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14193
diff changeset
2282 }
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2283 else
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2284 g_return_if_reached();
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2285 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2286
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2287 static gboolean
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2288 status_text_changed(GntEntry *entry, const char *text, gpointer null)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2289 {
14109
1af2b9d5ef3f [gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14104
diff changeset
2290 if ((text[0] == 27 || (text[0] == '\t' && text[1] == '\0')) && ggblist->typing == 0)
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2291 return FALSE;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2292
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14109
diff changeset
2293 if (ggblist->typing)
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14109
diff changeset
2294 g_source_remove(ggblist->typing);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2295 ggblist->typing = 0;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2296
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2297 if (text[0] == '\r' && text[1] == 0)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2298 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2299 /* Set the status only after you press 'Enter' */
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2300 remove_typing_cb(NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2301 return TRUE;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2302 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2303
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2304 ggblist->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2305 return FALSE;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2306 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2307
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2308 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2309 savedstatus_changed(PurpleSavedStatus *now, PurpleSavedStatus *old)
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2310 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2311 GList *list;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2312 PurpleStatusPrimitive prim;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2313 const char *message;
15564
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2314 gboolean found = FALSE, saved = TRUE;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2315
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2316 if (!ggblist)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2317 return;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2318
14555
0d6ef581e3ac [gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14539
diff changeset
2319 /* Block the signals we don't want to emit */
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2320 g_signal_handlers_block_matched(ggblist->status, G_SIGNAL_MATCH_FUNC,
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2321 0, 0, NULL, status_selection_changed, NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2322 g_signal_handlers_block_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC,
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2323 0, 0, NULL, status_text_changed, NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2324
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2325 prim = purple_savedstatus_get_type(now);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2326 message = purple_savedstatus_get_message(now);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2327
14555
0d6ef581e3ac [gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14539
diff changeset
2328 /* Rebuild the status dropdown */
0d6ef581e3ac [gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14539
diff changeset
2329 populate_status_dropdown();
0d6ef581e3ac [gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14539
diff changeset
2330
15564
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2331 while (!found) {
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2332 list = g_object_get_data(G_OBJECT(ggblist->status), "list of statuses");
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2333 for (; list; list = list->next)
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2334 {
15564
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2335 StatusBoxItem *item = list->data;
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2336 if ((saved && item->type != STATUS_PRIMITIVE && item->u.saved == now) ||
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2337 (!saved && item->type == STATUS_PRIMITIVE && item->u.prim == prim))
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2338 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2339 char *mess = purple_unescape_html(message);
15564
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2340 gnt_combo_box_set_selected(GNT_COMBO_BOX(ggblist->status), item);
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2341 gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), mess);
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2342 gnt_widget_draw(ggblist->status);
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2343 g_free(mess);
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2344 found = TRUE;
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2345 break;
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2346 }
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2347 }
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2348 if (!saved)
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2349 break;
15564
61befe113a13 Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15377
diff changeset
2350 saved = FALSE;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2351 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2352
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2353 g_signal_handlers_unblock_matched(ggblist->status, G_SIGNAL_MATCH_FUNC,
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2354 0, 0, NULL, status_selection_changed, NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2355 g_signal_handlers_unblock_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC,
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2356 0, 0, NULL, status_text_changed, NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2357 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
2358
14167
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2359 static int
16555
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2360 blist_node_compare_position(PurpleBlistNode *n1, PurpleBlistNode *n2)
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2361 {
22334
6eec04817c0d Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22314
diff changeset
2362 while ((n1 = purple_blist_node_get_sibling_prev(n1)) != NULL)
16555
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2363 if (n1 == n2)
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2364 return 1;
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2365 return -1;
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2366 }
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2367
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2368 static int
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2369 blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2)
14167
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2370 {
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2371 const char *s1, *s2;
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2372 char *us1, *us2;
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2373 int ret;
17333
dfb8dfb6ede0 It's valid for different types to be compared. In that case, use existing positions.
Richard Nelson <wabz@pidgin.im>
parents: 17295
diff changeset
2374
22334
6eec04817c0d Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22314
diff changeset
2375 if (purple_blist_node_get_type(n1) != purple_blist_node_get_type(n2))
17333
dfb8dfb6ede0 It's valid for different types to be compared. In that case, use existing positions.
Richard Nelson <wabz@pidgin.im>
parents: 17295
diff changeset
2376 return blist_node_compare_position(n1, n2);
dfb8dfb6ede0 It's valid for different types to be compared. In that case, use existing positions.
Richard Nelson <wabz@pidgin.im>
parents: 17295
diff changeset
2377
22334
6eec04817c0d Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22314
diff changeset
2378 switch (purple_blist_node_get_type(n1))
14167
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2379 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2380 case PURPLE_BLIST_CHAT_NODE:
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2381 s1 = purple_chat_get_name((PurpleChat*)n1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2382 s2 = purple_chat_get_name((PurpleChat*)n2);
14167
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2383 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2384 case PURPLE_BLIST_BUDDY_NODE:
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2385 return purple_presence_compare(purple_buddy_get_presence((PurpleBuddy*)n1),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2386 purple_buddy_get_presence((PurpleBuddy*)n2));
14447
32f854416012 [gaim-migrate @ 17091]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14446
diff changeset
2387 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2388 case PURPLE_BLIST_CONTACT_NODE:
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2389 s1 = purple_contact_get_alias((PurpleContact*)n1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2390 s2 = purple_contact_get_alias((PurpleContact*)n2);
14167
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2391 break;
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2392 default:
16555
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2393 return blist_node_compare_position(n1, n2);
14167
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2394 }
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2395
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2396 us1 = g_utf8_strup(s1, -1);
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2397 us2 = g_utf8_strup(s2, -1);
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2398 ret = g_utf8_collate(us1, us2);
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2399 g_free(us1);
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2400 g_free(us2);
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2401
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2402 return ret;
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2403 }
ca6027c33d2c [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14127
diff changeset
2404
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2405 static int
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2406 blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2)
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2407 {
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2408 int ret;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2409
22334
6eec04817c0d Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22314
diff changeset
2410 if (purple_blist_node_get_type(n1) != purple_blist_node_get_type(n2))
17333
dfb8dfb6ede0 It's valid for different types to be compared. In that case, use existing positions.
Richard Nelson <wabz@pidgin.im>
parents: 17295
diff changeset
2411 return blist_node_compare_position(n1, n2);
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2412
22334
6eec04817c0d Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22314
diff changeset
2413 switch (purple_blist_node_get_type(n1)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2414 case PURPLE_BLIST_CONTACT_NODE:
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
2415 n1 = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(n1)));
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24951
diff changeset
2416 n2 = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(n2)));
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2417 /* now compare the presence of the priority buddies */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2418 case PURPLE_BLIST_BUDDY_NODE:
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2419 ret = purple_presence_compare(purple_buddy_get_presence((PurpleBuddy*)n1),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2420 purple_buddy_get_presence((PurpleBuddy*)n2));
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2421 if (ret != 0)
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2422 return ret;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2423 break;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2424 default:
16555
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2425 return blist_node_compare_position(n1, n2);
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2426 break;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2427 }
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2428
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2429 /* Sort alphabetically if presence is not comparable */
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2430 ret = blist_node_compare_text(n1, n2);
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2431
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2432 return ret;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2433 }
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2434
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2435 static int
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2436 get_contact_log_size(PurpleBlistNode *c)
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2437 {
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2438 int log = 0;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2439 PurpleBlistNode *node;
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2440
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
2441 for (node = purple_blist_node_get_first_child(c); node; node = purple_blist_node_get_sibling_next(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2442 PurpleBuddy *b = (PurpleBuddy*)node;
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
2443 log += purple_log_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b),
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
2444 purple_buddy_get_account(b));
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2445 }
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2446
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2447 return log;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2448 }
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2449
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2450 static int
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2451 blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2)
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2452 {
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2453 int ret;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2454 PurpleBuddy *b1, *b2;
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2455
22334
6eec04817c0d Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22314
diff changeset
2456 if (purple_blist_node_get_type(n1) != purple_blist_node_get_type(n2))
17333
dfb8dfb6ede0 It's valid for different types to be compared. In that case, use existing positions.
Richard Nelson <wabz@pidgin.im>
parents: 17295
diff changeset
2457 return blist_node_compare_position(n1, n2);
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2458
22334
6eec04817c0d Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22314
diff changeset
2459 switch (purple_blist_node_get_type(n1)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2460 case PURPLE_BLIST_BUDDY_NODE:
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2461 b1 = (PurpleBuddy*)n1;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2462 b2 = (PurpleBuddy*)n2;
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
2463 ret = purple_log_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b2), purple_buddy_get_account(b2)) -
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
2464 purple_log_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b1), purple_buddy_get_account(b1));
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2465 if (ret != 0)
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2466 return ret;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2467 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2468 case PURPLE_BLIST_CONTACT_NODE:
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2469 ret = get_contact_log_size(n2) - get_contact_log_size(n1);
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2470 if (ret != 0)
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2471 return ret;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2472 break;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2473 default:
16555
9f8c3a97fb35 Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16490
diff changeset
2474 return blist_node_compare_position(n1, n2);
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2475 }
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2476 ret = blist_node_compare_text(n1, n2);
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2477 return ret;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2478 }
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2479
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2480 static void
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2481 plugin_action(GntMenuItem *item, gpointer data)
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2482 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2483 PurplePluginAction *action = data;
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2484 if (action && action->callback)
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2485 action->callback(action);
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2486 }
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2487
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2488 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2489 build_plugin_actions(GntMenuItem *item, PurplePlugin *plugin, gpointer context)
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2490 {
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2491 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP);
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2492 GList *actions;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2493 GntMenuItem *menuitem;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2494
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2495 gnt_menuitem_set_submenu(item, GNT_MENU(sub));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2496 for (actions = PURPLE_PLUGIN_ACTIONS(plugin, context); actions;
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2497 actions = g_list_delete_link(actions, actions)) {
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2498 if (actions->data) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2499 PurplePluginAction *action = actions->data;
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2500 action->plugin = plugin;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2501 action->context = context;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2502 menuitem = gnt_menuitem_new(action->label);
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2503 gnt_menu_add_item(GNT_MENU(sub), menuitem);
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2504
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2505 gnt_menuitem_set_callback(menuitem, plugin_action, action);
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2506 g_object_set_data_full(G_OBJECT(menuitem), "plugin_action",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2507 action, (GDestroyNotify)purple_plugin_action_free);
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2508 }
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2509 }
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2510 }
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2511
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2512 static gboolean
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2513 buddy_recent_signed_on_off(gpointer data)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2514 {
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2515 PurpleBlistNode *node = data;
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
2516 FinchBlistNode *fnode = FINCH_GET_DATA(node);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2517
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2518 purple_timeout_remove(fnode->signed_timer);
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2519 fnode->signed_timer = 0;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2520
22303
cab9f3452d72 Rework some of the code that deals with adding and removing blist nodes in the tree. There were some typoed code that just happened to work. This fixes those.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22300
diff changeset
2521 if (!ggblist->manager->can_add_node(node)) {
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2522 node_remove(purple_get_blist(), node);
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2523 } else {
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2524 update_node_display(node, ggblist);
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
2525 if (purple_blist_node_get_parent(node) && PURPLE_BLIST_NODE_IS_CONTACT(purple_blist_node_get_parent(node)))
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
2526 update_node_display(purple_blist_node_get_parent(node), ggblist);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2527 }
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2528
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2529 return FALSE;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2530 }
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2531
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2532 static gboolean
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2533 buddy_signed_on_off_cb(gpointer data)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2534 {
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2535 PurpleBlistNode *node = data;
22339
f68309ed6c0a We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22336
diff changeset
2536 FinchBlistNode *fnode = FINCH_GET_DATA(node);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2537 if (!ggblist || !fnode)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2538 return FALSE;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2539
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2540 if (fnode->signed_timer)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2541 purple_timeout_remove(fnode->signed_timer);
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2542 fnode->signed_timer = purple_timeout_add_seconds(6, (GSourceFunc)buddy_recent_signed_on_off, data);
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2543 update_node_display(node, ggblist);
22282
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
2544 if (purple_blist_node_get_parent(node) && PURPLE_BLIST_NODE_IS_CONTACT(purple_blist_node_get_parent(node)))
a964668bd7e4 Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22140
diff changeset
2545 update_node_display(purple_blist_node_get_parent(node), ggblist);
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2546 return FALSE;
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2547 }
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2548
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2549 static void
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2550 buddy_signed_on_off(PurpleBuddy* buddy, gpointer null)
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2551 {
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2552 g_idle_add(buddy_signed_on_off_cb, buddy);
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2553 }
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
2554
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2555 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21855
diff changeset
2556 reconstruct_plugins_menu(void)
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2557 {
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2558 GntWidget *sub;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2559 GntMenuItem *plg;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2560 GList *iter;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2561
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2562 if (!ggblist)
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2563 return;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2564
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2565 if (ggblist->plugins == NULL)
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2566 ggblist->plugins = gnt_menuitem_new(_("Plugins"));
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2567
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2568 plg = ggblist->plugins;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2569 sub = gnt_menu_new(GNT_MENU_POPUP);
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2570 gnt_menuitem_set_submenu(plg, GNT_MENU(sub));
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2571
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2572 for (iter = purple_plugins_get_loaded(); iter; iter = iter->next) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2573 PurplePlugin *plugin = iter->data;
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2574 GntMenuItem *item;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2575 if (PURPLE_IS_PROTOCOL_PLUGIN(plugin))
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2576 continue;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2577
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2578 if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin))
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2579 continue;
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2580
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2581 item = gnt_menuitem_new(_(plugin->info->name));
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2582 gnt_menu_add_item(GNT_MENU(sub), item);
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2583 build_plugin_actions(item, plugin, NULL);
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2584 }
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2585 }
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2586
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2587 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21855
diff changeset
2588 reconstruct_accounts_menu(void)
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2589 {
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2590 GntWidget *sub;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2591 GntMenuItem *acc, *item;
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2592 GList *iter;
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2593
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2594 if (!ggblist)
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2595 return;
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2596
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2597 if (ggblist->accounts == NULL)
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2598 ggblist->accounts = gnt_menuitem_new(_("Accounts"));
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2599
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2600 acc = ggblist->accounts;
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2601 sub = gnt_menu_new(GNT_MENU_POPUP);
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2602 gnt_menuitem_set_submenu(acc, GNT_MENU(sub));
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2603
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2604 for (iter = purple_accounts_get_all_active(); iter;
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2605 iter = g_list_delete_link(iter, iter)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2606 PurpleAccount *account = iter->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2607 PurpleConnection *gc = purple_account_get_connection(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2608 PurplePlugin *prpl;
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2609
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2610 if (!gc || !PURPLE_CONNECTION_IS_CONNECTED(gc))
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2611 continue;
22336
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
2612 prpl = purple_connection_get_prpl(gc);
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2613
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2614 if (PURPLE_PLUGIN_HAS_ACTIONS(prpl)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2615 item = gnt_menuitem_new(purple_account_get_username(account));
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2616 gnt_menu_add_item(GNT_MENU(sub), item);
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2617 build_plugin_actions(item, prpl, gc);
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2618 }
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
2619 }
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2620 }
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2621
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2622 static void
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2623 reconstruct_grouping_menu(void)
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2624 {
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2625 GList *iter;
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2626 GntWidget *subsub;
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2627
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2628 if (!ggblist || !ggblist->grouping)
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2629 return;
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2630
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2631 subsub = gnt_menu_new(GNT_MENU_POPUP);
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2632 gnt_menuitem_set_submenu(ggblist->grouping, GNT_MENU(subsub));
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2633
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2634 for (iter = managers; iter; iter = iter->next) {
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2635 char menuid[128];
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2636 FinchBlistManager *manager = iter->data;
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2637 GntMenuItem *item = gnt_menuitem_new(_(manager->name));
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2638 snprintf(menuid, sizeof(menuid), "grouping-%s", manager->id);
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2639 gnt_menuitem_set_id(GNT_MENU_ITEM(item), menuid);
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2640 gnt_menu_add_item(GNT_MENU(subsub), item);
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2641 g_object_set_data_full(G_OBJECT(item), "grouping-id", g_strdup(manager->id), g_free);
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2642 gnt_menuitem_set_callback(item, menu_group_set_cb, NULL);
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2643 }
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2644 }
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
2645
19555
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2646 static gboolean
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2647 auto_join_chats(gpointer data)
15242
4f4b5d66f9af [gaim-migrate @ 17967]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15241
diff changeset
2648 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2649 PurpleBlistNode *node;
19555
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2650 PurpleConnection *pc = data;
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2651 PurpleAccount *account = purple_connection_get_account(pc);
15242
4f4b5d66f9af [gaim-migrate @ 17967]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15241
diff changeset
2652
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2653 for (node = purple_blist_get_root(); node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2654 node = purple_blist_node_next(node, FALSE)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2655 if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2656 PurpleChat *chat = (PurpleChat*)node;
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
2657 if (purple_chat_get_account(chat) == account &&
16828
0501ee8b8220 Fix this spectacularly braindead code. I must've been on the good stuff when I wrote this. Fixes #364.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16719
diff changeset
2658 purple_blist_node_get_bool(node, "gnt-autojoin"))
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
2659 serv_join_chat(purple_account_get_connection(account), purple_chat_get_components(chat));
15242
4f4b5d66f9af [gaim-migrate @ 17967]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15241
diff changeset
2660 }
4f4b5d66f9af [gaim-migrate @ 17967]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15241
diff changeset
2661 }
19555
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2662 return FALSE;
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2663 }
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2664
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2665 static void
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2666 account_signed_on_cb(PurpleConnection *gc, gpointer null)
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2667 {
9d5c2c048760 I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19425
diff changeset
2668 g_idle_add(auto_join_chats, gc);
15242
4f4b5d66f9af [gaim-migrate @ 17967]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15241
diff changeset
2669 }
18626
c2d9efa0ef1a Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18625
diff changeset
2670
c2d9efa0ef1a Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18625
diff changeset
2671 static void toggle_pref_cb(GntMenuItem *item, gpointer n)
18625
775baeaa9f1a Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18614
diff changeset
2672 {
18626
c2d9efa0ef1a Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18625
diff changeset
2673 purple_prefs_set_bool(n, !purple_prefs_get_bool(n));
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2674 }
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2675
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2676 static void sort_blist_change_cb(GntMenuItem *item, gpointer n)
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2677 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2678 purple_prefs_set_string(PREF_ROOT "/sort_type", n);
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2679 }
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2680
22378
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2681 static void
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2682 block_select_cb(gpointer data, PurpleRequestFields *fields)
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2683 {
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2684 PurpleAccount *account = purple_request_fields_get_account(fields, "account");
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2685 const char *name = purple_request_fields_get_string(fields, "screenname");
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2686 if (account && name && *name != '\0') {
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2687 if (purple_request_fields_get_choice(fields, "block") == 1) {
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2688 purple_privacy_deny(account, name, FALSE, FALSE);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2689 } else {
22379
5e476bfc5d5e fix unblocking
Richard Nelson <wabz@pidgin.im>
parents: 22378
diff changeset
2690 purple_privacy_allow(account, name, FALSE, FALSE);
22378
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2691 }
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2692 }
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2693 }
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2694
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2695 static void
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2696 block_select(GntMenuItem *item, gpointer n)
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2697 {
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2698 PurpleRequestFields *fields;
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2699 PurpleRequestFieldGroup *group;
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2700 PurpleRequestField *field;
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2701
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2702 fields = purple_request_fields_new();
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2703
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2704 group = purple_request_field_group_new(NULL);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2705 purple_request_fields_add_group(fields, group);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2706
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2707 field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2708 purple_request_field_set_type_hint(field, "screenname");
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2709 purple_request_field_set_required(field, TRUE);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2710 purple_request_field_group_add_field(group, field);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2711
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2712 field = purple_request_field_account_new("account", _("Account"), NULL);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2713 purple_request_field_set_type_hint(field, "account");
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2714 purple_request_field_set_visible(field,
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2715 (purple_connections_get_all() != NULL &&
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2716 purple_connections_get_all()->next != NULL));
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2717 purple_request_field_set_required(field, TRUE);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2718 purple_request_field_group_add_field(group, field);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2719
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2720 field = purple_request_field_choice_new("block", _("Block/Unblock"), 1);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2721 purple_request_field_choice_add(field, _("Block"));
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2722 purple_request_field_choice_add(field, _("Unblock"));
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2723 purple_request_field_group_add_field(group, field);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2724
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2725 purple_request_fields(purple_get_blist(), _("Block/Unblock"),
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2726 NULL,
22942
2bf494f8e2a4 Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents: 22935
diff changeset
2727 _("Please enter the username or alias of the person "
22378
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2728 "you would like to Block/Unblock."),
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2729 fields,
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2730 _("OK"), G_CALLBACK(block_select_cb),
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2731 _("Cancel"), NULL,
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2732 NULL, NULL, NULL,
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2733 NULL);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2734 }
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2735
18607
9b0e8be076f0 Fix a bug where buddies from offline accounts were showing up.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18400
diff changeset
2736 /* send_im_select* -- Xerox */
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2737 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2738 send_im_select_cb(gpointer data, PurpleRequestFields *fields)
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2739 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2740 PurpleAccount *account;
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2741 const char *username;
22556
dc08052dcac2 Make sure an existing conversation selected from the 'Send IM' dialog is given the focus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22491
diff changeset
2742 PurpleConversation *conv;
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2743
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2744 account = purple_request_fields_get_account(fields, "account");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2745 username = purple_request_fields_get_string(fields, "screenname");
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2746
22556
dc08052dcac2 Make sure an existing conversation selected from the 'Send IM' dialog is given the focus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22491
diff changeset
2747 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username);
dc08052dcac2 Make sure an existing conversation selected from the 'Send IM' dialog is given the focus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22491
diff changeset
2748 purple_conversation_present(conv);
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2749 }
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2750
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2751 static void
14981
2db0dea6fc9e [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14951
diff changeset
2752 send_im_select(GntMenuItem *item, gpointer n)
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2753 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2754 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2755 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2756 PurpleRequestField *field;
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2757
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2758 fields = purple_request_fields_new();
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2759
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2760 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2761 purple_request_fields_add_group(fields, group);
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2762
20793
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2763 field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2764 purple_request_field_set_type_hint(field, "screenname");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2765 purple_request_field_set_required(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2766 purple_request_field_group_add_field(group, field);
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2767
20793
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2768 field = purple_request_field_account_new("account", _("Account"), NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2769 purple_request_field_set_type_hint(field, "account");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2770 purple_request_field_set_visible(field,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2771 (purple_connections_get_all() != NULL &&
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2772 purple_connections_get_all()->next != NULL));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2773 purple_request_field_set_required(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
2774 purple_request_field_group_add_field(group, field);
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2775
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
2776 purple_request_fields(purple_get_blist(), _("New Instant Message"),
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2777 NULL,
22942
2bf494f8e2a4 Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents: 22935
diff changeset
2778 _("Please enter the username or alias of the person "
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2779 "you would like to IM."),
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2780 fields,
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2781 _("OK"), G_CALLBACK(send_im_select_cb),
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2782 _("Cancel"), NULL,
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16478
diff changeset
2783 NULL, NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
2784 NULL);
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2785 }
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2786
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2787 static void
20793
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2788 join_chat_select_cb(gpointer data, PurpleRequestFields *fields)
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2789 {
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2790 PurpleAccount *account;
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2791 const char *name;
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2792 PurpleConnection *gc;
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2793 PurpleChat *chat;
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2794 GHashTable *hash = NULL;
23422
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2795 PurpleConversation *conv;
20793
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2796
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2797 account = purple_request_fields_get_account(fields, "account");
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2798 name = purple_request_fields_get_string(fields, "chat");
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2799
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2800 if (!purple_account_is_connected(account))
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2801 return;
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2802
22336
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
2803 gc = purple_account_get_connection(account);
23422
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2804 /* Create a new conversation now. This will give focus to the new window.
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2805 * But it's necessary to pretend that we left the chat, because otherwise
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2806 * a new conversation window will pop up when we finally join the chat. */
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2807 if (!(conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, name, account))) {
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2808 conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name);
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2809 purple_conv_chat_left(PURPLE_CONV_CHAT(conv));
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2810 } else {
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2811 purple_conversation_present(conv);
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2812 }
22bc7c68bbc3 Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22988
diff changeset
2813
20793
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2814 chat = purple_blist_find_chat(account, name);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2815 if (chat == NULL) {
22336
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
2816 PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
2817 if (info->chat_info_defaults != NULL)
ac905bb0a8ec Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22335
diff changeset
2818 hash = info->chat_info_defaults(gc, name);
20793
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2819 } else {
22341
ed341c90116e Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22339
diff changeset
2820 hash = purple_chat_get_components(chat);
20793
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2821 }
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2822 serv_join_chat(gc, hash);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2823 if (chat == NULL && hash != NULL)
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2824 g_hash_table_destroy(hash);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2825 }
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2826
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2827 static void
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2828 join_chat_select(GntMenuItem *item, gpointer n)
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2829 {
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2830 PurpleRequestFields *fields;
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2831 PurpleRequestFieldGroup *group;
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2832 PurpleRequestField *field;
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2833
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2834 fields = purple_request_fields_new();
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2835
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2836 group = purple_request_field_group_new(NULL);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2837 purple_request_fields_add_group(fields, group);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2838
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2839 field = purple_request_field_string_new("chat", _("Channel"), NULL, FALSE);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2840 purple_request_field_set_required(field, TRUE);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2841 purple_request_field_group_add_field(group, field);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2842
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2843 field = purple_request_field_account_new("account", _("Account"), NULL);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2844 purple_request_field_set_type_hint(field, "account");
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2845 purple_request_field_set_visible(field,
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2846 (purple_connections_get_all() != NULL &&
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2847 purple_connections_get_all()->next != NULL));
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2848 purple_request_field_set_required(field, TRUE);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2849 purple_request_field_group_add_field(group, field);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2850
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
2851 purple_request_fields(purple_get_blist(), _("Join a Chat"),
20793
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2852 NULL,
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2853 _("Please enter the name of the chat you want to join."),
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2854 fields,
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2855 _("Join"), G_CALLBACK(join_chat_select_cb),
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2856 _("Cancel"), NULL,
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2857 NULL, NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
2858 NULL);
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2859 }
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2860
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2861 static void
22988
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2862 view_log_select_cb(gpointer data, PurpleRequestFields *fields)
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2863 {
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2864 PurpleAccount *account;
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2865 const char *name;
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2866 PurpleBuddy *buddy;
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2867 PurpleContact *contact;
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2868
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2869 account = purple_request_fields_get_account(fields, "account");
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2870 name = purple_request_fields_get_string(fields, "screenname");
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2871
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2872 buddy = purple_find_buddy(account, name);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2873 if (buddy) {
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2874 contact = purple_buddy_get_contact(buddy);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2875 } else {
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2876 contact = NULL;
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2877 }
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2878
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2879 if (contact) {
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2880 finch_log_show_contact(contact);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2881 } else {
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2882 finch_log_show(PURPLE_LOG_IM, name, account);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2883 }
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2884 }
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2885
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2886 static void
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2887 view_log_cb(GntMenuItem *item, gpointer n)
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2888 {
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2889 PurpleRequestFields *fields;
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2890 PurpleRequestFieldGroup *group;
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2891 PurpleRequestField *field;
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2892
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2893 fields = purple_request_fields_new();
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2894
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2895 group = purple_request_field_group_new(NULL);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2896 purple_request_fields_add_group(fields, group);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2897
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2898 field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2899 purple_request_field_set_type_hint(field, "screenname-all");
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2900 purple_request_field_set_required(field, TRUE);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2901 purple_request_field_group_add_field(group, field);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2902
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2903 field = purple_request_field_account_new("account", _("Account"), NULL);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2904 purple_request_field_set_type_hint(field, "account");
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2905 purple_request_field_set_visible(field,
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2906 (purple_accounts_get_all() != NULL &&
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2907 purple_accounts_get_all()->next != NULL));
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2908 purple_request_field_set_required(field, TRUE);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2909 purple_request_field_group_add_field(group, field);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2910 purple_request_field_account_set_show_all(field, TRUE);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2911
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2912 purple_request_fields(purple_get_blist(), _("View Log"),
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2913 NULL,
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2914 _("Please enter the username or alias of the person "
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2915 "whose log you would like to view."),
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2916 fields,
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2917 _("OK"), G_CALLBACK(view_log_select_cb),
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2918 _("Cancel"), NULL,
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2919 NULL, NULL, NULL,
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2920 NULL);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2921 }
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2922
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2923 static void
23431
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2924 view_all_logs_cb(GntMenuItem *item, gpointer n)
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2925 {
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2926 finch_log_show(PURPLE_LOG_IM, NULL, NULL);
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2927 }
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2928
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2929 static void
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2930 menu_add_buddy_cb(GntMenuItem *item, gpointer null)
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2931 {
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2932 purple_blist_request_add_buddy(NULL, NULL, NULL, NULL);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2933 }
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2934
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2935 static void
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2936 menu_add_chat_cb(GntMenuItem *item, gpointer null)
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2937 {
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2938 purple_blist_request_add_chat(NULL, NULL, NULL, NULL);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2939 }
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2940
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2941 static void
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2942 menu_add_group_cb(GntMenuItem *item, gpointer null)
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2943 {
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2944 purple_blist_request_add_group();
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2945 }
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2946
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2947 static void
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
2948 menu_group_set_cb(GntMenuItem *item, gpointer null)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
2949 {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
2950 const char *id = g_object_get_data(G_OBJECT(item), "grouping-id");
22300
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
2951 purple_prefs_set_string(PREF_ROOT "/grouping", id);
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
2952 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
2953
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
2954 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21855
diff changeset
2955 create_menu(void)
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2956 {
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2957 GntWidget *menu, *sub, *subsub;
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2958 GntMenuItem *item;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2959 GntWindow *window;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2960
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2961 if (!ggblist)
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2962 return;
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2963
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2964 window = GNT_WINDOW(ggblist->window);
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
2965 ggblist->menu = menu = gnt_menu_new(GNT_MENU_TOPLEVEL);
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2966 gnt_window_set_menu(window, GNT_MENU(menu));
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2967
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2968 item = gnt_menuitem_new(_("Options"));
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2969 gnt_menu_add_item(GNT_MENU(menu), item);
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2970
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2971 sub = gnt_menu_new(GNT_MENU_POPUP);
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2972 gnt_menuitem_set_submenu(item, GNT_MENU(sub));
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
2973
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2974 item = gnt_menuitem_new(_("Send IM..."));
20823
4f1e2463fc36 Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20793
diff changeset
2975 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "send-im");
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2976 gnt_menu_add_item(GNT_MENU(sub), item);
15991
1efb6bd8ba3f Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15931
diff changeset
2977 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), send_im_select, NULL);
14951
315052c54c13 [gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14945
diff changeset
2978
22378
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2979 item = gnt_menuitem_new(_("Block/Unblock..."));
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2980 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "block-unblock");
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2981 gnt_menu_add_item(GNT_MENU(sub), item);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2982 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), block_select, NULL);
921097afd92d Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents: 22376
diff changeset
2983
20793
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2984 item = gnt_menuitem_new(_("Join Chat..."));
20823
4f1e2463fc36 Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20793
diff changeset
2985 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "join-chat");
20793
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2986 gnt_menu_add_item(GNT_MENU(sub), item);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2987 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), join_chat_select, NULL);
2cf364db44c2 Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20666
diff changeset
2988
22988
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2989 item = gnt_menuitem_new(_("View Log..."));
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2990 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "view-log");
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2991 gnt_menu_add_item(GNT_MENU(sub), item);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2992 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), view_log_cb, NULL);
d311acabca71 Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22986
diff changeset
2993
23431
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2994 item = gnt_menuitem_new(_("View All Logs"));
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2995 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "view-all-logs");
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2996 gnt_menu_add_item(GNT_MENU(sub), item);
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2997 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), view_all_logs_cb, NULL);
c50538da03fd Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23422
diff changeset
2998
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
2999 item = gnt_menuitem_new(_("Show"));
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3000 gnt_menu_add_item(GNT_MENU(sub), item);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3001 subsub = gnt_menu_new(GNT_MENU_POPUP);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3002 gnt_menuitem_set_submenu(item, GNT_MENU(subsub));
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3003
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3004 item = gnt_menuitem_check_new(_("Empty groups"));
20823
4f1e2463fc36 Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20793
diff changeset
3005 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "show-empty-groups");
18625
775baeaa9f1a Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18614
diff changeset
3006 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item),
775baeaa9f1a Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18614
diff changeset
3007 purple_prefs_get_bool(PREF_ROOT "/emptygroups"));
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3008 gnt_menu_add_item(GNT_MENU(subsub), item);
18626
c2d9efa0ef1a Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18625
diff changeset
3009 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), toggle_pref_cb, PREF_ROOT "/emptygroups");
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
3010
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3011 item = gnt_menuitem_check_new(_("Offline buddies"));
20823
4f1e2463fc36 Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20793
diff changeset
3012 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "show-offline-buddies");
15991
1efb6bd8ba3f Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15931
diff changeset
3013 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3014 purple_prefs_get_bool(PREF_ROOT "/showoffline"));
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3015 gnt_menu_add_item(GNT_MENU(subsub), item);
18626
c2d9efa0ef1a Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18625
diff changeset
3016 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), toggle_pref_cb, PREF_ROOT "/showoffline");
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
3017
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3018 item = gnt_menuitem_new(_("Sort"));
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
3019 gnt_menu_add_item(GNT_MENU(sub), item);
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3020 subsub = gnt_menu_new(GNT_MENU_POPUP);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3021 gnt_menuitem_set_submenu(item, GNT_MENU(subsub));
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3022
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3023 item = gnt_menuitem_new(_("By Status"));
20823
4f1e2463fc36 Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20793
diff changeset
3024 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "sort-status");
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3025 gnt_menu_add_item(GNT_MENU(subsub), item);
15991
1efb6bd8ba3f Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15931
diff changeset
3026 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), sort_blist_change_cb, "status");
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
3027
20684
4daaf3284863 propagate from branch 'im.pidgin.pidgin' (head b47c4fe72d16b3724a2e8fa0b9c783bc33863beb)
Gabriel Schulhof <nix@go-nix.ca>
parents: 20628 19997
diff changeset
3028 item = gnt_menuitem_new(_("Alphabetically"));
20823
4f1e2463fc36 Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20793
diff changeset
3029 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "sort-alpha");
20684
4daaf3284863 propagate from branch 'im.pidgin.pidgin' (head b47c4fe72d16b3724a2e8fa0b9c783bc33863beb)
Gabriel Schulhof <nix@go-nix.ca>
parents: 20628 19997
diff changeset
3030 gnt_menu_add_item(GNT_MENU(subsub), item);
15991
1efb6bd8ba3f Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15931
diff changeset
3031 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), sort_blist_change_cb, "text");
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
3032
20691
2b0a4e2175db Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents: 20690
diff changeset
3033 item = gnt_menuitem_new(_("By Log Size"));
20823
4f1e2463fc36 Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20793
diff changeset
3034 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "sort-log");
20691
2b0a4e2175db Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents: 20690
diff changeset
3035 gnt_menu_add_item(GNT_MENU(subsub), item);
2b0a4e2175db Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents: 20690
diff changeset
3036 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), sort_blist_change_cb, "log");
2b0a4e2175db Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents: 20690
diff changeset
3037
2b0a4e2175db Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents: 20690
diff changeset
3038 item = gnt_menuitem_new(_("Add"));
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
3039 gnt_menu_add_item(GNT_MENU(sub), item);
20691
2b0a4e2175db Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents: 20690
diff changeset
3040
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3041 subsub = gnt_menu_new(GNT_MENU_POPUP);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3042 gnt_menuitem_set_submenu(item, GNT_MENU(subsub));
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3043
22288
c6c6473ce2b9 Mark some strings for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22286
diff changeset
3044 item = gnt_menuitem_new(_("Buddy"));
20823
4f1e2463fc36 Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20793
diff changeset
3045 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "add-buddy");
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3046 gnt_menu_add_item(GNT_MENU(subsub), item);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3047 gnt_menuitem_set_callback(item, menu_add_buddy_cb, NULL);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3048
22288
c6c6473ce2b9 Mark some strings for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22286
diff changeset
3049 item = gnt_menuitem_new(_("Chat"));
20823
4f1e2463fc36 Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20793
diff changeset
3050 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "add-chat");
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3051 gnt_menu_add_item(GNT_MENU(subsub), item);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3052 gnt_menuitem_set_callback(item, menu_add_chat_cb, NULL);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3053
22288
c6c6473ce2b9 Mark some strings for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22286
diff changeset
3054 item = gnt_menuitem_new(_("Group"));
20823
4f1e2463fc36 Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20793
diff changeset
3055 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "add-group");
20628
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3056 gnt_menu_add_item(GNT_MENU(subsub), item);
14b7b59970c3 Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20147
diff changeset
3057 gnt_menuitem_set_callback(item, menu_add_group_cb, NULL);
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
3058
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
3059 ggblist->grouping = item = gnt_menuitem_new(_("Grouping"));
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3060 gnt_menu_add_item(GNT_MENU(sub), item);
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
3061 reconstruct_grouping_menu();
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3062
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
3063 reconstruct_accounts_menu();
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
3064 gnt_menu_add_item(GNT_MENU(menu), ggblist->accounts);
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
3065
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
3066 reconstruct_plugins_menu();
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
3067 gnt_menu_add_item(GNT_MENU(menu), ggblist->plugins);
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
3068 }
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
3069
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
3070 void finch_blist_show()
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
3071 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3072 blist_show(purple_get_blist());
14909
d72792eb7575 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14908
diff changeset
3073 }
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
3074
14909
d72792eb7575 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14908
diff changeset
3075 static void
16165
24ec117bc52c Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents: 15991
diff changeset
3076 group_collapsed(GntWidget *widget, PurpleBlistNode *node, gboolean collapsed, gpointer null)
24ec117bc52c Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents: 15991
diff changeset
3077 {
16166
e40815a97f8e ...only for groups
Richard Nelson <wabz@pidgin.im>
parents: 16165
diff changeset
3078 if (PURPLE_BLIST_NODE_IS_GROUP(node))
e40815a97f8e ...only for groups
Richard Nelson <wabz@pidgin.im>
parents: 16165
diff changeset
3079 purple_blist_node_set_bool(node, "collapsed", collapsed);
16165
24ec117bc52c Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents: 15991
diff changeset
3080 }
24ec117bc52c Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents: 15991
diff changeset
3081
24ec117bc52c Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents: 15991
diff changeset
3082 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3083 blist_show(PurpleBuddyList *list)
14909
d72792eb7575 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14908
diff changeset
3084 {
d72792eb7575 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14908
diff changeset
3085 if (ggblist == NULL)
d72792eb7575 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14908
diff changeset
3086 new_list(list);
18400
549820f4725c If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18391
diff changeset
3087 else if (ggblist->window) {
549820f4725c If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18391
diff changeset
3088 gnt_window_present(ggblist->window);
14909
d72792eb7575 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14908
diff changeset
3089 return;
18400
549820f4725c If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18391
diff changeset
3090 }
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3091
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
3092 ggblist->window = gnt_vwindow_new(FALSE);
13931
a0a91e17f899 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13927
diff changeset
3093 gnt_widget_set_name(ggblist->window, "buddylist");
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
3094 gnt_box_set_toplevel(GNT_BOX(ggblist->window), TRUE);
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3095 gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List"));
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
3096 gnt_box_set_pad(GNT_BOX(ggblist->window), 0);
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3097
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3098 ggblist->tree = gnt_tree_new();
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
3099
13915
15a38b312abe [gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13852
diff changeset
3100 GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3101 gnt_widget_set_size(ggblist->tree, purple_prefs_get_int(PREF_ROOT "/size/width"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3102 purple_prefs_get_int(PREF_ROOT "/size/height"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3103 gnt_widget_set_position(ggblist->window, purple_prefs_get_int(PREF_ROOT "/position/x"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3104 purple_prefs_get_int(PREF_ROOT "/position/y"));
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3105
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3106 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3107
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3108 ggblist->status = gnt_combo_box_new();
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3109 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->status);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3110 ggblist->statustext = gnt_entry_new(NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3111 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->statustext);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3112
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3113 gnt_widget_show(ggblist->window);
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
3114
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3115 purple_signal_connect(purple_connections_get_handle(), "signed-on", finch_blist_get_handle(),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3116 PURPLE_CALLBACK(reconstruct_accounts_menu), NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3117 purple_signal_connect(purple_connections_get_handle(), "signed-off", finch_blist_get_handle(),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3118 PURPLE_CALLBACK(reconstruct_accounts_menu), NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3119 purple_signal_connect(purple_blist_get_handle(), "buddy-status-changed", finch_blist_get_handle(),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3120 PURPLE_CALLBACK(buddy_status_changed), ggblist);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3121 purple_signal_connect(purple_blist_get_handle(), "buddy-idle-changed", finch_blist_get_handle(),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3122 PURPLE_CALLBACK(buddy_idle_changed), ggblist);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3123
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3124 purple_signal_connect(purple_plugins_get_handle(), "plugin-load", finch_blist_get_handle(),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3125 PURPLE_CALLBACK(reconstruct_plugins_menu), NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3126 purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", finch_blist_get_handle(),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3127 PURPLE_CALLBACK(reconstruct_plugins_menu), NULL);
14945
4cd7dbf2933b [gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14912
diff changeset
3128
22110
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
3129 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", finch_blist_get_handle(),
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
3130 PURPLE_CALLBACK(buddy_signed_on_off), ggblist);
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
3131 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", finch_blist_get_handle(),
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
3132 PURPLE_CALLBACK(buddy_signed_on_off), ggblist);
d0bd9cd65d03 Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21855
diff changeset
3133
13926
d2c1522276b3 [gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13923
diff changeset
3134 #if 0
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
3135 /* These I plan to use to indicate unread-messages etc. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3136 purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", finch_blist_get_handle(),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3137 PURPLE_CALLBACK(received_im_msg), list);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3138 purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg", finch_blist_get_handle(),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3139 PURPLE_CALLBACK(sent_im_msg), NULL);
13919
94caf5dc02b4 [gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13915
diff changeset
3140
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3141 purple_signal_connect(purple_conversations_get_handle(), "received-chat-msg", finch_blist_get_handle(),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3142 PURPLE_CALLBACK(received_chat_msg), list);
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
3143 #endif
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3144
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
3145 g_signal_connect(G_OBJECT(ggblist->tree), "selection_changed", G_CALLBACK(selection_changed), ggblist);
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
3146 g_signal_connect(G_OBJECT(ggblist->tree), "key_pressed", G_CALLBACK(key_pressed), ggblist);
14896
bcc0f594ed15 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14774
diff changeset
3147 g_signal_connect(G_OBJECT(ggblist->tree), "context-menu", G_CALLBACK(context_menu), ggblist);
16165
24ec117bc52c Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents: 15991
diff changeset
3148 g_signal_connect(G_OBJECT(ggblist->tree), "collapse-toggled", G_CALLBACK(group_collapsed), NULL);
13922
7195a6fe2416 [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13920
diff changeset
3149 g_signal_connect(G_OBJECT(ggblist->tree), "activate", G_CALLBACK(selection_activate), ggblist);
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3150 g_signal_connect_data(G_OBJECT(ggblist->tree), "gained-focus", G_CALLBACK(draw_tooltip),
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3151 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
14020
d9a007b109be [gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
3152 g_signal_connect_data(G_OBJECT(ggblist->tree), "lost-focus", G_CALLBACK(remove_peripherals),
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3153 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
16779
006f50afb7a6 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 16719
diff changeset
3154 g_signal_connect_data(G_OBJECT(ggblist->window), "workspace-hidden", G_CALLBACK(remove_peripherals),
006f50afb7a6 Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents: 16719
diff changeset
3155 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
14072
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
3156 g_signal_connect(G_OBJECT(ggblist->tree), "size_changed", G_CALLBACK(size_changed_cb), NULL);
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
3157 g_signal_connect(G_OBJECT(ggblist->window), "position_set", G_CALLBACK(save_position_cb), NULL);
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
3158 g_signal_connect(G_OBJECT(ggblist->window), "destroy", G_CALLBACK(reset_blist_window), NULL);
14072
4e64a4f18686 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
3159
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3160 /* Status signals */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3161 purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-changed", finch_blist_get_handle(),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3162 PURPLE_CALLBACK(savedstatus_changed), NULL);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3163 g_signal_connect(G_OBJECT(ggblist->status), "selection_changed",
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3164 G_CALLBACK(status_selection_changed), NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3165 g_signal_connect(G_OBJECT(ggblist->statustext), "key_pressed",
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3166 G_CALLBACK(status_text_changed), NULL);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3167
14774
317db0f851e0 [gaim-migrate @ 17466]
Richard Nelson <wabz@pidgin.im>
parents: 14770
diff changeset
3168 create_menu();
14678
97f57691faab [gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14620
diff changeset
3169
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
3170 populate_buddylist();
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
3171
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
3172 savedstatus_changed(purple_savedstatus_get_current(), NULL);
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3173 }
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3174
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
3175 void finch_blist_uninit()
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13959
diff changeset
3176 {
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
3177 if (ggblist == NULL)
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
3178 return;
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14082
diff changeset
3179
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13959
diff changeset
3180 gnt_widget_destroy(ggblist->window);
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13959
diff changeset
3181 g_free(ggblist);
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13959
diff changeset
3182 ggblist = NULL;
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13959
diff changeset
3183 }
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13959
diff changeset
3184
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
3185 gboolean finch_blist_get_position(int *x, int *y)
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3186 {
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
3187 if (!ggblist || !ggblist->window)
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
3188 return FALSE;
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3189 gnt_widget_get_position(ggblist->window, x, y);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
3190 return TRUE;
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3191 }
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13959
diff changeset
3192
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
3193 void finch_blist_set_position(int x, int y)
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3194 {
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3195 gnt_widget_set_position(ggblist->window, x, y);
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3196 }
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3197
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
3198 gboolean finch_blist_get_size(int *width, int *height)
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3199 {
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
3200 if (!ggblist || !ggblist->window)
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
3201 return FALSE;
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3202 gnt_widget_get_size(ggblist->window, width, height);
14413
bd998fe17d82 [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14280
diff changeset
3203 return TRUE;
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3204 }
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3205
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15825
diff changeset
3206 void finch_blist_set_size(int width, int height)
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3207 {
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3208 gnt_widget_set_size(ggblist->window, width, height);
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
3209 }
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3210
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3211 void finch_blist_install_manager(const FinchBlistManager *manager)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3212 {
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
3213 if (!g_list_find(managers, manager)) {
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3214 managers = g_list_append(managers, (gpointer)manager);
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
3215 reconstruct_grouping_menu();
22300
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
3216 if (strcmp(manager->id, purple_prefs_get_string(PREF_ROOT "/grouping")) == 0)
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
3217 purple_prefs_trigger_callback(PREF_ROOT "/grouping");
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
3218 }
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3219 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3220
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3221 void finch_blist_uninstall_manager(const FinchBlistManager *manager)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3222 {
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
3223 if (g_list_find(managers, manager)) {
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
3224 managers = g_list_remove(managers, manager);
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
3225 reconstruct_grouping_menu();
22300
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
3226 if (strcmp(manager->id, purple_prefs_get_string(PREF_ROOT "/grouping")) == 0)
42f7d98ffeeb Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22299
diff changeset
3227 purple_prefs_trigger_callback(PREF_ROOT "/grouping");
22299
e2e241477323 Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22288
diff changeset
3228 }
22285
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3229 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3230
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3231 FinchBlistManager * finch_blist_manager_find(const char *id)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3232 {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3233 GList *iter = managers;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3234 if (!id)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3235 return NULL;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3236
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3237 for (; iter; iter = iter->next) {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3238 FinchBlistManager *m = iter->data;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3239 if (strcmp(id, m->id) == 0)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3240 return m;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3241 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3242 return NULL;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3243 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3244
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3245 GntTree * finch_blist_get_tree(void)
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3246 {
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3247 return ggblist ? GNT_TREE(ggblist->tree) : NULL;
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3248 }
203b8d12f1ca Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22282
diff changeset
3249

mercurial