Wed, 04 Jun 2008 22:49:23 +0000
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
reporting the bug.
|
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 | 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 | |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
66 | typedef struct |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
67 | { |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
68 | GntWidget *window; |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
69 | GntWidget *tree; |
|
13919
94caf5dc02b4
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13915
diff
changeset
|
70 | |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
71 | GntWidget *tooltip; |
| 15884 | 72 | PurpleBlistNode *tnode; /* Who is the tooltip being displayed for? */ |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
73 | GList *tagged; /* A list of tagged blistnodes */ |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
74 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
75 | GntWidget *context; |
| 15884 | 76 | PurpleBlistNode *cnode; |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
77 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
78 | /* XXX: I am KISSing */ |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
79 | GntWidget *status; /* Dropdown with the statuses */ |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
80 | GntWidget *statustext; /* Status message */ |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
81 | int typing; |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
82 | |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
83 | GntWidget *menu; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
84 | /* These are the menuitems that get regenerated */ |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
85 | GntMenuItem *accounts; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
86 | 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
|
87 | 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
|
88 | |
|
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
|
89 | FinchBlistManager *manager; |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
90 | } FinchBlist; |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
91 | |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
92 | typedef struct |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
93 | { |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
94 | 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
|
95 | 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
|
96 | } FinchBlistNode; |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
97 | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
98 | typedef enum |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
99 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
100 | STATUS_PRIMITIVE = 0, |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
101 | STATUS_SAVED_POPULAR, |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
102 | STATUS_SAVED_ALL, |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
103 | STATUS_SAVED_NEW |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
104 | } StatusType; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
105 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
106 | typedef struct |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
107 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
108 | StatusType type; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
109 | union |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
110 | { |
| 15884 | 111 | PurpleStatusPrimitive prim; |
| 112 | PurpleSavedStatus *saved; | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
113 | } u; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
114 | } StatusBoxItem; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
115 | |
|
18850
8242ced9d971
We don't need dynamic things here.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18831
diff
changeset
|
116 | static FinchBlist *ggblist; |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
117 | |
| 15884 | 118 | static void add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist); |
| 119 | static void add_contact(PurpleContact *contact, FinchBlist *ggblist); | |
| 120 | static void add_group(PurpleGroup *group, FinchBlist *ggblist); | |
| 121 | static void add_chat(PurpleChat *chat, FinchBlist *ggblist); | |
| 122 | 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
|
123 | 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
|
124 | #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
|
125 | 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
|
126 | 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
|
127 | #endif |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
128 | 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
|
129 | 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
|
130 | static gboolean remove_typing_cb(gpointer null); |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
131 | static void remove_peripherals(FinchBlist *ggblist); |
| 15884 | 132 | static const char * get_display_name(PurpleBlistNode *node); |
| 133 | static void savedstatus_changed(PurpleSavedStatus *now, PurpleSavedStatus *old); | |
| 134 | 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
|
135 | static void update_node_display(PurpleBlistNode *buddy, FinchBlist *ggblist); |
| 15884 | 136 | 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
|
137 | 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
|
138 | 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
|
139 | 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
|
140 | |
| 14774 | 141 | /* Sort functions */ |
|
16555
9f8c3a97fb35
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
142 | static int blist_node_compare_position(PurpleBlistNode *n1, PurpleBlistNode *n2); |
| 15884 | 143 | static int blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2); |
| 144 | static int blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2); | |
| 145 | static int blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2); | |
| 14774 | 146 | |
|
21804
931ef2cc7cfb
Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents:
21630
diff
changeset
|
147 | 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
|
148 | 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
|
149 | 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
|
150 | 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
|
151 | |
|
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
|
152 | /** |
|
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
|
153 | * 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
|
154 | */ |
|
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
|
155 | |
|
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
|
156 | 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
|
157 | { |
|
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
|
158 | 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
|
159 | |
|
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
|
160 | 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
|
161 | 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
|
162 | 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
|
163 | 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
|
164 | 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
|
165 | 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
|
166 | 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
|
167 | 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
|
168 | 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
|
169 | 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
|
170 | 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
|
171 | 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
|
172 | 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
|
173 | 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
|
174 | 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
|
175 | } 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
|
176 | 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
|
177 | 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
|
178 | 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
|
179 | 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
|
180 | 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
|
181 | } |
|
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
|
182 | } 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
|
183 | 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
|
184 | 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
|
185 | 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
|
186 | } 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
|
187 | 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
|
188 | 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
|
189 | 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
|
190 | 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
|
191 | |
|
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
|
192 | 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
|
193 | 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
|
194 | 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
|
195 | 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
|
196 | } |
|
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 | } |
|
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 | |
|
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 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
|
200 | } |
|
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
|
201 | |
|
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
|
202 | 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
|
203 | { |
|
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
|
204 | 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
|
205 | 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
|
206 | 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
|
207 | 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
|
208 | 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
|
209 | 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
|
210 | 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
|
211 | 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
|
212 | 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
|
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 | 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
|
215 | 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
|
216 | 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
|
217 | } |
|
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 | |
|
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 | 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
|
220 | { |
|
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 | 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
|
222 | 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
|
223 | 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
|
224 | 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
|
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 (!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
|
227 | 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
|
228 | 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
|
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 | 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
|
231 | |
|
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 | 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
|
233 | 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
|
234 | 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
|
235 | 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
|
236 | 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
|
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 | 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
|
239 | 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
|
240 | 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
|
241 | 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
|
242 | 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
|
243 | 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
|
244 | 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
|
245 | 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
|
246 | } |
|
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 | 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
|
248 | 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
|
249 | 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
|
250 | 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
|
251 | 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
|
252 | 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
|
253 | 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
|
254 | 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
|
255 | } |
|
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 | } 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
|
257 | 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
|
258 | 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
|
259 | 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
|
260 | 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
|
261 | 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
|
262 | } 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
|
263 | 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
|
264 | |
|
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 | 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
|
266 | 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
|
267 | 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
|
268 | |
|
22342
916c989bd2c0
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22341
diff
changeset
|
269 | 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
|
270 | } 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
|
271 | 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
|
272 | 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
|
273 | |
|
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 | 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
|
275 | 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
|
276 | 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
|
277 | |
|
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 | 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
|
279 | } 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
|
280 | 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
|
281 | 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
|
282 | } |
|
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 | |
|
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
|
284 | 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
|
285 | 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
|
286 | 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
|
287 | 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
|
288 | } |
|
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 | 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
|
291 | *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
|
292 | 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
|
293 | 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
|
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 | 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
|
296 | *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
|
297 | 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
|
298 | 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
|
299 | |
|
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 | 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
|
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 | |
|
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 | 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
|
304 | { |
|
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 | "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
|
306 | N_("Default"), |
|
22312
dae4ed366fcb
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22303
diff
changeset
|
307 | NULL, |
|
dae4ed366fcb
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22303
diff
changeset
|
308 | 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
|
309 | 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
|
310 | 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
|
311 | 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
|
312 | {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
|
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 | 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
|
315 | |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
316 | static FinchBlistNode * |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
317 | 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
|
318 | { |
|
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
|
319 | 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
|
320 | if (!fnode) { |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
321 | 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
|
322 | 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
|
323 | 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
|
324 | } |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
325 | 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
|
326 | return fnode; |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
327 | } |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
328 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
329 | static void |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
330 | 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
|
331 | { |
|
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
|
332 | 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
|
333 | 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
|
334 | return; |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
335 | 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
|
336 | 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
|
337 | 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
|
338 | 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
|
339 | } |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
340 | |
|
21808
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
341 | static int |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
342 | get_display_color(PurpleBlistNode *node) |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
343 | { |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
344 | PurpleBuddy *buddy; |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
345 | int color = 0; |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
346 | |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
347 | if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
348 | node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
349 | if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
350 | return 0; |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
351 | |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
352 | buddy = (PurpleBuddy*)node; |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
353 | 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
|
354 | color = color_idle; |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
355 | } 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
|
356 | color = color_available; |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
357 | } 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
|
358 | !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
|
359 | color = color_away; |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
360 | } 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
|
361 | color = color_offline; |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
362 | } |
|
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 | return color; |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
365 | } |
|
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
366 | |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
367 | static GntTextFormatFlags |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
368 | 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
|
369 | { |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
370 | 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
|
371 | 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
|
372 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
373 | 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
|
374 | 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
|
375 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
376 | 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
|
377 | 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
|
378 | else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
379 | node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact *)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
|
380 | 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
|
381 | 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
|
382 | 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
|
383 | } 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
|
384 | /* 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
|
385 | * 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
|
386 | * 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
|
387 | /* 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
|
388 | /* 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
|
389 | * 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
|
390 | #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
|
391 | 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
|
392 | 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
|
393 | 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
|
394 | 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
|
395 | 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
|
396 | 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
|
397 | 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
|
398 | 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
|
399 | 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
|
400 | } |
|
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 | } |
|
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 | } |
|
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 | #endif |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
404 | } |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
405 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
406 | return flag; |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
407 | } |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
408 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
409 | static void |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
410 | 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
|
411 | { |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
412 | 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
|
413 | 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
|
414 | } |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
415 | |
|
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
|
416 | #if 0 |
|
14469
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
417 | static gboolean |
| 15884 | 418 | is_contact_online(PurpleContact *contact) |
|
14469
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
419 | { |
| 15884 | 420 | PurpleBlistNode *node; |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
421 | 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
|
422 | 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
|
423 | 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
|
424 | 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
|
425 | (fnode && fnode->signed_timer)) |
|
14469
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
426 | return TRUE; |
|
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
427 | } |
|
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
428 | return FALSE; |
|
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
429 | } |
|
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
430 | |
|
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
431 | static gboolean |
| 15884 | 432 | is_group_online(PurpleGroup *group) |
|
14469
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
433 | { |
| 15884 | 434 | PurpleBlistNode *node; |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
435 | 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
|
436 | 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
|
437 | 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
|
438 | purple_account_is_connected(((PurpleChat *)node)->account)) |
|
14469
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
439 | return TRUE; |
| 15884 | 440 | else if (is_contact_online((PurpleContact*)node)) |
|
14469
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
441 | return TRUE; |
|
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 | return FALSE; |
|
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
444 | } |
|
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
|
445 | #endif |
|
14469
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
446 | |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
447 | static void |
| 15884 | 448 | new_node(PurpleBlistNode *node) |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
449 | { |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
450 | } |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
451 | |
|
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
|
452 | 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
|
453 | add_node(PurpleBlistNode *node, FinchBlist *ggblist) |
|
13927
c2f57a00bc1f
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13926
diff
changeset
|
454 | { |
|
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
|
455 | 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
|
456 | 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
|
457 | |
|
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
|
458 | 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
|
459 | 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
|
460 | |
| 15884 | 461 | if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
| 462 | add_buddy((PurpleBuddy*)node, ggblist); | |
| 463 | else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) | |
| 464 | add_contact((PurpleContact*)node, ggblist); | |
| 465 | else if (PURPLE_BLIST_NODE_IS_GROUP(node)) | |
| 466 | add_group((PurpleGroup*)node, ggblist); | |
| 467 | else if (PURPLE_BLIST_NODE_IS_CHAT(node)) | |
| 468 | 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
|
469 | |
|
13927
c2f57a00bc1f
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13926
diff
changeset
|
470 | draw_tooltip(ggblist); |
|
c2f57a00bc1f
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13926
diff
changeset
|
471 | } |
|
c2f57a00bc1f
[gaim-migrate @ 16331]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13926
diff
changeset
|
472 | |
|
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
|
473 | 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
|
474 | { |
|
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
|
475 | 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
|
476 | } |
|
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
|
477 | |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
478 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
479 | remove_tooltip(FinchBlist *ggblist) |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
480 | { |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
481 | gnt_widget_destroy(ggblist->tooltip); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
482 | ggblist->tooltip = NULL; |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
483 | ggblist->tnode = NULL; |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
484 | } |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
485 | |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
486 | static void |
| 15884 | 487 | node_remove(PurpleBuddyList *list, PurpleBlistNode *node) |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
488 | { |
|
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
|
489 | 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
|
490 | PurpleBlistNode *parent; |
|
13919
94caf5dc02b4
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13915
diff
changeset
|
491 | |
|
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
|
492 | if (ggblist == NULL || FINCH_GET_DATA(node)== NULL) |
|
13919
94caf5dc02b4
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13915
diff
changeset
|
493 | return; |
|
94caf5dc02b4
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13915
diff
changeset
|
494 | |
|
94caf5dc02b4
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13915
diff
changeset
|
495 | 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
|
496 | reset_blist_node_ui_data(node); |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
497 | if (ggblist->tagged) |
|
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
498 | ggblist->tagged = g_list_remove(ggblist->tagged, node); |
|
13919
94caf5dc02b4
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13915
diff
changeset
|
499 | |
|
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
|
500 | 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
|
501 | 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
|
502 | 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
|
503 | 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
|
504 | |
|
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
|
505 | 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
|
506 | 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
|
507 | node_remove(list, parent); |
|
17876
e22e8884af80
Fix for the bug Alver reported:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17862
diff
changeset
|
508 | 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
|
509 | node_update(list, parent); |
|
13919
94caf5dc02b4
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13915
diff
changeset
|
510 | } |
| 14910 | 511 | |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
512 | draw_tooltip(ggblist); |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
513 | } |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
514 | |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
515 | static void |
| 15884 | 516 | node_update(PurpleBuddyList *list, PurpleBlistNode *node) |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
517 | { |
| 14455 | 518 | /* It really looks like this should never happen ... but it does. |
| 519 | This will at least emit a warning to the log when it | |
| 520 | happens, so maybe someone will figure it out. */ | |
| 521 | g_return_if_fail(node != NULL); | |
| 522 | ||
|
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
|
523 | if (FINCH_GET_DATA(list)== NULL) |
|
14458
b49cf8395bfa
[gaim-migrate @ 17104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14455
diff
changeset
|
524 | 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
|
525 | |
|
17862
32f49f3a139a
Fix a crash exposed by nullprpl.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
526 | if (ggblist->window == NULL) |
|
32f49f3a139a
Fix a crash exposed by nullprpl.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
527 | return; |
|
32f49f3a139a
Fix a crash exposed by nullprpl.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
528 | |
|
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
|
529 | if (FINCH_GET_DATA(node)!= NULL) { |
|
14080
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
530 | gnt_tree_change_text(GNT_TREE(ggblist->tree), node, |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
531 | 0, get_display_name(node)); |
| 14774 | 532 | 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
|
533 | 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
|
534 | 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
|
535 | 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
|
536 | node_remove(list, node); |
|
14080
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
537 | } |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
538 | |
| 15884 | 539 | if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
| 540 | 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
|
541 | 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
|
542 | node_update(list, purple_blist_node_get_parent(node)); |
| 15884 | 543 | } 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
|
544 | add_node(node, FINCH_GET_DATA(list)); |
| 15884 | 545 | } 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
|
546 | 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
|
547 | /* 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
|
548 | 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
|
549 | 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
|
550 | } |
| 15884 | 551 | } 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
|
552 | if (!ggblist->manager->can_add_node(node)) |
|
14469
3b398f75a695
[gaim-migrate @ 17115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14467
diff
changeset
|
553 | 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
|
554 | 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
|
555 | add_node(node, FINCH_GET_DATA(list)); |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
556 | } |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
557 | } |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
558 | |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
559 | static void |
| 15884 | 560 | new_list(PurpleBuddyList *list) |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
561 | { |
|
14909
d72792eb7575
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14908
diff
changeset
|
562 | if (ggblist) |
|
d72792eb7575
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14908
diff
changeset
|
563 | return; |
|
d72792eb7575
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14908
diff
changeset
|
564 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
565 | 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
|
566 | FINCH_SET_DATA(list, ggblist); |
|
22300
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
567 | 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
|
568 | if (!ggblist->manager) |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
569 | ggblist->manager = &default_manager; |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
570 | } |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
571 | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
572 | static void |
| 15884 | 573 | add_buddy_cb(void *data, PurpleRequestFields *allfields) |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
574 | { |
| 15884 | 575 | const char *username = purple_request_fields_get_string(allfields, "screenname"); |
| 576 | const char *alias = purple_request_fields_get_string(allfields, "alias"); | |
| 577 | const char *group = purple_request_fields_get_string(allfields, "group"); | |
| 578 | PurpleAccount *account = purple_request_fields_get_account(allfields, "account"); | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
579 | const char *error = NULL; |
| 15884 | 580 | PurpleGroup *grp; |
| 581 | PurpleBuddy *buddy; | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
582 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
583 | if (!username) |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22935
diff
changeset
|
584 | error = _("You must provide a username for the buddy."); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
585 | else if (!group) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
586 | error = _("You must provide a group."); |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
587 | else if (!account) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
588 | 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
|
589 | 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
|
590 | error = _("The selected account is not online."); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
591 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
592 | if (error) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
593 | { |
|
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
|
594 | finch_request_add_buddy(account, username, group, alias); |
| 15884 | 595 | purple_notify_error(NULL, _("Error"), _("Error adding buddy"), error); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
596 | return; |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
597 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
598 | |
| 15884 | 599 | grp = purple_find_group(group); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
600 | if (!grp) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
601 | { |
| 15884 | 602 | grp = purple_group_new(group); |
| 603 | purple_blist_add_group(grp, NULL); | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
604 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
605 | |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
606 | /* 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
|
607 | |
| 15884 | 608 | buddy = purple_buddy_new(account, username, alias); |
| 609 | purple_blist_add_buddy(buddy, NULL, grp, NULL); | |
| 610 | purple_account_add_buddy(account, buddy); | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
611 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
612 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
613 | static void |
| 15884 | 614 | 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
|
615 | { |
| 15884 | 616 | PurpleRequestFields *fields = purple_request_fields_new(); |
| 617 | PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); | |
| 618 | PurpleRequestField *field; | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
619 | |
| 15884 | 620 | purple_request_fields_add_group(fields, group); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
621 | |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22935
diff
changeset
|
622 | field = purple_request_field_string_new("screenname", _("Username"), username, FALSE); |
| 15884 | 623 | purple_request_field_group_add_field(group, field); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
624 | |
|
22431
06ae5eb33844
Right-clicking on a widget should trigger the context-menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22379
diff
changeset
|
625 | field = purple_request_field_string_new("alias", _("Alias (optional)"), alias, FALSE); |
| 15884 | 626 | purple_request_field_group_add_field(group, field); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
627 | |
|
22431
06ae5eb33844
Right-clicking on a widget should trigger the context-menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22379
diff
changeset
|
628 | field = purple_request_field_string_new("group", _("Add in group"), grp, FALSE); |
| 15884 | 629 | purple_request_field_group_add_field(group, field); |
|
15908
d5b3f76ff418
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15906
diff
changeset
|
630 | purple_request_field_set_type_hint(field, "group"); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
631 | |
| 15884 | 632 | field = purple_request_field_account_new("account", _("Account"), NULL); |
| 633 | purple_request_field_account_set_show_all(field, FALSE); | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
634 | if (account) |
| 15884 | 635 | purple_request_field_account_set_value(field, account); |
| 636 | purple_request_field_group_add_field(group, field); | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
637 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
638 | 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
|
639 | 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
|
640 | _("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
|
641 | _("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
|
642 | account, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
643 | 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 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
646 | 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
|
647 | 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
|
648 | { |
|
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
|
649 | 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
|
650 | 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
|
651 | 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
|
652 | 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
|
653 | |
|
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
|
654 | /* 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
|
655 | * 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
|
656 | * 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
|
657 | 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
|
658 | 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
|
659 | 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
|
660 | 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
|
661 | 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
|
662 | 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
|
663 | |
|
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
|
664 | 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
|
665 | 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
|
666 | 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
|
667 | } 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
|
668 | 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
|
669 | } |
|
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
|
670 | } |
|
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
|
671 | |
|
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
|
672 | static void |
| 15884 | 673 | add_chat_cb(void *data, PurpleRequestFields *allfields) |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
674 | { |
| 15884 | 675 | PurpleAccount *account; |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
676 | const char *alias, *name, *group; |
| 15884 | 677 | PurpleChat *chat; |
| 678 | PurpleGroup *grp; | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
679 | GHashTable *hash = NULL; |
| 15884 | 680 | 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
|
681 | 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
|
682 | PurplePluginProtocolInfo *info; |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
683 | |
| 15884 | 684 | account = purple_request_fields_get_account(allfields, "account"); |
| 685 | name = purple_request_fields_get_string(allfields, "name"); | |
| 686 | alias = purple_request_fields_get_string(allfields, "alias"); | |
| 687 | 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
|
688 | autojoin = purple_request_fields_get_bool(allfields, "autojoin"); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
689 | |
| 15884 | 690 | if (!purple_account_is_connected(account) || !name || !*name) |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
691 | 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
|
692 | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
693 | if (!group || !*group) |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
694 | group = _("Chats"); |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
695 | |
| 15884 | 696 | 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
|
697 | 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
|
698 | 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
|
699 | 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
|
700 | |
| 15884 | 701 | chat = purple_chat_new(account, name, hash); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
702 | |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
703 | if (chat != NULL) { |
| 15884 | 704 | if ((grp = purple_find_group(group)) == NULL) { |
| 705 | grp = purple_group_new(group); | |
| 706 | purple_blist_add_group(grp, NULL); | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
707 | } |
| 15884 | 708 | purple_blist_add_chat(chat, grp, NULL); |
| 709 | 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
|
710 | 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
|
711 | 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
|
712 | 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
|
713 | } |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
714 | } |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
715 | } |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
716 | |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
717 | static void |
| 15884 | 718 | 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
|
719 | { |
| 15884 | 720 | PurpleRequestFields *fields = purple_request_fields_new(); |
| 721 | PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); | |
| 722 | PurpleRequestField *field; | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
723 | |
| 15884 | 724 | purple_request_fields_add_group(fields, group); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
725 | |
| 15884 | 726 | field = purple_request_field_account_new("account", _("Account"), NULL); |
| 727 | purple_request_field_account_set_show_all(field, FALSE); | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
728 | if (account) |
| 15884 | 729 | purple_request_field_account_set_value(field, account); |
| 730 | purple_request_field_group_add_field(group, field); | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
731 | |
| 15884 | 732 | field = purple_request_field_string_new("name", _("Name"), name, FALSE); |
| 733 | purple_request_field_group_add_field(group, field); | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
734 | |
| 15884 | 735 | field = purple_request_field_string_new("alias", _("Alias"), alias, FALSE); |
| 736 | purple_request_field_group_add_field(group, field); | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
737 | |
|
22342
916c989bd2c0
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22341
diff
changeset
|
738 | field = purple_request_field_string_new("group", _("Group"), grp ? purple_group_get_name(grp) : NULL, FALSE); |
| 15884 | 739 | 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
|
740 | purple_request_field_set_type_hint(field, "group"); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
741 | |
|
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
|
742 | 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
|
743 | 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
|
744 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
745 | purple_request_fields(NULL, _("Add Chat"), NULL, |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
746 | _("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
|
747 | 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
|
748 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
749 | NULL); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
750 | } |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
751 | |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
752 | static void |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
753 | add_group_cb(gpointer null, const char *group) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
754 | { |
| 15884 | 755 | PurpleGroup *grp; |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
756 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
757 | if (!group || !*group) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
758 | { |
| 15884 | 759 | purple_notify_error(NULL, _("Error"), _("Error adding group"), |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
760 | _("You must give a name for the group to add.")); |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
761 | return; |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
762 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
763 | |
| 15884 | 764 | grp = purple_find_group(group); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
765 | if (!grp) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
766 | { |
| 15884 | 767 | grp = purple_group_new(group); |
| 768 | purple_blist_add_group(grp, NULL); | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
769 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
770 | else |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
771 | { |
| 15884 | 772 | purple_notify_error(NULL, _("Error"), _("Error adding group"), |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
773 | _("A group with the name already exists.")); |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
774 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
775 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
776 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
777 | 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
|
778 | finch_request_add_group(void) |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
779 | { |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
780 | 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
|
781 | 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
|
782 | _("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
|
783 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
784 | NULL); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
785 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
786 | |
| 15884 | 787 | static PurpleBlistUiOps blist_ui_ops = |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
788 | { |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
789 | new_list, |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
790 | new_node, |
|
14909
d72792eb7575
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14908
diff
changeset
|
791 | blist_show, |
|
14447
32f854416012
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14446
diff
changeset
|
792 | node_update, |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
793 | node_remove, |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
794 | NULL, |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
795 | NULL, |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17018
diff
changeset
|
796 | 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
|
797 | 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
|
798 | 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
|
799 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17018
diff
changeset
|
800 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17018
diff
changeset
|
801 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17018
diff
changeset
|
802 | NULL |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
803 | }; |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
804 | |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
805 | 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
|
806 | finch_blist_get_handle(void) |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
807 | { |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
808 | static int handle; |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
809 | |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
810 | return &handle; |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
811 | } |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
812 | |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
813 | static void |
| 15884 | 814 | add_group(PurpleGroup *group, FinchBlist *ggblist) |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
815 | { |
|
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
|
816 | gpointer parent; |
| 15884 | 817 | 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
|
818 | if (FINCH_GET_DATA(node)) |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
819 | 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
|
820 | 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
|
821 | 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
|
822 | 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
|
823 | parent, NULL)); |
|
16165
24ec117bc52c
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
824 | 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
|
825 | !purple_blist_node_get_bool(node, "collapsed")); |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
826 | } |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
827 | |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
828 | static const char * |
| 15884 | 829 | get_display_name(PurpleBlistNode *node) |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
830 | { |
|
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
831 | static char text[2096]; |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
832 | char status[8] = " "; |
|
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
833 | const char *name = NULL; |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
834 | |
| 15884 | 835 | if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
| 836 | node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)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
|
837 | |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
838 | if (node == NULL) |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
839 | return NULL; |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
840 | |
| 15884 | 841 | if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
842 | { |
| 15884 | 843 | PurpleBuddy *buddy = (PurpleBuddy *)node; |
| 844 | PurpleStatusPrimitive prim; | |
| 845 | PurplePresence *presence; | |
| 846 | PurpleStatus *now; | |
|
13989
9a647311c9ac
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13978
diff
changeset
|
847 | 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
|
848 | |
| 15884 | 849 | 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
|
850 | 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
|
851 | 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
|
852 | 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
|
853 | now = purple_presence_get_active_status(presence); |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
854 | |
|
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
|
855 | 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
|
856 | |
|
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
|
857 | 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
|
858 | 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
|
859 | 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
|
860 | 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
|
861 | 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
|
862 | 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
|
863 | 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
|
864 | 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
|
865 | 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
|
866 | 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
|
867 | } |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
868 | } |
| 15884 | 869 | name = purple_buddy_get_alias(buddy); |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
870 | } |
| 15884 | 871 | else if (PURPLE_BLIST_NODE_IS_CHAT(node)) |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
872 | { |
| 15884 | 873 | PurpleChat *chat = (PurpleChat*)node; |
| 874 | name = purple_chat_get_name(chat); | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13946
diff
changeset
|
875 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13946
diff
changeset
|
876 | strncpy(status, "~", sizeof(status) - 1); |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
877 | } |
| 15884 | 878 | 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
|
879 | return purple_group_get_name((PurpleGroup*)node); |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
880 | |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
881 | snprintf(text, sizeof(text) - 1, "%s %s", status, name); |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
882 | |
|
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
883 | return text; |
|
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
884 | } |
|
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
885 | |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
886 | static void |
| 15884 | 887 | add_chat(PurpleChat *chat, FinchBlist *ggblist) |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
888 | { |
|
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
|
889 | gpointer parent; |
| 15884 | 890 | 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
|
891 | if (FINCH_GET_DATA(node)) |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
892 | 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
|
893 | 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
|
894 | return; |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
895 | |
|
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
|
896 | parent = ggblist->manager->find_parent((PurpleBlistNode*)chat); |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
897 | |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
898 | 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
|
899 | 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
|
900 | parent, NULL)); |
|
13946
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
901 | } |
|
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
902 | |
|
c895c1eeb4d7
[gaim-migrate @ 16364]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13939
diff
changeset
|
903 | static void |
| 15884 | 904 | add_contact(PurpleContact *contact, FinchBlist *ggblist) |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
905 | { |
|
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
|
906 | gpointer parent; |
| 15884 | 907 | PurpleBlistNode *node = (PurpleBlistNode*)contact; |
|
14461
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
908 | const char *name; |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
909 | |
|
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
|
910 | if (FINCH_GET_DATA(node)) |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
911 | return; |
|
21808
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
912 | |
|
14461
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
913 | name = get_display_name(node); |
|
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
914 | if (name == NULL) |
|
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
915 | return; |
|
21808
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
916 | |
|
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
|
917 | parent = ggblist->manager->find_parent((PurpleBlistNode*)contact); |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
918 | |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
919 | 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
|
920 | 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
|
921 | parent, NULL)); |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
922 | |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
923 | gnt_tree_set_expanded(GNT_TREE(ggblist->tree), contact, FALSE); |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
924 | } |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
925 | |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
926 | static void |
| 15884 | 927 | add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist) |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
928 | { |
|
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
|
929 | 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
|
930 | PurpleBlistNode *node = (PurpleBlistNode *)buddy; |
| 15884 | 931 | 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
|
932 | |
|
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
|
933 | if (FINCH_GET_DATA(node)) |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
934 | return; |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
935 | |
|
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
|
936 | 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
|
937 | parent = ggblist->manager->find_parent((PurpleBlistNode*)buddy); |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
938 | |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
939 | 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
|
940 | 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
|
941 | 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
|
942 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
943 | blist_update_row_flags((PurpleBlistNode*)buddy); |
|
21808
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
944 | 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
|
945 | blist_update_row_flags((PurpleBlistNode*)contact); |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
946 | } |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
947 | |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
948 | #if 0 |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
949 | static void |
| 15884 | 950 | buddy_signed_on(PurpleBuddy *buddy, FinchBlist *ggblist) |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
951 | { |
| 15884 | 952 | add_node((PurpleBlistNode*)buddy, ggblist); |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
953 | } |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
954 | |
|
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
955 | static void |
| 15884 | 956 | buddy_signed_off(PurpleBuddy *buddy, FinchBlist *ggblist) |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
957 | { |
| 15884 | 958 | node_remove(purple_get_blist(), (PurpleBlistNode*)buddy); |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
959 | } |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
960 | #endif |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
961 | |
| 15884 | 962 | PurpleBlistUiOps *finch_blist_get_ui_ops() |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
963 | { |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
964 | return &blist_ui_ops; |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
965 | } |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
966 | |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
967 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
968 | selection_activate(GntWidget *widget, FinchBlist *ggblist) |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
969 | { |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13947
diff
changeset
|
970 | GntTree *tree = GNT_TREE(ggblist->tree); |
| 15884 | 971 | PurpleBlistNode *node = gnt_tree_get_selection_data(tree); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13947
diff
changeset
|
972 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13993
diff
changeset
|
973 | if (!node) |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13993
diff
changeset
|
974 | 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
|
975 | |
| 15884 | 976 | if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
| 977 | node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13993
diff
changeset
|
978 | |
| 15884 | 979 | if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13947
diff
changeset
|
980 | { |
| 15884 | 981 | PurpleBuddy *buddy = (PurpleBuddy *)node; |
|
18134
47b947e1c8f1
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18132
diff
changeset
|
982 | PurpleConversation *conv; |
|
47b947e1c8f1
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18132
diff
changeset
|
983 | 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
|
984 | purple_buddy_get_name(buddy), |
|
47b947e1c8f1
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18132
diff
changeset
|
985 | purple_buddy_get_account(buddy)); |
|
47b947e1c8f1
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18132
diff
changeset
|
986 | if (!conv) { |
|
47b947e1c8f1
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18132
diff
changeset
|
987 | 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
|
988 | purple_buddy_get_account(buddy), |
|
47b947e1c8f1
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18132
diff
changeset
|
989 | purple_buddy_get_name(buddy)); |
|
47b947e1c8f1
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18132
diff
changeset
|
990 | } 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
|
991 | FinchConv *ggconv = FINCH_GET_DATA(conv); |
|
18134
47b947e1c8f1
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18132
diff
changeset
|
992 | gnt_window_present(ggconv->window); |
|
47b947e1c8f1
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18132
diff
changeset
|
993 | } |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
994 | finch_conversation_set_active(conv); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13947
diff
changeset
|
995 | } |
| 15884 | 996 | else if (PURPLE_BLIST_NODE_IS_CHAT(node)) |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13947
diff
changeset
|
997 | { |
|
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
|
998 | join_chat((PurpleChat*)node); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13947
diff
changeset
|
999 | } |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1000 | } |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1001 | |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1002 | static void |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1003 | context_menu_callback(GntMenuItem *item, gpointer data) |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1004 | { |
| 15884 | 1005 | PurpleMenuAction *action = data; |
| 1006 | PurpleBlistNode *node = ggblist->cnode; | |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1007 | if (action) { |
| 15884 | 1008 | void (*callback)(PurpleBlistNode *, gpointer); |
| 1009 | callback = (void (*)(PurpleBlistNode *, gpointer))action->callback; | |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1010 | 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
|
1011 | callback(node, action->data); |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1012 | else |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1013 | return; |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1014 | } |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1015 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1016 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1017 | static void |
| 15884 | 1018 | 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
|
1019 | { |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1020 | GList *list; |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1021 | GntMenuItem *item; |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1022 | |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1023 | if (action == NULL) |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1024 | return; |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1025 | |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1026 | item = gnt_menuitem_new(action->label); |
|
14912
176bce6dc803
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14910
diff
changeset
|
1027 | 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
|
1028 | 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
|
1029 | gnt_menu_add_item(menu, GNT_MENU_ITEM(item)); |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1030 | |
|
14912
176bce6dc803
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14910
diff
changeset
|
1031 | if (action->children) { |
|
176bce6dc803
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14910
diff
changeset
|
1032 | GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); |
|
176bce6dc803
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14910
diff
changeset
|
1033 | gnt_menuitem_set_submenu(item, GNT_MENU(sub)); |
|
176bce6dc803
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14910
diff
changeset
|
1034 | for (list = action->children; list; list = list->next) |
|
176bce6dc803
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14910
diff
changeset
|
1035 | gnt_append_menu_action(GNT_MENU(sub), list->data, action); |
|
176bce6dc803
[gaim-migrate @ 17619]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14910
diff
changeset
|
1036 | } |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1037 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1038 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1039 | static void |
| 15884 | 1040 | append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1041 | { |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1042 | 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
|
1043 | 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
|
1044 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1045 | if(!prpl_info || !prpl_info->blist_node_menu) |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1046 | return; |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1047 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1048 | for(list = prpl_info->blist_node_menu(node); list; |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1049 | list = g_list_delete_link(list, list)) |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1050 | { |
| 15884 | 1051 | PurpleMenuAction *act = (PurpleMenuAction *) list->data; |
|
14532
c80424b94347
[gaim-migrate @ 17186]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14531
diff
changeset
|
1052 | act->data = node; |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1053 | gnt_append_menu_action(menu, act, NULL); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1054 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1055 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1056 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1057 | static void |
| 15884 | 1058 | 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
|
1059 | gpointer data) |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1060 | { |
| 15884 | 1061 | 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
|
1062 | gnt_append_menu_action(menu, action, NULL); |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1063 | g_signal_connect_swapped(G_OBJECT(menu), "destroy", |
| 15884 | 1064 | G_CALLBACK(purple_menu_action_free), action); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1065 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1066 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1067 | static void |
| 15884 | 1068 | chat_components_edit_ok(PurpleChat *chat, PurpleRequestFields *allfields) |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1069 | { |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1070 | GList *groups, *fields; |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1071 | |
| 15884 | 1072 | for (groups = purple_request_fields_get_groups(allfields); groups; groups = groups->next) { |
| 1073 | fields = purple_request_field_group_get_fields(groups->data); | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1074 | for (; fields; fields = fields->next) { |
| 15884 | 1075 | PurpleRequestField *field = fields->data; |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1076 | const char *id; |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1077 | char *val; |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1078 | |
| 15884 | 1079 | id = purple_request_field_get_id(field); |
| 1080 | if (purple_request_field_get_type(field) == PURPLE_REQUEST_FIELD_INTEGER) | |
| 1081 | 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
|
1082 | else |
| 15884 | 1083 | 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
|
1084 | |
|
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
|
1085 | 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
|
1086 | 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
|
1087 | } 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
|
1088 | 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
|
1089 | } |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1090 | } |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1091 | } |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1092 | } |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1093 | |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1094 | 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
|
1095 | chat_components_edit(PurpleBlistNode *selected, PurpleChat *chat) |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1096 | { |
| 15884 | 1097 | PurpleRequestFields *fields = purple_request_fields_new(); |
| 1098 | PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); | |
| 1099 | PurpleRequestField *field; | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1100 | GList *parts, *iter; |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1101 | 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
|
1102 | PurpleConnection *gc; |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1103 | |
| 15884 | 1104 | purple_request_fields_add_group(fields, group); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1105 | |
|
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
|
1106 | 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
|
1107 | 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
|
1108 | |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1109 | for (iter = parts; iter; iter = iter->next) { |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1110 | pce = iter->data; |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1111 | if (pce->is_int) { |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1112 | 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
|
1113 | 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
|
1114 | if (!str || sscanf(str, "%d", &val) != 1) |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1115 | val = pce->min; |
| 15884 | 1116 | 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
|
1117 | } else { |
| 15884 | 1118 | 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
|
1119 | 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
|
1120 | 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
|
1121 | purple_request_field_string_set_masked(field, TRUE); |
|
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 | |
|
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
|
1124 | 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
|
1125 | 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
|
1126 | |
| 15884 | 1127 | purple_request_field_group_add_field(group, field); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1128 | g_free(pce); |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1129 | } |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1130 | |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1131 | g_list_free(parts); |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1132 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1133 | 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
|
1134 | 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
|
1135 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1136 | chat); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1137 | } |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1138 | |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1139 | static void |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1140 | autojoin_toggled(GntMenuItem *item, gpointer data) |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1141 | { |
| 15884 | 1142 | PurpleMenuAction *action = data; |
| 1143 | 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
|
1144 | 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
|
1145 | } |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1146 | |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1147 | static void |
| 15884 | 1148 | create_chat_menu(GntMenu *menu, PurpleChat *chat) |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1149 | { |
| 15884 | 1150 | 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
|
1151 | 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
|
1152 | gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(check), |
| 15884 | 1153 | purple_blist_node_get_bool((PurpleBlistNode*)chat, "gnt-autojoin")); |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1154 | gnt_menu_add_item(menu, check); |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1155 | gnt_menuitem_set_callback(check, autojoin_toggled, action); |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1156 | g_signal_connect_swapped(G_OBJECT(menu), "destroy", |
| 15884 | 1157 | G_CALLBACK(purple_menu_action_free), action); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1158 | |
| 15884 | 1159 | 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
|
1160 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1161 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1162 | 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
|
1163 | finch_add_buddy(PurpleBlistNode *selected, PurpleGroup *grp) |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
1164 | { |
|
22342
916c989bd2c0
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22341
diff
changeset
|
1165 | 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
|
1166 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
1167 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
1168 | 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
|
1169 | finch_add_group(PurpleBlistNode *selected, PurpleGroup *grp) |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
1170 | { |
| 15884 | 1171 | purple_blist_request_add_group(); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
1172 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
1173 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
1174 | 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
|
1175 | finch_add_chat(PurpleBlistNode *selected, PurpleGroup *grp) |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1176 | { |
| 15884 | 1177 | purple_blist_request_add_chat(NULL, grp, NULL, NULL); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1178 | } |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1179 | |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1180 | static void |
| 15884 | 1181 | create_group_menu(GntMenu *menu, PurpleGroup *group) |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1182 | { |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1183 | add_custom_action(menu, _("Add Buddy"), |
| 15884 | 1184 | PURPLE_CALLBACK(finch_add_buddy), group); |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1185 | add_custom_action(menu, _("Add Chat"), |
| 15884 | 1186 | PURPLE_CALLBACK(finch_add_chat), group); |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1187 | add_custom_action(menu, _("Add Group"), |
| 15884 | 1188 | PURPLE_CALLBACK(finch_add_group), group); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1189 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1190 | |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17366
diff
changeset
|
1191 | 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
|
1192 | { |
|
4b04b2ee459a
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17295
diff
changeset
|
1193 | 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
|
1194 | gpointer uihandle; |
|
17360
4b04b2ee459a
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17295
diff
changeset
|
1195 | 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
|
1196 | 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
|
1197 | 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
|
1198 | |
|
4b04b2ee459a
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17295
diff
changeset
|
1199 | serv_get_info(conn, name); |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17366
diff
changeset
|
1200 | return uihandle; |
|
17360
4b04b2ee459a
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17295
diff
changeset
|
1201 | } |
|
4b04b2ee459a
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17295
diff
changeset
|
1202 | |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1203 | 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
|
1204 | 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
|
1205 | { |
|
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
|
1206 | 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
|
1207 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1208 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1209 | 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
|
1210 | 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
|
1211 | { |
|
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
|
1212 | 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
|
1213 | } |
|
111fdd9108cc
Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15564
diff
changeset
|
1214 | |
|
111fdd9108cc
Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15564
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_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
|
1217 | { |
| 15884 | 1218 | PurpleBuddy *b; |
| 1219 | if (PURPLE_BLIST_NODE_IS_CONTACT(node)) | |
| 1220 | 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
|
1221 | else |
| 15884 | 1222 | 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
|
1223 | 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
|
1224 | } |
|
111fdd9108cc
Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15564
diff
changeset
|
1225 | |
|
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
|
1226 | 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
|
1227 | 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
|
1228 | { |
|
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
|
1229 | 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
|
1230 | 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
|
1231 | 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
|
1232 | |
|
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
|
1233 | 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
|
1234 | 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
|
1235 | } |
|
15702
111fdd9108cc
Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15564
diff
changeset
|
1236 | |
|
111fdd9108cc
Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15564
diff
changeset
|
1237 | static void |
| 15884 | 1238 | create_buddy_menu(GntMenu *menu, PurpleBuddy *buddy) |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1239 | { |
|
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
|
1240 | 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
|
1241 | 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
|
1242 | GntMenuItem *item; |
| 15884 | 1243 | 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
|
1244 | 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
|
1245 | |
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22335
diff
changeset
|
1246 | 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
|
1247 | if (prpl_info && prpl_info->get_info) |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1248 | { |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1249 | add_custom_action(menu, _("Get Info"), |
| 15884 | 1250 | PURPLE_CALLBACK(finch_blist_get_buddy_info_cb), buddy); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1251 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1252 | |
|
15702
111fdd9108cc
Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15564
diff
changeset
|
1253 | add_custom_action(menu, _("Add Buddy Pounce"), |
| 15884 | 1254 | PURPLE_CALLBACK(finch_blist_pounce_node_cb), buddy); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1255 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1256 | if (prpl_info && prpl_info->send_file) |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1257 | { |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1258 | 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
|
1259 | 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
|
1260 | add_custom_action(menu, _("Send File"), |
| 15884 | 1261 | PURPLE_CALLBACK(finch_blist_menu_send_file_cb), buddy); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1262 | } |
|
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
|
1263 | |
|
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
|
1264 | 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
|
1265 | 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
|
1266 | |
|
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
|
1267 | 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
|
1268 | 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
|
1269 | 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
|
1270 | 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
|
1271 | |
|
15702
111fdd9108cc
Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15564
diff
changeset
|
1272 | #if 0 |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1273 | add_custom_action(tree, _("View Log"), |
| 15884 | 1274 | PURPLE_CALLBACK(finch_blist_view_log_cb)), buddy); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1275 | #endif |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1276 | |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1277 | /* Protocol actions */ |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1278 | append_proto_menu(menu, |
| 15884 | 1279 | purple_account_get_connection(purple_buddy_get_account(buddy)), |
| 1280 | (PurpleBlistNode*)buddy); | |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1281 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1282 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1283 | static void |
| 15884 | 1284 | append_extended_menu(GntMenu *menu, PurpleBlistNode *node) |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1285 | { |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1286 | GList *iter; |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1287 | |
| 15884 | 1288 | for (iter = purple_blist_node_get_extended_menu(node); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1289 | iter; iter = g_list_delete_link(iter, iter)) |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1290 | { |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1291 | gnt_append_menu_action(menu, iter->data, NULL); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1292 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1293 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1294 | |
| 15884 | 1295 | /* Xerox'd from gtkdialogs.c:purple_gtkdialogs_remove_contact_cb */ |
| 14756 | 1296 | static void |
| 15884 | 1297 | remove_contact(PurpleContact *contact) |
| 14756 | 1298 | { |
| 15884 | 1299 | PurpleBlistNode *bnode, *cnode; |
| 1300 | PurpleGroup *group; | |
| 14756 | 1301 | |
| 15884 | 1302 | cnode = (PurpleBlistNode *)contact; |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
1303 | 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
|
1304 | for (bnode = purple_blist_node_get_first_child(cnode); bnode; bnode = purple_blist_node_get_sibling_next(bnode)) { |
| 15884 | 1305 | 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
|
1306 | 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
|
1307 | 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
|
1308 | purple_account_remove_buddy(account, buddy, group); |
| 14756 | 1309 | } |
| 15884 | 1310 | purple_blist_remove_contact(contact); |
| 14756 | 1311 | } |
| 1312 | ||
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1313 | static void |
| 15884 | 1314 | rename_blist_node(PurpleBlistNode *node, const char *newname) |
|
14080
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1315 | { |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1316 | const char *name = newname; |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1317 | if (name && !*name) |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1318 | name = NULL; |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1319 | |
| 15884 | 1320 | if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
| 1321 | PurpleContact *contact = (PurpleContact*)node; | |
| 1322 | PurpleBuddy *buddy = purple_contact_get_priority_buddy(contact); | |
| 1323 | purple_blist_alias_contact(contact, name); | |
| 1324 | purple_blist_alias_buddy(buddy, name); | |
|
14537
90c314c22c8e
[gaim-migrate @ 17191]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14532
diff
changeset
|
1325 | serv_alias_buddy(buddy); |
| 15884 | 1326 | } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
| 1327 | purple_blist_alias_buddy((PurpleBuddy*)node, name); | |
| 1328 | serv_alias_buddy((PurpleBuddy*)node); | |
| 1329 | } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) | |
| 1330 | purple_blist_alias_chat((PurpleChat*)node, name); | |
| 1331 | else if (PURPLE_BLIST_NODE_IS_GROUP(node) && (name != NULL)) | |
| 1332 | purple_blist_rename_group((PurpleGroup*)node, name); | |
|
14080
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1333 | else |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1334 | g_return_if_reached(); |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1335 | } |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1336 | |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1337 | 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
|
1338 | finch_blist_rename_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node) |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1339 | { |
|
14080
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1340 | const char *name = NULL; |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1341 | 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
|
1342 | const char *text; |
|
14080
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1343 | |
| 15884 | 1344 | if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
| 1345 | name = purple_contact_get_alias((PurpleContact*)node); | |
| 1346 | else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) | |
| 1347 | name = purple_buddy_get_contact_alias((PurpleBuddy*)node); | |
| 1348 | else if (PURPLE_BLIST_NODE_IS_CHAT(node)) | |
| 1349 | name = purple_chat_get_name((PurpleChat*)node); | |
| 1350 | 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
|
1351 | name = purple_group_get_name((PurpleGroup*)node); |
|
14080
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1352 | else |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1353 | g_return_if_reached(); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1354 | |
|
14080
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1355 | 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
|
1356 | |
|
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
|
1357 | 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
|
1358 | 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
|
1359 | 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
|
1360 | _("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
|
1361 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1362 | node); |
|
14080
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1363 | |
|
7fad848bbe7b
[gaim-migrate @ 16614]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
1364 | g_free(prompt); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1365 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1366 | |
|
22376
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1367 | |
|
22491
06d2ee82aa58
Fix showing a contact's log, and don't access struct internals
Richard Nelson <wabz@pidgin.im>
parents:
22431
diff
changeset
|
1368 | 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
|
1369 | { |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1370 | PurpleLogType type; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1371 | PurpleAccount *account; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1372 | char *name = NULL; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1373 | |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1374 | 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
|
1375 | 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
|
1376 | type = PURPLE_LOG_IM; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1377 | name = g_strdup(b->name); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1378 | account = b->account; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1379 | } 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
|
1380 | 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
|
1381 | 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
|
1382 | type = PURPLE_LOG_CHAT; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1383 | account = c->account; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1384 | 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
|
1385 | if (prpl_info && prpl_info->get_chat_name) { |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1386 | name = prpl_info->get_chat_name(c->components); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1387 | } |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1388 | } 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
|
1389 | 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
|
1390 | return; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1391 | } else { |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1392 | /* 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
|
1393 | * 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
|
1394 | 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
|
1395 | } |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1396 | |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1397 | if (name && account) { |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1398 | 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
|
1399 | g_free(name); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1400 | } |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1401 | } |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1402 | |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1403 | |
| 15884 | 1404 | /* Xeroxed from gtkdialogs.c:purple_gtkdialogs_remove_group_cb*/ |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1405 | static void |
| 15884 | 1406 | remove_group(PurpleGroup *group) |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1407 | { |
| 15884 | 1408 | PurpleBlistNode *cnode, *bnode; |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1409 | |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
1410 | cnode = purple_blist_node_get_first_child(((PurpleBlistNode*)group)); |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1411 | |
|
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1412 | while (cnode) { |
| 15884 | 1413 | 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
|
1414 | 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
|
1415 | cnode = purple_blist_node_get_sibling_next(cnode); |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1416 | while (bnode) { |
| 15884 | 1417 | PurpleBuddy *buddy; |
| 1418 | 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
|
1419 | PurpleAccount *account; |
| 15884 | 1420 | buddy = (PurpleBuddy*)bnode; |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
1421 | 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
|
1422 | 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
|
1423 | 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
|
1424 | purple_account_remove_buddy(account, buddy, group); |
| 15884 | 1425 | purple_blist_remove_buddy(buddy); |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1426 | } |
|
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1427 | } else { |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
1428 | bnode = purple_blist_node_get_sibling_next(bnode); |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1429 | } |
|
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1430 | } |
| 15884 | 1431 | } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { |
| 1432 | PurpleChat *chat = (PurpleChat *)cnode; | |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
1433 | 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
|
1434 | if (purple_account_is_connected(purple_chat_get_account(chat))) |
| 15884 | 1435 | purple_blist_remove_chat(chat); |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1436 | } else { |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
1437 | cnode = purple_blist_node_get_sibling_next(cnode); |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1438 | } |
|
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1439 | } |
|
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1440 | |
| 15884 | 1441 | purple_blist_remove_group(group); |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1442 | } |
|
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1443 | |
|
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1444 | static void |
| 15884 | 1445 | finch_blist_remove_node(PurpleBlistNode *node) |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1446 | { |
| 15884 | 1447 | if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
| 1448 | remove_contact((PurpleContact*)node); | |
| 1449 | } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | |
| 1450 | PurpleBuddy *buddy = (PurpleBuddy*)node; | |
| 1451 | PurpleGroup *group = purple_buddy_get_group(buddy); | |
| 1452 | purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group); | |
| 1453 | purple_blist_remove_buddy(buddy); | |
| 1454 | } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | |
| 1455 | purple_blist_remove_chat((PurpleChat*)node); | |
| 1456 | } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { | |
| 1457 | remove_group((PurpleGroup*)node); | |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1458 | } |
|
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1459 | } |
|
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
1460 | |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1461 | 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
|
1462 | finch_blist_remove_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node) |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1463 | { |
|
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
|
1464 | PurpleAccount *account = NULL; |
|
14260
a21577fbb4d2
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
1465 | char *primary; |
|
a21577fbb4d2
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
1466 | const char *name, *sec = NULL; |
|
14126
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
1467 | |
| 15884 | 1468 | if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
| 1469 | PurpleContact *c = (PurpleContact*)node; | |
| 1470 | name = purple_contact_get_alias(c); | |
| 14756 | 1471 | if (c->totalsize > 1) |
| 1472 | 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
|
1473 | } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
| 15884 | 1474 | 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
|
1475 | 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
|
1476 | } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
| 15884 | 1477 | 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
|
1478 | } 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
|
1479 | name = purple_group_get_name((PurpleGroup*)node); |
|
14126
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
1480 | 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
|
1481 | } |
|
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
1482 | else |
|
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
1483 | return; |
|
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
1484 | |
|
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
1485 | 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
|
1486 | |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1487 | /* XXX: anything to do with the returned ui-handle? */ |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1488 | purple_request_action(node, _("Confirm Remove"), |
|
14126
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
1489 | 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
|
1490 | 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
|
1491 | account, name, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1492 | node, 2, |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1493 | _("Remove"), finch_blist_remove_node, |
|
14126
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
1494 | _("Cancel"), NULL); |
|
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
1495 | g_free(primary); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1496 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1497 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1498 | static void |
| 15884 | 1499 | finch_blist_toggle_tag_buddy(PurpleBlistNode *node) |
| 14756 | 1500 | { |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1501 | GList *iter; |
|
15377
f45f57e922a7
[gaim-migrate @ 18106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15244
diff
changeset
|
1502 | if (node == NULL) |
|
f45f57e922a7
[gaim-migrate @ 18106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15244
diff
changeset
|
1503 | return; |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1504 | 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
|
1505 | ggblist->tagged = g_list_delete_link(ggblist->tagged, iter); |
|
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1506 | } else { |
|
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1507 | ggblist->tagged = g_list_prepend(ggblist->tagged, node); |
|
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1508 | } |
| 15884 | 1509 | if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
| 1510 | node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)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
|
1511 | 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
|
1512 | 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
|
1513 | 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
|
1514 | update_node_display(node, ggblist); |
| 14756 | 1515 | } |
| 1516 | ||
| 1517 | static void | |
| 15884 | 1518 | finch_blist_place_tagged(PurpleBlistNode *target) |
| 14756 | 1519 | { |
| 15884 | 1520 | PurpleGroup *tg = NULL; |
| 1521 | PurpleContact *tc = NULL; | |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1522 | |
|
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
|
1523 | 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
|
1524 | 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
|
1525 | return; |
|
f45f57e922a7
[gaim-migrate @ 18106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15244
diff
changeset
|
1526 | |
| 15884 | 1527 | if (PURPLE_BLIST_NODE_IS_GROUP(target)) |
| 1528 | 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
|
1529 | 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
|
1530 | 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
|
1531 | 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
|
1532 | } 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
|
1533 | 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
|
1534 | tc = (PurpleContact*)target; |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
1535 | 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
|
1536 | } |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1537 | |
|
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1538 | if (ggblist->tagged) { |
|
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1539 | GList *list = ggblist->tagged; |
|
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1540 | ggblist->tagged = NULL; |
|
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1541 | while (list) { |
| 15884 | 1542 | PurpleBlistNode *node = list->data; |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1543 | 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
|
1544 | |
|
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
|
1545 | 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
|
1546 | 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
|
1547 | /* 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
|
1548 | 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
|
1549 | } 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
|
1550 | update_buddy_display(purple_contact_get_priority_buddy((PurpleContact*)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
|
1551 | if ((PurpleBlistNode*)tg == 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
|
1552 | /* The target is a group, just add the contact to the group. */ |
| 15884 | 1553 | 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
|
1554 | } 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
|
1555 | /* 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
|
1556 | 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
|
1557 | } 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
|
1558 | /* 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
|
1559 | 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
|
1560 | } |
|
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
|
1561 | } 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
|
1562 | 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
|
1563 | if ((PurpleBlistNode*)tg == 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
|
1564 | /* The target is a group. Add this buddy in a new contact under this group. */ |
| 15884 | 1565 | 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
|
1566 | } 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
|
1567 | /* 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
|
1568 | 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
|
1569 | } 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
|
1570 | /* 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
|
1571 | 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
|
1572 | } 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
|
1573 | /* 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
|
1574 | 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
|
1575 | } |
|
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 | } 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
|
1577 | 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
|
1578 | if ((PurpleBlistNode*)tg == 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
|
1579 | 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
|
1580 | 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
|
1581 | purple_blist_add_chat((PurpleChat*)node, NULL, target); |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1582 | } |
|
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1583 | } |
| 14756 | 1584 | } |
| 1585 | } | |
| 1586 | ||
| 1587 | static void | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1588 | context_menu_destroyed(GntWidget *widget, FinchBlist *ggblist) |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1589 | { |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1590 | ggblist->context = NULL; |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1591 | } |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1592 | |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1593 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1594 | draw_context_menu(FinchBlist *ggblist) |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1595 | { |
| 15884 | 1596 | PurpleBlistNode *node = NULL; |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1597 | GntWidget *context = NULL; |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1598 | GntTree *tree = NULL; |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1599 | int x, y, top, width; |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1600 | char *title = NULL; |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1601 | |
|
16869
f35dce8e5bc3
Do not build the context menu if one is already being shown.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16837
diff
changeset
|
1602 | 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
|
1603 | return; |
|
f35dce8e5bc3
Do not build the context menu if one is already being shown.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16837
diff
changeset
|
1604 | |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1605 | tree = GNT_TREE(ggblist->tree); |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1606 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1607 | 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
|
1608 | 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
|
1609 | return; |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1610 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1611 | if (ggblist->tooltip) |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1612 | remove_tooltip(ggblist); |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1613 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1614 | ggblist->cnode = node; |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1615 | |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1616 | ggblist->context = context = gnt_menu_new(GNT_MENU_POPUP); |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1617 | 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
|
1618 | 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
|
1619 | |
| 14756 | 1620 | if (!node) { |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1621 | create_group_menu(GNT_MENU(context), NULL); |
| 14756 | 1622 | title = g_strdup(_("Buddy List")); |
| 15884 | 1623 | } else if (PURPLE_BLIST_NODE_IS_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
|
1624 | ggblist->cnode = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); |
|
ed4592c036ec
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18787
diff
changeset
|
1625 | create_buddy_menu(GNT_MENU(context), (PurpleBuddy*)ggblist->cnode); |
| 15884 | 1626 | title = g_strdup(purple_contact_get_alias((PurpleContact*)node)); |
| 1627 | } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | |
| 1628 | PurpleBuddy *buddy = (PurpleBuddy *)node; | |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1629 | create_buddy_menu(GNT_MENU(context), buddy); |
| 15884 | 1630 | title = g_strdup(purple_buddy_get_name(buddy)); |
| 1631 | } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | |
| 1632 | PurpleChat *chat = (PurpleChat*)node; | |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1633 | create_chat_menu(GNT_MENU(context), chat); |
| 15884 | 1634 | title = g_strdup(purple_chat_get_name(chat)); |
| 1635 | } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { | |
| 1636 | PurpleGroup *group = (PurpleGroup *)node; | |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1637 | 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
|
1638 | title = g_strdup(purple_group_get_name(group)); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1639 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1640 | |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1641 | append_extended_menu(GNT_MENU(context), node); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1642 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1643 | /* These are common for everything */ |
| 14756 | 1644 | 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
|
1645 | 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
|
1646 | PURPLE_BLIST_NODE_IS_GROUP(node) ? _("Rename") : _("Alias"), |
| 15884 | 1647 | PURPLE_CALLBACK(finch_blist_rename_node_cb), node); |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1648 | add_custom_action(GNT_MENU(context), _("Remove"), |
| 15884 | 1649 | PURPLE_CALLBACK(finch_blist_remove_node_cb), node); |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1650 | |
| 15884 | 1651 | if (ggblist->tagged && (PURPLE_BLIST_NODE_IS_CONTACT(node) |
| 1652 | || PURPLE_BLIST_NODE_IS_GROUP(node))) { | |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1653 | add_custom_action(GNT_MENU(context), _("Place tagged"), |
| 15884 | 1654 | PURPLE_CALLBACK(finch_blist_place_tagged), node); |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1655 | } |
|
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
|
1656 | |
| 15884 | 1657 | 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
|
1658 | add_custom_action(GNT_MENU(context), _("Toggle Tag"), |
| 15884 | 1659 | PURPLE_CALLBACK(finch_blist_toggle_tag_buddy), node); |
| 14756 | 1660 | } |
|
22376
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22342
diff
changeset
|
1661 | 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
|
1662 | 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
|
1663 | 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
|
1664 | } |
| 14756 | 1665 | } |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1666 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1667 | /* Set the position for the popup */ |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1668 | gnt_widget_get_position(GNT_WIDGET(tree), &x, &y); |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1669 | gnt_widget_get_size(GNT_WIDGET(tree), &width, NULL); |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1670 | top = gnt_tree_get_selection_visible_line(tree); |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1671 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1672 | x += width; |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1673 | y += top - 1; |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1674 | |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1675 | gnt_widget_set_position(context, x, y); |
|
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1676 | gnt_screen_menu_show(GNT_MENU(context)); |
|
14021
a633de85f90e
[gaim-migrate @ 16511]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14020
diff
changeset
|
1677 | g_free(title); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1678 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1679 | |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1680 | static void |
|
18391
a51451368934
Show better tooltips for contacts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18369
diff
changeset
|
1681 | tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full) |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1682 | { |
| 15884 | 1683 | PurplePlugin *prpl; |
| 1684 | PurplePluginProtocolInfo *prpl_info; | |
| 1685 | PurpleAccount *account; | |
| 1686 | 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
|
1687 | PurplePresence *presence; |
| 15884 | 1688 | const char *alias = purple_buddy_get_alias(buddy); |
|
15207
31d9665a2a7d
[gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents:
15113
diff
changeset
|
1689 | char *tmp, *strip; |
|
31d9665a2a7d
[gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents:
15113
diff
changeset
|
1690 | |
| 15884 | 1691 | user_info = purple_notify_user_info_new(); |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1692 | |
| 15884 | 1693 | 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
|
1694 | presence = purple_buddy_get_presence(buddy); |
|
15113
956d8ac87bf6
[gaim-migrate @ 17835]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15083
diff
changeset
|
1695 | |
|
19425
07be487bc354
Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18909
diff
changeset
|
1696 | 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
|
1697 | 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
|
1698 | 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
|
1699 | g_free(esc); |
|
07be487bc354
Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18909
diff
changeset
|
1700 | } |
|
15207
31d9665a2a7d
[gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents:
15113
diff
changeset
|
1701 | |
|
31d9665a2a7d
[gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents:
15113
diff
changeset
|
1702 | tmp = g_strdup_printf("%s (%s)", |
| 15884 | 1703 | purple_account_get_username(account), |
| 1704 | purple_account_get_protocol_name(account)); | |
| 1705 | purple_notify_user_info_add_pair(user_info, _("Account"), tmp); | |
|
15207
31d9665a2a7d
[gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents:
15113
diff
changeset
|
1706 | 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
|
1707 | |
| 15884 | 1708 | prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
| 1709 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1710 | if (prpl_info && prpl_info->tooltip_text) { |
|
18391
a51451368934
Show better tooltips for contacts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18369
diff
changeset
|
1711 | prpl_info->tooltip_text(buddy, user_info, full); |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1712 | } |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1713 | |
|
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
|
1714 | if (purple_prefs_get_bool("/finch/blist/idletime")) { |
| 15884 | 1715 | PurplePresence *pre = purple_buddy_get_presence(buddy); |
| 1716 | if (purple_presence_is_idle(pre)) { | |
| 1717 | time_t idle = purple_presence_get_idle_time(pre); | |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1718 | if (idle > 0) { |
| 15884 | 1719 | char *st = purple_str_seconds_to_string(time(NULL) - idle); |
| 1720 | 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
|
1721 | g_free(st); |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1722 | } |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1723 | } |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1724 | } |
|
15207
31d9665a2a7d
[gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents:
15113
diff
changeset
|
1725 | |
| 15884 | 1726 | tmp = purple_notify_user_info_get_text_with_newline(user_info, "<BR>"); |
| 1727 | purple_notify_user_info_destroy(user_info); | |
|
15207
31d9665a2a7d
[gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents:
15113
diff
changeset
|
1728 | |
| 15884 | 1729 | strip = purple_markup_strip_html(tmp); |
|
15207
31d9665a2a7d
[gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents:
15113
diff
changeset
|
1730 | 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
|
1731 | |
|
18909
ebc3cc277277
Insert a newline in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18852
diff
changeset
|
1732 | 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
|
1733 | 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
|
1734 | g_string_append(str, _("On Mobile")); |
|
18909
ebc3cc277277
Insert a newline in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18852
diff
changeset
|
1735 | } |
|
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
|
1736 | |
|
15207
31d9665a2a7d
[gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents:
15113
diff
changeset
|
1737 | g_free(strip); |
|
31d9665a2a7d
[gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents:
15113
diff
changeset
|
1738 | g_free(tmp); |
|
14446
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1739 | } |
|
5f36f08183e8
[gaim-migrate @ 17090]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14441
diff
changeset
|
1740 | |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1741 | static GString* |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1742 | make_sure_text_fits(GString *string) |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1743 | { |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1744 | int maxw = getmaxx(stdscr) - 3; |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1745 | char *str = gnt_util_onscreen_fit_string(string->str, maxw); |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1746 | string = g_string_assign(string, str); |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1747 | g_free(str); |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1748 | return string; |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1749 | } |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1750 | |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1751 | static gboolean |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1752 | draw_tooltip_real(FinchBlist *ggblist) |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1753 | { |
| 15884 | 1754 | PurpleBlistNode *node; |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1755 | 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
|
1756 | GString *str = NULL; |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1757 | GntTree *tree; |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1758 | GntWidget *widget, *box, *tv; |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1759 | char *title = NULL; |
|
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1760 | |
|
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1761 | widget = ggblist->tree; |
|
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1762 | tree = GNT_TREE(widget); |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1763 | |
|
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
|
1764 | if (!gnt_widget_has_focus(ggblist->tree) || |
|
14981
2db0dea6fc9e
[gaim-migrate @ 17691]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14951
diff
changeset
|
1765 | (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
|
1766 | return FALSE; |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13947
diff
changeset
|
1767 | |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1768 | if (ggblist->tooltip) |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1769 | { |
|
13931
a0a91e17f899
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13927
diff
changeset
|
1770 | /* 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
|
1771 | * to avoid the blinking*/ |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1772 | remove_tooltip(ggblist); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1773 | } |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1774 | |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1775 | node = gnt_tree_get_selection_data(tree); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1776 | if (!node) |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1777 | return FALSE; |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1778 | |
|
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
|
1779 | if (!ggblist->manager->create_tooltip(node, &str, &title)) |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1780 | return FALSE; |
| 14489 | 1781 | |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1782 | gnt_widget_get_position(widget, &x, &y); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1783 | gnt_widget_get_size(widget, &width, NULL); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1784 | top = gnt_tree_get_selection_visible_line(tree); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1785 | |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1786 | x += width; |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1787 | y += top - 1; |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1788 | |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1789 | box = gnt_box_new(FALSE, FALSE); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1790 | gnt_box_set_toplevel(GNT_BOX(box), TRUE); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1791 | GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_NO_SHADOW); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1792 | gnt_box_set_title(GNT_BOX(box), title); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1793 | |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1794 | str = make_sure_text_fits(str); |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1795 | 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
|
1796 | h = MAX(1, h); |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1797 | tv = gnt_text_view_new(); |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1798 | 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
|
1799 | 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
|
1800 | gnt_box_add_widget(GNT_BOX(box), tv); |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1801 | |
|
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
|
1802 | 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
|
1803 | x -= w + width + 2; |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1804 | gnt_widget_set_position(box, x, y); |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
1805 | 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
|
1806 | GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_TRANSIENT); |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1807 | gnt_widget_draw(box); |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1808 | |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1809 | 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
|
1810 | gnt_text_view_scroll(GNT_TEXT_VIEW(tv), 0); |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1811 | |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1812 | g_free(title); |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1813 | g_string_free(str, TRUE); |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1814 | ggblist->tooltip = box; |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1815 | ggblist->tnode = node; |
|
13931
a0a91e17f899
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13927
diff
changeset
|
1816 | |
|
a0a91e17f899
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13927
diff
changeset
|
1817 | gnt_widget_set_name(ggblist->tooltip, "tooltip"); |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1818 | return FALSE; |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1819 | } |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1820 | |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1821 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1822 | draw_tooltip(FinchBlist *ggblist) |
|
14997
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1823 | { |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1824 | /* 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
|
1825 | * Drawing the tooltip after removing each buddy is expensive. On |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1826 | * 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
|
1827 | * account, then retreiving the tooltip for that causes crash. So |
|
197138c20527
[gaim-migrate @ 17707]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14981
diff
changeset
|
1828 | * 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
|
1829 | 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
|
1830 | 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
|
1831 | GINT_TO_POINTER(id), (GDestroyNotify)g_source_remove); |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1832 | } |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1833 | |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1834 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1835 | 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
|
1836 | { |
|
16837
d3b8ba967fdc
Fix context menu unusualness in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16828
diff
changeset
|
1837 | remove_peripherals(ggblist); |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1838 | draw_tooltip(ggblist); |
|
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1839 | } |
|
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1840 | |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1841 | static gboolean |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1842 | context_menu(GntWidget *widget, FinchBlist *ggblist) |
|
14896
bcc0f594ed15
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14774
diff
changeset
|
1843 | { |
|
bcc0f594ed15
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14774
diff
changeset
|
1844 | draw_context_menu(ggblist); |
|
bcc0f594ed15
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14774
diff
changeset
|
1845 | return TRUE; |
|
bcc0f594ed15
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14774
diff
changeset
|
1846 | } |
|
bcc0f594ed15
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14774
diff
changeset
|
1847 | |
|
bcc0f594ed15
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14774
diff
changeset
|
1848 | static gboolean |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1849 | key_pressed(GntWidget *widget, const char *text, FinchBlist *ggblist) |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1850 | { |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1851 | if (text[0] == 27 && text[1] == 0) { |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1852 | /* Escape was pressed */ |
|
21472
7c77d4a1921d
Cancel the typeahead search when escape is pressed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
1853 | 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
|
1854 | 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
|
1855 | remove_peripherals(ggblist); |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1856 | } else if (strcmp(text, GNT_KEY_CTRL_O) == 0) { |
| 15884 | 1857 | purple_prefs_set_bool(PREF_ROOT "/showoffline", |
| 1858 | !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
|
1859 | } 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
|
1860 | 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
|
1861 | } 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
|
1862 | if (strcmp(text, "t") == 0) { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1863 | 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
|
1864 | 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
|
1865 | } else if (strcmp(text, "a") == 0) { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1866 | 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
|
1867 | } else |
|
b3a992ff3e5f
[gaim-migrate @ 17952]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15222
diff
changeset
|
1868 | return FALSE; |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1869 | } else |
|
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1870 | return FALSE; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13946
diff
changeset
|
1871 | |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1872 | return TRUE; |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1873 | } |
|
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
1874 | |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1875 | 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
|
1876 | 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
|
1877 | { |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
1878 | 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
|
1879 | 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
|
1880 | } |
|
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
|
1881 | |
|
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
|
1882 | static void |
| 15884 | 1883 | update_buddy_display(PurpleBuddy *buddy, FinchBlist *ggblist) |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1884 | { |
| 15884 | 1885 | PurpleContact *contact; |
|
21808
2684d3deb32e
Refactor the code a little bit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21807
diff
changeset
|
1886 | |
| 15884 | 1887 | contact = purple_buddy_get_contact(buddy); |
|
14447
32f854416012
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14446
diff
changeset
|
1888 | |
| 15884 | 1889 | gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((PurpleBlistNode*)buddy)); |
| 1890 | 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
|
1891 | |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
1892 | 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
|
1893 | 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
|
1894 | blist_update_row_flags((PurpleBlistNode *)contact); |
|
15039
20a0d0117a47
[gaim-migrate @ 17756]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14997
diff
changeset
|
1895 | |
| 15884 | 1896 | if (ggblist->tnode == (PurpleBlistNode*)buddy) |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1897 | draw_tooltip(ggblist); |
|
13993
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13989
diff
changeset
|
1898 | } |
|
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13989
diff
changeset
|
1899 | |
|
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13989
diff
changeset
|
1900 | static void |
| 15884 | 1901 | 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
|
1902 | { |
|
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13989
diff
changeset
|
1903 | update_buddy_display(buddy, ggblist); |
|
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13989
diff
changeset
|
1904 | } |
|
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13989
diff
changeset
|
1905 | |
|
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13989
diff
changeset
|
1906 | static void |
| 15884 | 1907 | 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
|
1908 | { |
|
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13989
diff
changeset
|
1909 | update_buddy_display(buddy, ggblist); |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1910 | } |
|
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
1911 | |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1912 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
1913 | remove_peripherals(FinchBlist *ggblist) |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1914 | { |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1915 | if (ggblist->tooltip) |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1916 | remove_tooltip(ggblist); |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1917 | else if (ggblist->context) |
|
14905
23f31a7acc73
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14896
diff
changeset
|
1918 | gnt_widget_destroy(ggblist->context); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1919 | } |
|
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
1920 | |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1921 | static void |
| 14908 | 1922 | size_changed_cb(GntWidget *w, int wi, int h) |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1923 | { |
| 14908 | 1924 | int width, height; |
| 1925 | gnt_widget_get_size(w, &width, &height); | |
| 15884 | 1926 | purple_prefs_set_int(PREF_ROOT "/size/width", width); |
| 1927 | purple_prefs_set_int(PREF_ROOT "/size/height", height); | |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1928 | } |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1929 | |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1930 | static void |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1931 | save_position_cb(GntWidget *w, int x, int y) |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1932 | { |
| 15884 | 1933 | purple_prefs_set_int(PREF_ROOT "/position/x", x); |
| 1934 | purple_prefs_set_int(PREF_ROOT "/position/y", y); | |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1935 | } |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
1936 | |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1937 | static void |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1938 | reset_blist_window(GntWidget *window, gpointer null) |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1939 | { |
| 15884 | 1940 | PurpleBlistNode *node; |
| 1941 | 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
|
1942 | FINCH_SET_DATA(purple_get_blist(), NULL); |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1943 | |
| 15884 | 1944 | node = purple_blist_get_root(); |
|
14461
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
1945 | 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
|
1946 | reset_blist_node_ui_data(node); |
| 15884 | 1947 | node = purple_blist_node_next(node, TRUE); |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1948 | } |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1949 | |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1950 | if (ggblist->typing) |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
1951 | g_source_remove(ggblist->typing); |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1952 | remove_peripherals(ggblist); |
|
15046
e17788e5403a
[gaim-migrate @ 17763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15039
diff
changeset
|
1953 | if (ggblist->tagged) |
|
e17788e5403a
[gaim-migrate @ 17763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15039
diff
changeset
|
1954 | g_list_free(ggblist->tagged); |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1955 | g_free(ggblist); |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1956 | ggblist = NULL; |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1957 | } |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1958 | |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1959 | 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
|
1960 | populate_buddylist(void) |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1961 | { |
| 15884 | 1962 | PurpleBlistNode *node; |
| 1963 | PurpleBuddyList *list; | |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1964 | |
|
22312
dae4ed366fcb
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22303
diff
changeset
|
1965 | if (ggblist->manager->init) |
|
dae4ed366fcb
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22303
diff
changeset
|
1966 | ggblist->manager->init(); |
|
dae4ed366fcb
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22303
diff
changeset
|
1967 | |
| 15884 | 1968 | if (strcmp(purple_prefs_get_string(PREF_ROOT "/sort_type"), "text") == 0) { |
| 14774 | 1969 | gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), |
| 1970 | (GCompareFunc)blist_node_compare_text); | |
| 15884 | 1971 | } else if (strcmp(purple_prefs_get_string(PREF_ROOT "/sort_type"), "status") == 0) { |
| 14774 | 1972 | gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), |
| 1973 | (GCompareFunc)blist_node_compare_status); | |
| 15884 | 1974 | } else if (strcmp(purple_prefs_get_string(PREF_ROOT "/sort_type"), "log") == 0) { |
| 14774 | 1975 | gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), |
| 1976 | (GCompareFunc)blist_node_compare_log); | |
| 1977 | } | |
| 1978 | ||
| 15884 | 1979 | list = purple_get_blist(); |
| 1980 | node = purple_blist_get_root(); | |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1981 | while (node) |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1982 | { |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1983 | node_update(list, node); |
| 15884 | 1984 | node = purple_blist_node_next(node, FALSE); |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1985 | } |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1986 | } |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
1987 | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1988 | static void |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1989 | destroy_status_list(GList *list) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1990 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1991 | g_list_foreach(list, (GFunc)g_free, NULL); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1992 | g_list_free(list); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1993 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1994 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1995 | 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
|
1996 | populate_status_dropdown(void) |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1997 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1998 | int i; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
1999 | GList *iter; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2000 | GList *items = NULL; |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2001 | StatusBoxItem *item = NULL; |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2002 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2003 | /* First the primitives */ |
| 15884 | 2004 | PurpleStatusPrimitive prims[] = {PURPLE_STATUS_AVAILABLE, PURPLE_STATUS_AWAY, |
| 2005 | PURPLE_STATUS_INVISIBLE, PURPLE_STATUS_OFFLINE, PURPLE_STATUS_UNSET}; | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2006 | |
|
14555
0d6ef581e3ac
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14539
diff
changeset
|
2007 | gnt_combo_box_remove_all(GNT_COMBO_BOX(ggblist->status)); |
|
0d6ef581e3ac
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14539
diff
changeset
|
2008 | |
| 15884 | 2009 | for (i = 0; prims[i] != PURPLE_STATUS_UNSET; i++) |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2010 | { |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2011 | item = g_new0(StatusBoxItem, 1); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2012 | item->type = STATUS_PRIMITIVE; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2013 | item->u.prim = prims[i]; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2014 | items = g_list_prepend(items, item); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2015 | gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, |
| 15884 | 2016 | purple_primitive_get_name_from_type(prims[i])); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2017 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2018 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2019 | /* Now the popular statuses */ |
|
18851
87634d109f57
Memory leak fix.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18850
diff
changeset
|
2020 | 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
|
2021 | { |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2022 | item = g_new0(StatusBoxItem, 1); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2023 | item->type = STATUS_SAVED_POPULAR; |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2024 | item->u.saved = iter->data; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2025 | items = g_list_prepend(items, item); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2026 | gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, |
| 15884 | 2027 | purple_savedstatus_get_title(iter->data)); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2028 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2029 | |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
2030 | /* New savedstatus */ |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
2031 | item = g_new0(StatusBoxItem, 1); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
2032 | item->type = STATUS_SAVED_NEW; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
2033 | items = g_list_prepend(items, item); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
2034 | 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
|
2035 | _("New...")); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
2036 | |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2037 | /* More savedstatuses */ |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2038 | item = g_new0(StatusBoxItem, 1); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2039 | item->type = STATUS_SAVED_ALL; |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2040 | items = g_list_prepend(items, item); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2041 | 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
|
2042 | _("Saved...")); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2043 | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2044 | /* 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
|
2045 | * 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
|
2046 | * is destroyed. */ |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2047 | 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
|
2048 | items, (GDestroyNotify)destroy_status_list); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2049 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2050 | |
|
14461
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
2051 | static void |
| 15884 | 2052 | 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
|
2053 | { |
| 15884 | 2054 | PurpleBlistNode *node, *sel; |
|
22300
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2055 | FinchBlistManager *manager; |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2056 | |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2057 | if (ggblist == NULL) |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2058 | return; |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2059 | |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2060 | 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
|
2061 | if (manager == NULL) |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2062 | manager = &default_manager; |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2063 | 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
|
2064 | if (ggblist->manager->uninit) |
|
dae4ed366fcb
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22303
diff
changeset
|
2065 | ggblist->manager->uninit(); |
|
dae4ed366fcb
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22303
diff
changeset
|
2066 | |
|
22300
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2067 | ggblist->manager = manager; |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2068 | if (manager->can_add_node == NULL) |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2069 | manager->can_add_node = default_can_add_node; |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2070 | if (manager->find_parent == NULL) |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2071 | manager->find_parent = default_find_parent; |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2072 | if (manager->create_tooltip == NULL) |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2073 | manager->create_tooltip = default_create_tooltip; |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2074 | } |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2075 | |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2076 | if (ggblist->window == NULL) |
|
14461
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
2077 | return; |
|
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
2078 | |
|
14531
4beceb49b547
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14489
diff
changeset
|
2079 | 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
|
2080 | 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
|
2081 | |
| 15884 | 2082 | node = purple_blist_get_root(); |
| 2083 | 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
|
2084 | reset_blist_node_ui_data(node); |
|
14461
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
2085 | populate_buddylist(); |
|
14531
4beceb49b547
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14489
diff
changeset
|
2086 | gnt_tree_set_selected(GNT_TREE(ggblist->tree), sel); |
|
4beceb49b547
[gaim-migrate @ 17185]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14489
diff
changeset
|
2087 | draw_tooltip(ggblist); |
|
14461
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
2088 | } |
|
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
2089 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
2090 | void finch_blist_init() |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2091 | { |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21808
diff
changeset
|
2092 | 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
|
2093 | 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
|
2094 | 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
|
2095 | 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
|
2096 | 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
|
2097 | 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
|
2098 | 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
|
2099 | 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
|
2100 | 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
|
2101 | 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
|
2102 | 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
|
2103 | 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
|
2104 | |
| 15884 | 2105 | purple_prefs_add_none(PREF_ROOT); |
| 2106 | purple_prefs_add_none(PREF_ROOT "/size"); | |
| 2107 | purple_prefs_add_int(PREF_ROOT "/size/width", 20); | |
| 2108 | purple_prefs_add_int(PREF_ROOT "/size/height", 17); | |
| 2109 | purple_prefs_add_none(PREF_ROOT "/position"); | |
| 2110 | purple_prefs_add_int(PREF_ROOT "/position/x", 0); | |
| 2111 | purple_prefs_add_int(PREF_ROOT "/position/y", 0); | |
| 2112 | purple_prefs_add_bool(PREF_ROOT "/idletime", TRUE); | |
| 2113 | 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
|
2114 | purple_prefs_add_bool(PREF_ROOT "/emptygroups", FALSE); |
| 15884 | 2115 | 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
|
2116 | purple_prefs_add_string(PREF_ROOT "/grouping", "default"); |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
2117 | |
| 15884 | 2118 | 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
|
2119 | 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
|
2120 | purple_prefs_connect_callback(finch_blist_get_handle(), |
|
14461
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
2121 | PREF_ROOT "/showoffline", redraw_blist, NULL); |
| 15884 | 2122 | purple_prefs_connect_callback(finch_blist_get_handle(), |
| 14774 | 2123 | PREF_ROOT "/sort_type", redraw_blist, NULL); |
|
22300
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2124 | purple_prefs_connect_callback(finch_blist_get_handle(), |
|
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
2125 | PREF_ROOT "/grouping", redraw_blist, NULL); |
|
14461
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14458
diff
changeset
|
2126 | |
| 15884 | 2127 | 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
|
2128 | 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
|
2129 | |
|
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
|
2130 | 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
|
2131 | |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
2132 | return; |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
2133 | } |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
2134 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14104
diff
changeset
|
2135 | static gboolean |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2136 | remove_typing_cb(gpointer null) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2137 | { |
| 15884 | 2138 | PurpleSavedStatus *current; |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2139 | const char *message, *newmessage; |
| 15884 | 2140 | PurpleStatusPrimitive prim, newprim; |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2141 | StatusBoxItem *item; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2142 | |
| 15884 | 2143 | current = purple_savedstatus_get_current(); |
| 2144 | message = purple_savedstatus_get_message(current); | |
| 2145 | prim = purple_savedstatus_get_type(current); | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2146 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2147 | newmessage = gnt_entry_get_text(GNT_ENTRY(ggblist->statustext)); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2148 | 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
|
2149 | |
|
b54dafede4bd
A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16636
diff
changeset
|
2150 | switch (item->type) { |
|
b54dafede4bd
A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16636
diff
changeset
|
2151 | case STATUS_PRIMITIVE: |
|
b54dafede4bd
A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16636
diff
changeset
|
2152 | newprim = item->u.prim; |
|
b54dafede4bd
A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16636
diff
changeset
|
2153 | break; |
|
b54dafede4bd
A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16636
diff
changeset
|
2154 | case STATUS_SAVED_POPULAR: |
|
b54dafede4bd
A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16636
diff
changeset
|
2155 | 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
|
2156 | break; |
|
b54dafede4bd
A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16636
diff
changeset
|
2157 | default: |
|
b54dafede4bd
A rare crash fix for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16636
diff
changeset
|
2158 | 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
|
2159 | } |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2160 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2161 | if (newprim != prim || ((message && !newmessage) || |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2162 | (!message && newmessage) || |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2163 | (message && newmessage && g_utf8_collate(message, newmessage) != 0))) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2164 | { |
| 15884 | 2165 | 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
|
2166 | /* Holy Crap! That's a LAWNG function name */ |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2167 | if (status == NULL) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2168 | { |
| 15884 | 2169 | status = purple_savedstatus_new(NULL, newprim); |
| 2170 | purple_savedstatus_set_message(status, newmessage); | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2171 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2172 | |
| 15884 | 2173 | purple_savedstatus_activate(status); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2174 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2175 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2176 | 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
|
2177 | end: |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
2178 | if (ggblist->typing) |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
2179 | g_source_remove(ggblist->typing); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2180 | ggblist->typing = 0; |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14104
diff
changeset
|
2181 | return FALSE; |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2182 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2183 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2184 | static void |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2185 | 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
|
2186 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2187 | gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), NULL); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2188 | if (now->type == STATUS_SAVED_POPULAR) |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2189 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2190 | /* Set the status immediately */ |
| 15884 | 2191 | purple_savedstatus_activate(now->u.saved); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2192 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2193 | else if (now->type == STATUS_PRIMITIVE) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2194 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2195 | /* Move the focus to the entry box */ |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
2196 | /* 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
|
2197 | gnt_box_move_focus(GNT_BOX(ggblist->window), 1); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2198 | 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
|
2199 | } |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2200 | else if (now->type == STATUS_SAVED_ALL) |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2201 | { |
|
14193
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
2202 | /* Restore the selection to reflect current status. */ |
| 15884 | 2203 | savedstatus_changed(purple_savedstatus_get_current(), NULL); |
|
14193
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
2204 | 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
|
2205 | finch_savedstatus_show_all(); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14167
diff
changeset
|
2206 | } |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
2207 | else if (now->type == STATUS_SAVED_NEW) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
2208 | { |
| 15884 | 2209 | savedstatus_changed(purple_savedstatus_get_current(), NULL); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
2210 | 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
|
2211 | finch_savedstatus_edit(NULL); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14193
diff
changeset
|
2212 | } |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2213 | else |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2214 | g_return_if_reached(); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2215 | } |
|
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 | static gboolean |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2218 | status_text_changed(GntEntry *entry, const char *text, gpointer null) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2219 | { |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14104
diff
changeset
|
2220 | 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
|
2221 | return FALSE; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2222 | |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
2223 | if (ggblist->typing) |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
2224 | g_source_remove(ggblist->typing); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2225 | ggblist->typing = 0; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2226 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2227 | if (text[0] == '\r' && text[1] == 0) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2228 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2229 | /* Set the status only after you press 'Enter' */ |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2230 | remove_typing_cb(NULL); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2231 | return TRUE; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2232 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2233 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2234 | 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
|
2235 | return FALSE; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2236 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2237 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2238 | static void |
| 15884 | 2239 | savedstatus_changed(PurpleSavedStatus *now, PurpleSavedStatus *old) |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2240 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2241 | GList *list; |
| 15884 | 2242 | PurpleStatusPrimitive prim; |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2243 | 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
|
2244 | gboolean found = FALSE, saved = TRUE; |
|
14103
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 | if (!ggblist) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2247 | return; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2248 | |
|
14555
0d6ef581e3ac
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14539
diff
changeset
|
2249 | /* Block the signals we don't want to emit */ |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2250 | 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
|
2251 | 0, 0, NULL, status_selection_changed, NULL); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2252 | 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
|
2253 | 0, 0, NULL, status_text_changed, NULL); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2254 | |
| 15884 | 2255 | prim = purple_savedstatus_get_type(now); |
| 2256 | message = purple_savedstatus_get_message(now); | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2257 | |
|
14555
0d6ef581e3ac
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14539
diff
changeset
|
2258 | /* Rebuild the status dropdown */ |
|
0d6ef581e3ac
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14539
diff
changeset
|
2259 | populate_status_dropdown(); |
|
0d6ef581e3ac
[gaim-migrate @ 17212]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14539
diff
changeset
|
2260 | |
|
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
|
2261 | 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
|
2262 | 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
|
2263 | for (; list; list = list->next) |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2264 | { |
|
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
|
2265 | 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
|
2266 | 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
|
2267 | (!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
|
2268 | { |
| 15884 | 2269 | 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
|
2270 | 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
|
2271 | 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
|
2272 | 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
|
2273 | 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
|
2274 | 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
|
2275 | 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
|
2276 | } |
|
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
|
2277 | } |
|
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
|
2278 | if (!saved) |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2279 | 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
|
2280 | saved = FALSE; |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2281 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2282 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2283 | 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
|
2284 | 0, 0, NULL, status_selection_changed, NULL); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2285 | 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
|
2286 | 0, 0, NULL, status_text_changed, NULL); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2287 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
2288 | |
|
14167
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2289 | static int |
|
16555
9f8c3a97fb35
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
2290 | 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
|
2291 | { |
|
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
|
2292 | 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
|
2293 | if (n1 == n2) |
|
9f8c3a97fb35
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
2294 | return 1; |
|
9f8c3a97fb35
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
2295 | return -1; |
|
9f8c3a97fb35
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
2296 | } |
|
9f8c3a97fb35
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
2297 | |
|
9f8c3a97fb35
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
2298 | static int |
| 15884 | 2299 | blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2) |
|
14167
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2300 | { |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2301 | const char *s1, *s2; |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2302 | char *us1, *us2; |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2303 | 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
|
2304 | |
|
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
|
2305 | 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
|
2306 | 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
|
2307 | |
|
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
|
2308 | switch (purple_blist_node_get_type(n1)) |
|
14167
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2309 | { |
| 15884 | 2310 | case PURPLE_BLIST_CHAT_NODE: |
| 2311 | s1 = purple_chat_get_name((PurpleChat*)n1); | |
| 2312 | s2 = purple_chat_get_name((PurpleChat*)n2); | |
|
14167
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2313 | break; |
| 15884 | 2314 | case PURPLE_BLIST_BUDDY_NODE: |
| 2315 | return purple_presence_compare(purple_buddy_get_presence((PurpleBuddy*)n1), | |
| 2316 | purple_buddy_get_presence((PurpleBuddy*)n2)); | |
|
14447
32f854416012
[gaim-migrate @ 17091]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14446
diff
changeset
|
2317 | break; |
| 15884 | 2318 | case PURPLE_BLIST_CONTACT_NODE: |
| 2319 | s1 = purple_contact_get_alias((PurpleContact*)n1); | |
| 2320 | s2 = purple_contact_get_alias((PurpleContact*)n2); | |
|
14167
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2321 | break; |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2322 | default: |
|
16555
9f8c3a97fb35
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
2323 | return blist_node_compare_position(n1, n2); |
|
14167
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2324 | } |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2325 | |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2326 | us1 = g_utf8_strup(s1, -1); |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2327 | us2 = g_utf8_strup(s2, -1); |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2328 | ret = g_utf8_collate(us1, us2); |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2329 | g_free(us1); |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2330 | g_free(us2); |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2331 | |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2332 | return ret; |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2333 | } |
|
ca6027c33d2c
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14127
diff
changeset
|
2334 | |
| 14774 | 2335 | static int |
| 15884 | 2336 | blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2) |
| 14774 | 2337 | { |
| 2338 | int ret; | |
| 2339 | ||
|
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
|
2340 | 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
|
2341 | return blist_node_compare_position(n1, n2); |
| 14774 | 2342 | |
|
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
|
2343 | switch (purple_blist_node_get_type(n1)) { |
| 15884 | 2344 | case PURPLE_BLIST_CONTACT_NODE: |
| 2345 | n1 = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)n1); | |
| 2346 | n2 = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)n2); | |
| 14774 | 2347 | /* now compare the presence of the priority buddies */ |
| 15884 | 2348 | case PURPLE_BLIST_BUDDY_NODE: |
| 2349 | ret = purple_presence_compare(purple_buddy_get_presence((PurpleBuddy*)n1), | |
| 2350 | purple_buddy_get_presence((PurpleBuddy*)n2)); | |
| 14774 | 2351 | if (ret != 0) |
| 2352 | return ret; | |
| 2353 | break; | |
| 2354 | default: | |
|
16555
9f8c3a97fb35
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
2355 | return blist_node_compare_position(n1, n2); |
| 14774 | 2356 | break; |
| 2357 | } | |
| 2358 | ||
| 2359 | /* Sort alphabetically if presence is not comparable */ | |
| 2360 | ret = blist_node_compare_text(n1, n2); | |
| 2361 | ||
| 2362 | return ret; | |
| 2363 | } | |
| 2364 | ||
| 2365 | static int | |
| 15884 | 2366 | get_contact_log_size(PurpleBlistNode *c) |
| 14774 | 2367 | { |
| 2368 | int log = 0; | |
| 15884 | 2369 | PurpleBlistNode *node; |
| 14774 | 2370 | |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
2371 | for (node = purple_blist_node_get_first_child(c); node; node = purple_blist_node_get_sibling_next(node)) { |
| 15884 | 2372 | 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
|
2373 | 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
|
2374 | purple_buddy_get_account(b)); |
| 14774 | 2375 | } |
| 2376 | ||
| 2377 | return log; | |
| 2378 | } | |
| 2379 | ||
| 2380 | static int | |
| 15884 | 2381 | blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2) |
| 14774 | 2382 | { |
| 2383 | int ret; | |
| 15884 | 2384 | PurpleBuddy *b1, *b2; |
| 14774 | 2385 | |
|
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
|
2386 | 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
|
2387 | return blist_node_compare_position(n1, n2); |
| 14774 | 2388 | |
|
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
|
2389 | switch (purple_blist_node_get_type(n1)) { |
| 15884 | 2390 | case PURPLE_BLIST_BUDDY_NODE: |
| 2391 | b1 = (PurpleBuddy*)n1; | |
| 2392 | 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
|
2393 | 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
|
2394 | purple_log_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b1), purple_buddy_get_account(b1)); |
| 14774 | 2395 | if (ret != 0) |
| 2396 | return ret; | |
| 2397 | break; | |
| 15884 | 2398 | case PURPLE_BLIST_CONTACT_NODE: |
| 14774 | 2399 | ret = get_contact_log_size(n2) - get_contact_log_size(n1); |
| 2400 | if (ret != 0) | |
| 2401 | return ret; | |
| 2402 | break; | |
| 2403 | default: | |
|
16555
9f8c3a97fb35
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
2404 | return blist_node_compare_position(n1, n2); |
| 14774 | 2405 | } |
| 2406 | ret = blist_node_compare_text(n1, n2); | |
| 2407 | return ret; | |
| 2408 | } | |
| 2409 | ||
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2410 | static void |
|
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2411 | plugin_action(GntMenuItem *item, gpointer data) |
|
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2412 | { |
| 15884 | 2413 | PurplePluginAction *action = data; |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2414 | if (action && action->callback) |
|
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2415 | action->callback(action); |
|
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2416 | } |
|
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2417 | |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2418 | static void |
| 15884 | 2419 | build_plugin_actions(GntMenuItem *item, PurplePlugin *plugin, gpointer context) |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2420 | { |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2421 | GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2422 | GList *actions; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2423 | GntMenuItem *menuitem; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2424 | |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2425 | gnt_menuitem_set_submenu(item, GNT_MENU(sub)); |
| 15884 | 2426 | for (actions = PURPLE_PLUGIN_ACTIONS(plugin, context); actions; |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2427 | actions = g_list_delete_link(actions, actions)) { |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2428 | if (actions->data) { |
| 15884 | 2429 | PurplePluginAction *action = actions->data; |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2430 | action->plugin = plugin; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2431 | action->context = context; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2432 | menuitem = gnt_menuitem_new(action->label); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2433 | gnt_menu_add_item(GNT_MENU(sub), menuitem); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2434 | |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2435 | gnt_menuitem_set_callback(menuitem, plugin_action, action); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2436 | g_object_set_data_full(G_OBJECT(menuitem), "plugin_action", |
| 15884 | 2437 | action, (GDestroyNotify)purple_plugin_action_free); |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2438 | } |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2439 | } |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2440 | } |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2441 | |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2442 | static gboolean |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2443 | 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
|
2444 | { |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2445 | 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
|
2446 | 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
|
2447 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2448 | 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
|
2449 | 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
|
2450 | |
|
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
|
2451 | 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
|
2452 | 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
|
2453 | } else { |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2454 | update_node_display(node, ggblist); |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
2455 | 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
|
2456 | 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
|
2457 | } |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2458 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2459 | return FALSE; |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2460 | } |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2461 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2462 | static gboolean |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2463 | 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
|
2464 | { |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2465 | 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
|
2466 | 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
|
2467 | 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
|
2468 | return FALSE; |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2469 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2470 | 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
|
2471 | 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
|
2472 | 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
|
2473 | update_node_display(node, ggblist); |
|
22282
a964668bd7e4
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22140
diff
changeset
|
2474 | 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
|
2475 | 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
|
2476 | return FALSE; |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2477 | } |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2478 | |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2479 | static void |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2480 | 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
|
2481 | { |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2482 | 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
|
2483 | } |
|
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
2484 | |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2485 | 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
|
2486 | reconstruct_plugins_menu(void) |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2487 | { |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2488 | GntWidget *sub; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2489 | GntMenuItem *plg; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2490 | GList *iter; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2491 | |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2492 | if (!ggblist) |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2493 | return; |
|
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 | if (ggblist->plugins == NULL) |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2496 | ggblist->plugins = gnt_menuitem_new(_("Plugins")); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2497 | |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2498 | plg = ggblist->plugins; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2499 | sub = gnt_menu_new(GNT_MENU_POPUP); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2500 | gnt_menuitem_set_submenu(plg, GNT_MENU(sub)); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2501 | |
| 15884 | 2502 | for (iter = purple_plugins_get_loaded(); iter; iter = iter->next) { |
| 2503 | PurplePlugin *plugin = iter->data; | |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2504 | GntMenuItem *item; |
| 15884 | 2505 | if (PURPLE_IS_PROTOCOL_PLUGIN(plugin)) |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2506 | continue; |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2507 | |
| 15884 | 2508 | if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin)) |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2509 | continue; |
|
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 | item = gnt_menuitem_new(_(plugin->info->name)); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2512 | gnt_menu_add_item(GNT_MENU(sub), item); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2513 | build_plugin_actions(item, plugin, NULL); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2514 | } |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2515 | } |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2516 | |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2517 | 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
|
2518 | reconstruct_accounts_menu(void) |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2519 | { |
| 14774 | 2520 | GntWidget *sub; |
| 2521 | GntMenuItem *acc, *item; | |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2522 | GList *iter; |
|
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2523 | |
|
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2524 | if (!ggblist) |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2525 | return; |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2526 | |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2527 | if (ggblist->accounts == NULL) |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2528 | ggblist->accounts = gnt_menuitem_new(_("Accounts")); |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2529 | |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2530 | acc = ggblist->accounts; |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2531 | sub = gnt_menu_new(GNT_MENU_POPUP); |
| 14774 | 2532 | gnt_menuitem_set_submenu(acc, GNT_MENU(sub)); |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2533 | |
| 15884 | 2534 | for (iter = purple_accounts_get_all_active(); iter; |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2535 | iter = g_list_delete_link(iter, iter)) { |
| 15884 | 2536 | PurpleAccount *account = iter->data; |
| 2537 | PurpleConnection *gc = purple_account_get_connection(account); | |
| 2538 | 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
|
2539 | |
| 15884 | 2540 | if (!gc || !PURPLE_CONNECTION_IS_CONNECTED(gc)) |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2541 | 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
|
2542 | prpl = purple_connection_get_prpl(gc); |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2543 | |
| 15884 | 2544 | if (PURPLE_PLUGIN_HAS_ACTIONS(prpl)) { |
| 2545 | item = gnt_menuitem_new(purple_account_get_username(account)); | |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2546 | gnt_menu_add_item(GNT_MENU(sub), item); |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2547 | build_plugin_actions(item, prpl, gc); |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2548 | } |
|
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2549 | } |
| 14774 | 2550 | } |
| 2551 | ||
|
22299
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2552 | static void |
|
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2553 | 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
|
2554 | { |
|
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2555 | GList *iter; |
|
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2556 | GntWidget *subsub; |
|
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2557 | |
|
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2558 | 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
|
2559 | return; |
|
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2560 | |
|
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2561 | 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
|
2562 | 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
|
2563 | |
|
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2564 | 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
|
2565 | 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
|
2566 | 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
|
2567 | 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
|
2568 | 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
|
2569 | 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
|
2570 | 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
|
2571 | 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
|
2572 | 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
|
2573 | } |
|
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2574 | } |
|
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2575 | |
|
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
|
2576 | 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
|
2577 | auto_join_chats(gpointer data) |
|
15242
4f4b5d66f9af
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15241
diff
changeset
|
2578 | { |
| 15884 | 2579 | 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
|
2580 | 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
|
2581 | PurpleAccount *account = purple_connection_get_account(pc); |
|
15242
4f4b5d66f9af
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15241
diff
changeset
|
2582 | |
| 15884 | 2583 | for (node = purple_blist_get_root(); node; |
| 2584 | node = purple_blist_node_next(node, FALSE)) { | |
| 2585 | if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | |
| 2586 | 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
|
2587 | 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
|
2588 | 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
|
2589 | 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
|
2590 | } |
|
4f4b5d66f9af
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15241
diff
changeset
|
2591 | } |
|
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
|
2592 | 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
|
2593 | } |
|
9d5c2c048760
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19425
diff
changeset
|
2594 | |
|
9d5c2c048760
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19425
diff
changeset
|
2595 | 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
|
2596 | 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
|
2597 | { |
|
9d5c2c048760
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19425
diff
changeset
|
2598 | g_idle_add(auto_join_chats, gc); |
|
15242
4f4b5d66f9af
[gaim-migrate @ 17967]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15241
diff
changeset
|
2599 | } |
|
18626
c2d9efa0ef1a
Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18625
diff
changeset
|
2600 | |
|
c2d9efa0ef1a
Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18625
diff
changeset
|
2601 | 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
|
2602 | { |
|
18626
c2d9efa0ef1a
Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18625
diff
changeset
|
2603 | purple_prefs_set_bool(n, !purple_prefs_get_bool(n)); |
| 14774 | 2604 | } |
| 2605 | ||
| 2606 | static void sort_blist_change_cb(GntMenuItem *item, gpointer n) | |
| 2607 | { | |
| 15884 | 2608 | purple_prefs_set_string(PREF_ROOT "/sort_type", n); |
| 14774 | 2609 | } |
| 2610 | ||
|
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
|
2611 | 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
|
2612 | 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
|
2613 | { |
|
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
|
2614 | 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
|
2615 | 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
|
2616 | 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
|
2617 | 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
|
2618 | 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
|
2619 | } else { |
| 22379 | 2620 | 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
|
2621 | } |
|
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
|
2622 | } |
|
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
|
2623 | } |
|
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
|
2624 | |
|
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
|
2625 | 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
|
2626 | 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
|
2627 | { |
|
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
|
2628 | 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
|
2629 | 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
|
2630 | 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
|
2631 | |
|
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
|
2632 | 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
|
2633 | |
|
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
|
2634 | 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
|
2635 | 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
|
2636 | |
|
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
|
2637 | 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
|
2638 | 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
|
2639 | 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
|
2640 | 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
|
2641 | |
|
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
|
2642 | 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
|
2643 | 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
|
2644 | 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
|
2645 | (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
|
2646 | 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
|
2647 | 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
|
2648 | 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
|
2649 | |
|
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
|
2650 | 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
|
2651 | 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
|
2652 | 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
|
2653 | 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
|
2654 | |
|
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
|
2655 | 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
|
2656 | NULL, |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22935
diff
changeset
|
2657 | _("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
|
2658 | "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
|
2659 | 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
|
2660 | _("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
|
2661 | _("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
|
2662 | 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
|
2663 | 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
|
2664 | } |
|
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
|
2665 | |
|
18607
9b0e8be076f0
Fix a bug where buddies from offline accounts were showing up.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18400
diff
changeset
|
2666 | /* send_im_select* -- Xerox */ |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2667 | static void |
| 15884 | 2668 | send_im_select_cb(gpointer data, PurpleRequestFields *fields) |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2669 | { |
| 15884 | 2670 | PurpleAccount *account; |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2671 | 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
|
2672 | PurpleConversation *conv; |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2673 | |
| 15884 | 2674 | account = purple_request_fields_get_account(fields, "account"); |
| 2675 | username = purple_request_fields_get_string(fields, "screenname"); | |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2676 | |
|
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
|
2677 | 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
|
2678 | purple_conversation_present(conv); |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2679 | } |
|
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2680 | |
|
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2681 | static void |
|
14981
2db0dea6fc9e
[gaim-migrate @ 17691]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14951
diff
changeset
|
2682 | send_im_select(GntMenuItem *item, gpointer n) |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2683 | { |
| 15884 | 2684 | PurpleRequestFields *fields; |
| 2685 | PurpleRequestFieldGroup *group; | |
| 2686 | PurpleRequestField *field; | |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2687 | |
| 15884 | 2688 | fields = purple_request_fields_new(); |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2689 | |
| 15884 | 2690 | group = purple_request_field_group_new(NULL); |
| 2691 | purple_request_fields_add_group(fields, group); | |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2692 | |
|
20793
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2693 | field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE); |
| 15884 | 2694 | purple_request_field_set_type_hint(field, "screenname"); |
| 2695 | purple_request_field_set_required(field, TRUE); | |
| 2696 | purple_request_field_group_add_field(group, field); | |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2697 | |
|
20793
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2698 | field = purple_request_field_account_new("account", _("Account"), NULL); |
| 15884 | 2699 | purple_request_field_set_type_hint(field, "account"); |
| 2700 | purple_request_field_set_visible(field, | |
| 2701 | (purple_connections_get_all() != NULL && | |
| 2702 | purple_connections_get_all()->next != NULL)); | |
| 2703 | purple_request_field_set_required(field, TRUE); | |
| 2704 | purple_request_field_group_add_field(group, field); | |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2705 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2706 | purple_request_fields(purple_get_blist(), _("New Instant Message"), |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2707 | NULL, |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22935
diff
changeset
|
2708 | _("Please enter the username or alias of the person " |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2709 | "you would like to IM."), |
|
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2710 | fields, |
|
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2711 | _("OK"), G_CALLBACK(send_im_select_cb), |
|
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2712 | _("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
|
2713 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2714 | NULL); |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2715 | } |
|
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2716 | |
| 14774 | 2717 | static void |
|
20793
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2718 | 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
|
2719 | { |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2720 | PurpleAccount *account; |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2721 | const char *name; |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2722 | PurpleConnection *gc; |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2723 | PurpleChat *chat; |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2724 | 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
|
2725 | PurpleConversation *conv; |
|
20793
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2726 | |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2727 | 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
|
2728 | 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
|
2729 | |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2730 | 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
|
2731 | return; |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2732 | |
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22335
diff
changeset
|
2733 | 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
|
2734 | /* 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
|
2735 | * 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
|
2736 | * 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
|
2737 | 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
|
2738 | 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
|
2739 | 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
|
2740 | } 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
|
2741 | 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
|
2742 | } |
|
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
|
2743 | |
|
20793
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2744 | 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
|
2745 | 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
|
2746 | 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
|
2747 | 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
|
2748 | 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
|
2749 | } 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
|
2750 | 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
|
2751 | } |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2752 | 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
|
2753 | 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
|
2754 | 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
|
2755 | } |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2756 | |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2757 | static void |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2758 | 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
|
2759 | { |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2760 | PurpleRequestFields *fields; |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2761 | PurpleRequestFieldGroup *group; |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2762 | PurpleRequestField *field; |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2763 | |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2764 | 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
|
2765 | |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2766 | 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
|
2767 | 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
|
2768 | |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2769 | 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
|
2770 | 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
|
2771 | 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
|
2772 | |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2773 | 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
|
2774 | 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
|
2775 | 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
|
2776 | (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
|
2777 | 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
|
2778 | 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
|
2779 | 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
|
2780 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2781 | 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
|
2782 | NULL, |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2783 | _("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
|
2784 | fields, |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2785 | _("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
|
2786 | _("Cancel"), NULL, |
|
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2787 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2788 | NULL); |
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2789 | } |
|
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2790 | |
| 14774 | 2791 | static void |
|
22988
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2792 | 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
|
2793 | { |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2794 | PurpleAccount *account; |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2795 | const char *name; |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2796 | PurpleBuddy *buddy; |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2797 | PurpleContact *contact; |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2798 | |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2799 | 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
|
2800 | 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
|
2801 | |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2802 | 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
|
2803 | if (buddy) { |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2804 | 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
|
2805 | } else { |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2806 | contact = NULL; |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2807 | } |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2808 | |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2809 | if (contact) { |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2810 | 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
|
2811 | } else { |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2812 | 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
|
2813 | } |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2814 | } |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2815 | |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2816 | static void |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2817 | 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
|
2818 | { |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2819 | PurpleRequestFields *fields; |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2820 | PurpleRequestFieldGroup *group; |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2821 | PurpleRequestField *field; |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2822 | |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2823 | 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
|
2824 | |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2825 | 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
|
2826 | 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
|
2827 | |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2828 | 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
|
2829 | 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
|
2830 | 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
|
2831 | 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
|
2832 | |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2833 | 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
|
2834 | 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
|
2835 | 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
|
2836 | (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
|
2837 | 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
|
2838 | 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
|
2839 | 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
|
2840 | 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
|
2841 | |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2842 | 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
|
2843 | NULL, |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2844 | _("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
|
2845 | "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
|
2846 | fields, |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2847 | _("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
|
2848 | _("Cancel"), NULL, |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2849 | NULL, NULL, NULL, |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2850 | NULL); |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2851 | } |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2852 | |
|
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2853 | 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
|
2854 | 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
|
2855 | { |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2856 | 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
|
2857 | } |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2858 | |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2859 | 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
|
2860 | 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
|
2861 | { |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2862 | 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
|
2863 | } |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2864 | |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2865 | 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
|
2866 | 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
|
2867 | { |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2868 | 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
|
2869 | } |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2870 | |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2871 | 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
|
2872 | 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
|
2873 | { |
|
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
|
2874 | 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
|
2875 | 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
|
2876 | } |
|
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
|
2877 | |
|
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
|
2878 | 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
|
2879 | create_menu(void) |
| 14774 | 2880 | { |
|
20628
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2881 | GntWidget *menu, *sub, *subsub; |
| 14774 | 2882 | GntMenuItem *item; |
| 2883 | GntWindow *window; | |
| 2884 | ||
| 2885 | if (!ggblist) | |
| 2886 | return; | |
| 2887 | ||
| 2888 | window = GNT_WINDOW(ggblist->window); | |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2889 | ggblist->menu = menu = gnt_menu_new(GNT_MENU_TOPLEVEL); |
| 14774 | 2890 | gnt_window_set_menu(window, GNT_MENU(menu)); |
| 2891 | ||
| 2892 | item = gnt_menuitem_new(_("Options")); | |
| 2893 | gnt_menu_add_item(GNT_MENU(menu), item); | |
| 2894 | ||
| 2895 | sub = gnt_menu_new(GNT_MENU_POPUP); | |
| 2896 | gnt_menuitem_set_submenu(item, GNT_MENU(sub)); | |
| 2897 | ||
|
14951
315052c54c13
[gaim-migrate @ 17661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14945
diff
changeset
|
2898 | 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
|
2899 | 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
|
2900 | 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
|
2901 | 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
|
2902 | |
|
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
|
2903 | 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
|
2904 | 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
|
2905 | 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
|
2906 | 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
|
2907 | |
|
20793
2cf364db44c2
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20666
diff
changeset
|
2908 | 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
|
2909 | 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
|
2910 | 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
|
2911 | 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
|
2912 | |
|
22988
d311acabca71
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22986
diff
changeset
|
2913 | 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
|
2914 | 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
|
2915 | 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
|
2916 | 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
|
2917 | |
|
20628
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2918 | 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
|
2919 | 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
|
2920 | 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
|
2921 | 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
|
2922 | |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2923 | 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
|
2924 | 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
|
2925 | 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
|
2926 | 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
|
2927 | 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
|
2928 | 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
|
2929 | |
|
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 | 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
|
2931 | 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
|
2932 | gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), |
| 15884 | 2933 | 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
|
2934 | 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
|
2935 | gnt_menuitem_set_callback(GNT_MENU_ITEM(item), toggle_pref_cb, PREF_ROOT "/showoffline"); |
| 14774 | 2936 | |
|
20628
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2937 | item = gnt_menuitem_new(_("Sort")); |
| 14774 | 2938 | 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
|
2939 | 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
|
2940 | 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
|
2941 | |
|
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2942 | 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
|
2943 | 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
|
2944 | 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
|
2945 | gnt_menuitem_set_callback(GNT_MENU_ITEM(item), sort_blist_change_cb, "status"); |
| 14774 | 2946 | |
|
20684
4daaf3284863
propagate from branch 'im.pidgin.pidgin' (head b47c4fe72d16b3724a2e8fa0b9c783bc33863beb)
Gabriel Schulhof <nix@go-nix.ca>
diff
changeset
|
2947 | 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
|
2948 | 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>
diff
changeset
|
2949 | 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
|
2950 | gnt_menuitem_set_callback(GNT_MENU_ITEM(item), sort_blist_change_cb, "text"); |
| 14774 | 2951 | |
|
20691
2b0a4e2175db
Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents:
20690
diff
changeset
|
2952 | 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
|
2953 | 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
|
2954 | gnt_menu_add_item(GNT_MENU(subsub), item); |
|
2b0a4e2175db
Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents:
20690
diff
changeset
|
2955 | 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
|
2956 | |
|
2b0a4e2175db
Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents:
20690
diff
changeset
|
2957 | item = gnt_menuitem_new(_("Add")); |
| 14774 | 2958 | 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
|
2959 | |
|
20628
14b7b59970c3
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
2960 | 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
|
2961 | 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
|
2962 | |
|
22288
c6c6473ce2b9
Mark some strings for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22286
diff
changeset
|
2963 | 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
|
2964 | 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
|
2965 | 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
|
2966 | 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
|
2967 | |
|
22288
c6c6473ce2b9
Mark some strings for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22286
diff
changeset
|
2968 | 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
|
2969 | 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
|
2970 | 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
|
2971 | 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
|
2972 | |
|
22288
c6c6473ce2b9
Mark some strings for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22286
diff
changeset
|
2973 | 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
|
2974 | 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
|
2975 | 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
|
2976 | gnt_menuitem_set_callback(item, menu_add_group_cb, NULL); |
| 14774 | 2977 | |
|
22299
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
2978 | 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
|
2979 | 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
|
2980 | 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
|
2981 | |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2982 | reconstruct_accounts_menu(); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2983 | gnt_menu_add_item(GNT_MENU(menu), ggblist->accounts); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2984 | |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2985 | reconstruct_plugins_menu(); |
|
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
2986 | gnt_menu_add_item(GNT_MENU(menu), ggblist->plugins); |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2987 | } |
|
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
2988 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
2989 | void finch_blist_show() |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
2990 | { |
| 15884 | 2991 | blist_show(purple_get_blist()); |
|
14909
d72792eb7575
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14908
diff
changeset
|
2992 | } |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
2993 | |
|
14909
d72792eb7575
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14908
diff
changeset
|
2994 | static void |
|
16165
24ec117bc52c
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
2995 | 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
|
2996 | { |
| 16166 | 2997 | if (PURPLE_BLIST_NODE_IS_GROUP(node)) |
| 2998 | 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
|
2999 | } |
|
24ec117bc52c
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
3000 | |
|
24ec117bc52c
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
3001 | static void |
| 15884 | 3002 | blist_show(PurpleBuddyList *list) |
|
14909
d72792eb7575
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14908
diff
changeset
|
3003 | { |
|
d72792eb7575
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14908
diff
changeset
|
3004 | if (ggblist == NULL) |
|
d72792eb7575
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14908
diff
changeset
|
3005 | 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
|
3006 | 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
|
3007 | gnt_window_present(ggblist->window); |
|
14909
d72792eb7575
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14908
diff
changeset
|
3008 | 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
|
3009 | } |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3010 | |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
3011 | ggblist->window = gnt_vwindow_new(FALSE); |
|
13931
a0a91e17f899
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13927
diff
changeset
|
3012 | gnt_widget_set_name(ggblist->window, "buddylist"); |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
3013 | gnt_box_set_toplevel(GNT_BOX(ggblist->window), TRUE); |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3014 | 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
|
3015 | gnt_box_set_pad(GNT_BOX(ggblist->window), 0); |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3016 | |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3017 | ggblist->tree = gnt_tree_new(); |
| 14774 | 3018 | |
|
13915
15a38b312abe
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13852
diff
changeset
|
3019 | GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER); |
| 15884 | 3020 | gnt_widget_set_size(ggblist->tree, purple_prefs_get_int(PREF_ROOT "/size/width"), |
| 3021 | purple_prefs_get_int(PREF_ROOT "/size/height")); | |
| 3022 | gnt_widget_set_position(ggblist->window, purple_prefs_get_int(PREF_ROOT "/position/x"), | |
| 3023 | purple_prefs_get_int(PREF_ROOT "/position/y")); | |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3024 | |
| 14908 | 3025 | gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, |
| 15884 | 3026 | purple_prefs_get_int(PREF_ROOT "/size/width") - 1); |
| 14908 | 3027 | |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3028 | 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
|
3029 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3030 | ggblist->status = gnt_combo_box_new(); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3031 | gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->status); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3032 | ggblist->statustext = gnt_entry_new(NULL); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3033 | gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->statustext); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3034 | |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3035 | gnt_widget_show(ggblist->window); |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
3036 | |
| 15884 | 3037 | purple_signal_connect(purple_connections_get_handle(), "signed-on", finch_blist_get_handle(), |
| 3038 | PURPLE_CALLBACK(reconstruct_accounts_menu), NULL); | |
| 3039 | purple_signal_connect(purple_connections_get_handle(), "signed-off", finch_blist_get_handle(), | |
| 3040 | PURPLE_CALLBACK(reconstruct_accounts_menu), NULL); | |
| 3041 | purple_signal_connect(purple_blist_get_handle(), "buddy-status-changed", finch_blist_get_handle(), | |
| 3042 | PURPLE_CALLBACK(buddy_status_changed), ggblist); | |
| 3043 | purple_signal_connect(purple_blist_get_handle(), "buddy-idle-changed", finch_blist_get_handle(), | |
| 3044 | PURPLE_CALLBACK(buddy_idle_changed), ggblist); | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3045 | |
| 15884 | 3046 | purple_signal_connect(purple_plugins_get_handle(), "plugin-load", finch_blist_get_handle(), |
| 3047 | PURPLE_CALLBACK(reconstruct_plugins_menu), NULL); | |
| 3048 | purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", finch_blist_get_handle(), | |
| 3049 | PURPLE_CALLBACK(reconstruct_plugins_menu), NULL); | |
|
14945
4cd7dbf2933b
[gaim-migrate @ 17652]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14912
diff
changeset
|
3050 | |
|
22110
d0bd9cd65d03
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
3051 | 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
|
3052 | 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
|
3053 | 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
|
3054 | 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
|
3055 | |
|
13926
d2c1522276b3
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13923
diff
changeset
|
3056 | #if 0 |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
3057 | /* These I plan to use to indicate unread-messages etc. */ |
| 15884 | 3058 | purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", finch_blist_get_handle(), |
| 3059 | PURPLE_CALLBACK(received_im_msg), list); | |
| 3060 | purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg", finch_blist_get_handle(), | |
| 3061 | PURPLE_CALLBACK(sent_im_msg), NULL); | |
|
13919
94caf5dc02b4
[gaim-migrate @ 16316]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13915
diff
changeset
|
3062 | |
| 15884 | 3063 | purple_signal_connect(purple_conversations_get_handle(), "received-chat-msg", finch_blist_get_handle(), |
| 3064 | PURPLE_CALLBACK(received_chat_msg), list); | |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
3065 | #endif |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3066 | |
|
13922
7195a6fe2416
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13920
diff
changeset
|
3067 | 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
|
3068 | 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
|
3069 | 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
|
3070 | 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
|
3071 | 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
|
3072 | 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
|
3073 | ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); |
|
14020
d9a007b109be
[gaim-migrate @ 16510]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
3074 | 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
|
3075 | 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
|
3076 | 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
|
3077 | ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
3078 | 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
|
3079 | 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
|
3080 | 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
|
3081 | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3082 | /* Status signals */ |
| 15884 | 3083 | purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-changed", finch_blist_get_handle(), |
| 3084 | PURPLE_CALLBACK(savedstatus_changed), NULL); | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3085 | g_signal_connect(G_OBJECT(ggblist->status), "selection_changed", |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3086 | G_CALLBACK(status_selection_changed), NULL); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3087 | g_signal_connect(G_OBJECT(ggblist->statustext), "key_pressed", |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3088 | G_CALLBACK(status_text_changed), NULL); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3089 | |
| 14774 | 3090 | create_menu(); |
|
14678
97f57691faab
[gaim-migrate @ 17344]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
3091 | |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
3092 | populate_buddylist(); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
3093 | |
| 15884 | 3094 | savedstatus_changed(purple_savedstatus_get_current(), NULL); |
|
13852
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3095 | } |
|
1d3ae9f34d42
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3096 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
3097 | void finch_blist_uninit() |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
3098 | { |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
3099 | if (ggblist == NULL) |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
3100 | return; |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14082
diff
changeset
|
3101 | |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
3102 | gnt_widget_destroy(ggblist->window); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
3103 | g_free(ggblist); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
3104 | ggblist = NULL; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
3105 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
3106 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
3107 | gboolean finch_blist_get_position(int *x, int *y) |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3108 | { |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
3109 | if (!ggblist || !ggblist->window) |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
3110 | return FALSE; |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3111 | gnt_widget_get_position(ggblist->window, x, y); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
3112 | return TRUE; |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3113 | } |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
3114 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
3115 | void finch_blist_set_position(int x, int y) |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3116 | { |
|
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3117 | gnt_widget_set_position(ggblist->window, x, y); |
|
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3118 | } |
|
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3119 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
3120 | gboolean finch_blist_get_size(int *width, int *height) |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3121 | { |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
3122 | if (!ggblist || !ggblist->window) |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
3123 | return FALSE; |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3124 | gnt_widget_get_size(ggblist->window, width, height); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14280
diff
changeset
|
3125 | return TRUE; |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3126 | } |
|
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3127 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15825
diff
changeset
|
3128 | void finch_blist_set_size(int width, int height) |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3129 | { |
|
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3130 | gnt_widget_set_size(ggblist->window, width, height); |
|
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
3131 | } |
|
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
|
3132 | |
|
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
|
3133 | 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
|
3134 | { |
|
22299
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
3135 | 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
|
3136 | 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
|
3137 | reconstruct_grouping_menu(); |
|
22300
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
3138 | 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
|
3139 | 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
|
3140 | } |
|
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
|
3141 | } |
|
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
|
3142 | |
|
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
|
3143 | 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
|
3144 | { |
|
22299
e2e241477323
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22288
diff
changeset
|
3145 | 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
|
3146 | 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
|
3147 | reconstruct_grouping_menu(); |
|
22300
42f7d98ffeeb
Remember the selected grouping option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22299
diff
changeset
|
3148 | 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
|
3149 | 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
|
3150 | } |
|
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
|
3151 | } |
|
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
|
3152 | |
|
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
|
3153 | 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
|
3154 | { |
|
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
|
3155 | 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
|
3156 | 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
|
3157 | 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
|
3158 | |
|
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
|
3159 | 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
|
3160 | 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
|
3161 | 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
|
3162 | 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
|
3163 | } |
|
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
|
3164 | 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
|
3165 | } |
|
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
|
3166 | |
|
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
|
3167 | 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
|
3168 | { |
|
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
|
3169 | 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
|
3170 | } |
|
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
|
3171 |