Mercurial > pidgin
annotate finch/gntblist.c @ 27644:f24885ec506b
Set the session error after disconnecting the servconn instead of before.
The disconnect callback may try to do something that would set another
error, thus hiding the original one.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Tue, 21 Jul 2009 03:56:44 +0000 |
parents | f7c5bb2f6623 |
children | 13f555d07a3f |
rev | line source |
---|---|
15817 | 1 /** |
2 * @file gntblist.c GNT BuddyList API | |
16194
0f0832c13fcb
Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@wiktel.com>
parents:
16106
diff
changeset
|
3 * @ingroup finch |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19681
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19681
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19681
diff
changeset
|
6 /* finch |
15817 | 7 * |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15843
diff
changeset
|
8 * Finch is the legal property of its developers, whose names are too numerous |
15817 | 9 * to list here. Please refer to the COPYRIGHT file distributed with this |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19375
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15817 | 25 */ |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18071
diff
changeset
|
26 #include "finch.h" |
27587
f7c5bb2f6623
Don't include an internal header in the public finch headers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
27 #include <internal.h> |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18071
diff
changeset
|
28 |
15817 | 29 #include <account.h> |
30 #include <blist.h> | |
22248
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
31 #include <log.h> |
15817 | 32 #include <notify.h> |
22250
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
33 #include <privacy.h> |
15817 | 34 #include <request.h> |
35 #include <savedstatuses.h> | |
36 #include <server.h> | |
37 #include <signal.h> | |
38 #include <status.h> | |
39 #include <util.h> | |
40 #include "debug.h" | |
41 | |
42 #include "gntbox.h" | |
21691
3ed9b027479d
Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents:
21560
diff
changeset
|
43 #include "gntcolors.h" |
15817 | 44 #include "gntcombobox.h" |
45 #include "gntentry.h" | |
46 #include "gntft.h" | |
47 #include "gntlabel.h" | |
48 #include "gntline.h" | |
22248
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
49 #include "gntlog.h" |
15817 | 50 #include "gntmenu.h" |
51 #include "gntmenuitem.h" | |
52 #include "gntmenuitemcheck.h" | |
53 #include "gntpounce.h" | |
21691
3ed9b027479d
Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents:
21560
diff
changeset
|
54 #include "gntstyle.h" |
15817 | 55 #include "gnttree.h" |
56 #include "gntutils.h" | |
57 #include "gntwindow.h" | |
58 | |
59 #include "gntblist.h" | |
60 #include "gntconv.h" | |
61 #include "gntstatus.h" | |
62 #include <string.h> | |
63 | |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16276
diff
changeset
|
64 #define PREF_ROOT "/finch/blist" |
25592
bd18bb4915ba
*** Plucked rev 143e16e9 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25568
diff
changeset
|
65 #define TYPING_TIMEOUT_S 4 |
15817 | 66 |
24215
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
67 #define SHOW_EMPTY_GROUP_TIMEOUT 60 |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
68 |
15817 | 69 typedef struct |
70 { | |
71 GntWidget *window; | |
72 GntWidget *tree; | |
73 | |
74 GntWidget *tooltip; | |
15822 | 75 PurpleBlistNode *tnode; /* Who is the tooltip being displayed for? */ |
15817 | 76 GList *tagged; /* A list of tagged blistnodes */ |
77 | |
78 GntWidget *context; | |
15822 | 79 PurpleBlistNode *cnode; |
15817 | 80 |
81 /* XXX: I am KISSing */ | |
82 GntWidget *status; /* Dropdown with the statuses */ | |
83 GntWidget *statustext; /* Status message */ | |
84 int typing; | |
85 | |
86 GntWidget *menu; | |
87 /* These are the menuitems that get regenerated */ | |
88 GntMenuItem *accounts; | |
89 GntMenuItem *plugins; | |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
90 GntMenuItem *grouping; |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
91 |
24215
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
92 /* When a new group is manually added, it is empty, but we still want to show it |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
93 * for a while (SHOW_EMPTY_GROUP_TIMEOUT seconds) even if 'show empty groups' is |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
94 * not selected. |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
95 */ |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
96 GList *new_group; |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
97 guint new_group_timeout; |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
98 |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
99 FinchBlistManager *manager; |
15817 | 100 } FinchBlist; |
101 | |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
102 typedef struct |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
103 { |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
104 gpointer row; /* the row in the GntTree */ |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
105 guint signed_timer; /* used when 'recently' signed on/off */ |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
106 } FinchBlistNode; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
107 |
15817 | 108 typedef enum |
109 { | |
110 STATUS_PRIMITIVE = 0, | |
111 STATUS_SAVED_POPULAR, | |
112 STATUS_SAVED_ALL, | |
113 STATUS_SAVED_NEW | |
114 } StatusType; | |
115 | |
116 typedef struct | |
117 { | |
118 StatusType type; | |
119 union | |
120 { | |
15822 | 121 PurpleStatusPrimitive prim; |
122 PurpleSavedStatus *saved; | |
15817 | 123 } u; |
124 } StatusBoxItem; | |
125 | |
18584
91fdd3e4892f
We don't need dynamic things here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18565
diff
changeset
|
126 static FinchBlist *ggblist; |
15817 | 127 |
15822 | 128 static void add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist); |
129 static void add_contact(PurpleContact *contact, FinchBlist *ggblist); | |
130 static void add_group(PurpleGroup *group, FinchBlist *ggblist); | |
131 static void add_chat(PurpleChat *chat, FinchBlist *ggblist); | |
132 static void add_node(PurpleBlistNode *node, FinchBlist *ggblist); | |
18001
55a90b3fb1a1
Fix for the bug Alver reported:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17987
diff
changeset
|
133 static void node_update(PurpleBuddyList *list, PurpleBlistNode *node); |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
134 #if 0 |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
135 static gboolean is_contact_online(PurpleContact *contact); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
136 static gboolean is_group_online(PurpleGroup *group); |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
137 #endif |
15817 | 138 static void draw_tooltip(FinchBlist *ggblist); |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
139 static void tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full); |
15817 | 140 static gboolean remove_typing_cb(gpointer null); |
141 static void remove_peripherals(FinchBlist *ggblist); | |
15822 | 142 static const char * get_display_name(PurpleBlistNode *node); |
143 static void savedstatus_changed(PurpleSavedStatus *now, PurpleSavedStatus *old); | |
144 static void blist_show(PurpleBuddyList *list); | |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
145 static void update_node_display(PurpleBlistNode *buddy, FinchBlist *ggblist); |
15822 | 146 static void update_buddy_display(PurpleBuddy *buddy, FinchBlist *ggblist); |
16771
d7ad8013b914
Fix this spectacularly braindead code. I must've been on the good stuff when I wrote this. Fixes #364.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16655
diff
changeset
|
147 static void account_signed_on_cb(PurpleConnection *pc, gpointer null); |
17203
0d9fba04fc85
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:
17091
diff
changeset
|
148 static void finch_request_add_buddy(PurpleAccount *account, const char *username, const char *grp, const char *alias); |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
149 static void menu_group_set_cb(GntMenuItem *item, gpointer null); |
15817 | 150 |
151 /* Sort functions */ | |
16483
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
152 static int blist_node_compare_position(PurpleBlistNode *n1, PurpleBlistNode *n2); |
15822 | 153 static int blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2); |
154 static int blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2); | |
155 static int blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2); | |
15817 | 156 |
21691
3ed9b027479d
Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents:
21560
diff
changeset
|
157 static int color_available; |
3ed9b027479d
Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents:
21560
diff
changeset
|
158 static int color_away; |
3ed9b027479d
Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents:
21560
diff
changeset
|
159 static int color_offline; |
3ed9b027479d
Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents:
21560
diff
changeset
|
160 static int color_idle; |
3ed9b027479d
Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
Richard Nelson <wabz@pidgin.im>
parents:
21560
diff
changeset
|
161 |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
162 /** |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
163 * Buddy List Manager functions. |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
164 */ |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
165 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
166 static gboolean default_can_add_node(PurpleBlistNode *node) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
167 { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
168 gboolean offline = purple_prefs_get_bool(PREF_ROOT "/showoffline"); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
169 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
170 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
171 PurpleBuddy *buddy = (PurpleBuddy*)node; |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
172 FinchBlistNode *fnode = FINCH_GET_DATA(node); |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
173 if (!purple_buddy_get_contact(buddy)) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
174 return FALSE; /* When a new buddy is added and show-offline is set */ |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
175 if (PURPLE_BUDDY_IS_ONLINE(buddy)) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
176 return TRUE; /* The buddy is online */ |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
177 if (!purple_account_is_connected(purple_buddy_get_account(buddy))) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
178 return FALSE; /* The account is disconnected. Do not show */ |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
179 if (offline) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
180 return TRUE; /* We want to see offline buddies too */ |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
181 if (fnode && fnode->signed_timer) |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
182 return TRUE; /* Show if the buddy just signed off */ |
22192
1e103e1b845f
Pay attention to the 'show_offline' setting for the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22190
diff
changeset
|
183 if (purple_blist_node_get_bool(node, "show_offline")) |
1e103e1b845f
Pay attention to the 'show_offline' setting for the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22190
diff
changeset
|
184 return TRUE; |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
185 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
186 PurpleBlistNode *nd; |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
187 for (nd = purple_blist_node_get_first_child(node); |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
188 nd; nd = purple_blist_node_get_sibling_next(nd)) { |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
189 if (default_can_add_node(nd)) |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
190 return TRUE; |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
191 } |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
192 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
193 PurpleChat *chat = (PurpleChat*)node; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
194 if (purple_account_is_connected(purple_chat_get_account(chat))) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
195 return TRUE; /* Show whenever the account is online */ |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
196 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
197 PurpleBlistNode *nd; |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
198 gboolean empty = purple_prefs_get_bool(PREF_ROOT "/emptygroups"); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
199 if (empty) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
200 return TRUE; /* If we want to see empty groups, we can show any group */ |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
201 |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
202 for (nd = purple_blist_node_get_first_child(node); |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
203 nd; nd = purple_blist_node_get_sibling_next(nd)) { |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
204 if (default_can_add_node(nd)) |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
205 return TRUE; |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
206 } |
24215
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
207 |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
208 if (ggblist && ggblist->new_group && g_list_find(ggblist->new_group, node)) |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
209 return TRUE; |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
210 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
211 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
212 return FALSE; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
213 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
214 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
215 static gpointer default_find_parent(PurpleBlistNode *node) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
216 { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
217 gpointer ret = NULL; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
218 switch (purple_blist_node_get_type(node)) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
219 case PURPLE_BLIST_BUDDY_NODE: |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
220 case PURPLE_BLIST_CONTACT_NODE: |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
221 case PURPLE_BLIST_CHAT_NODE: |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
222 ret = purple_blist_node_get_parent(node); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
223 break; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
224 default: |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
225 break; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
226 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
227 if (ret) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
228 add_node(ret, ggblist); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
229 return ret; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
230 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
231 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
232 static gboolean default_create_tooltip(gpointer selected_row, GString **body, char **tool_title) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
233 { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
234 GString *str; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
235 PurpleBlistNode *node = selected_row; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
236 int lastseen = 0; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
237 char *title; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
238 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
239 if (!node || |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
240 purple_blist_node_get_type(node) == PURPLE_BLIST_OTHER_NODE) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
241 return FALSE; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
242 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
243 str = g_string_new(""); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
244 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
245 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
246 PurpleBuddy *pr = purple_contact_get_priority_buddy((PurpleContact*)node); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
247 gboolean offline = !PURPLE_BUDDY_IS_ONLINE(pr); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
248 gboolean showoffline = purple_prefs_get_bool(PREF_ROOT "/showoffline"); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
249 const char *name = purple_buddy_get_name(pr); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
250 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
251 title = g_strdup(name); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
252 tooltip_for_buddy(pr, str, TRUE); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
253 for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node)) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
254 PurpleBuddy *buddy = (PurpleBuddy*)node; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
255 if (offline) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
256 int value = purple_blist_node_get_int(node, "last_seen"); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
257 if (value > lastseen) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
258 lastseen = value; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
259 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
260 if (node == (PurpleBlistNode*)pr) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
261 continue; |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
262 if (!purple_account_is_connected(purple_buddy_get_account(buddy))) |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
263 continue; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
264 if (!showoffline && !PURPLE_BUDDY_IS_ONLINE(buddy)) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
265 continue; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
266 str = g_string_append(str, "\n----------\n"); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
267 tooltip_for_buddy(buddy, str, FALSE); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
268 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
269 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
270 PurpleBuddy *buddy = (PurpleBuddy *)node; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
271 tooltip_for_buddy(buddy, str, TRUE); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
272 title = g_strdup(purple_buddy_get_name(buddy)); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
273 if (!PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node)) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
274 lastseen = purple_blist_node_get_int(node, "last_seen"); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
275 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
276 PurpleGroup *group = (PurpleGroup *)node; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
277 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
278 g_string_append_printf(str, _("Online: %d\nTotal: %d"), |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
279 purple_blist_get_group_online_count(group), |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
280 purple_blist_get_group_size(group, FALSE)); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
281 |
22220
1f256f63c52c
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22219
diff
changeset
|
282 title = g_strdup(purple_group_get_name(group)); |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
283 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
284 PurpleChat *chat = (PurpleChat *)node; |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
285 PurpleAccount *account = purple_chat_get_account(chat); |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
286 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
287 g_string_append_printf(str, _("Account: %s (%s)"), |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
288 purple_account_get_username(account), |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
289 purple_account_get_protocol_name(account)); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
290 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
291 title = g_strdup(purple_chat_get_name(chat)); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
292 } else { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
293 g_string_free(str, TRUE); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
294 return FALSE; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
295 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
296 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
297 if (lastseen > 0) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
298 char *tmp = purple_str_seconds_to_string(time(NULL) - lastseen); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
299 g_string_append_printf(str, _("\nLast Seen: %s ago"), tmp); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
300 g_free(tmp); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
301 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
302 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
303 if (tool_title) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
304 *tool_title = title; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
305 else |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
306 g_free(title); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
307 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
308 if (body) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
309 *body = str; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
310 else |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
311 g_string_free(str, TRUE); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
312 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
313 return TRUE; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
314 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
315 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
316 static FinchBlistManager default_manager = |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
317 { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
318 "default", |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
319 N_("Default"), |
22190
bcaf4a037704
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22181
diff
changeset
|
320 NULL, |
bcaf4a037704
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22181
diff
changeset
|
321 NULL, |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
322 default_can_add_node, |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
323 default_find_parent, |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
324 default_create_tooltip, |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
325 {NULL, NULL, NULL, NULL} |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
326 }; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
327 static GList *managers; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
328 |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
329 static FinchBlistNode * |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
330 create_finch_blist_node(PurpleBlistNode *node, gpointer row) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
331 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
332 FinchBlistNode *fnode = FINCH_GET_DATA(node); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
333 if (!fnode) { |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
334 fnode = g_new0(FinchBlistNode, 1); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
335 fnode->signed_timer = 0; |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
336 FINCH_SET_DATA(node, fnode); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
337 } |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
338 fnode->row = row; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
339 return fnode; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
340 } |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
341 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
342 static void |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
343 reset_blist_node_ui_data(PurpleBlistNode *node) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
344 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
345 FinchBlistNode *fnode = FINCH_GET_DATA(node); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
346 if (fnode == NULL) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
347 return; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
348 if (fnode->signed_timer) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
349 purple_timeout_remove(fnode->signed_timer); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
350 g_free(fnode); |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
351 FINCH_SET_DATA(node, NULL); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
352 } |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
353 |
21695
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
354 static int |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
355 get_display_color(PurpleBlistNode *node) |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
356 { |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
357 PurpleBuddy *buddy; |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
358 int color = 0; |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
359 |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
360 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
361 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); |
21695
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
362 if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
363 return 0; |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
364 |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
365 buddy = (PurpleBuddy*)node; |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
366 if (purple_presence_is_idle(purple_buddy_get_presence(buddy))) { |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
367 color = color_idle; |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
368 } else if (purple_presence_is_available(purple_buddy_get_presence(buddy))) { |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
369 color = color_available; |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
370 } else if (purple_presence_is_online(purple_buddy_get_presence(buddy)) && |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
371 !purple_presence_is_available(purple_buddy_get_presence(buddy))) { |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
372 color = color_away; |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
373 } else if (!purple_presence_is_online(purple_buddy_get_presence(buddy))) { |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
374 color = color_offline; |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
375 } |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
376 |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
377 return color; |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
378 } |
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
379 |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
380 static GntTextFormatFlags |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
381 get_blist_node_flag(PurpleBlistNode *node) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
382 { |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
383 GntTextFormatFlags flag = 0; |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
384 FinchBlistNode *fnode = FINCH_GET_DATA(node); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
385 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
386 if (ggblist->tagged && g_list_find(ggblist->tagged, node)) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
387 flag |= GNT_TEXT_FLAG_BOLD; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
388 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
389 if (fnode && fnode->signed_timer) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
390 flag |= GNT_TEXT_FLAG_BLINK; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
391 else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
392 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
393 fnode = FINCH_GET_DATA(node); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
394 if (fnode && fnode->signed_timer) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
395 flag |= GNT_TEXT_FLAG_BLINK; |
22786
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
396 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
397 /* If the node is collapsed, then check to see if any of the priority buddies of |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
398 * any of the contacts within this group recently signed on/off, and set the blink |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
399 * flag appropriately. */ |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
400 /* XXX: Refs #5444 */ |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
401 /* XXX: there's no way I can ask if the node is expanded or not? *sigh* |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
402 * API addition would be necessary */ |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
403 #if 0 |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
404 if (!gnt_tree_get_expanded(GNT_TREE(ggblist->tree), node)) { |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
405 for (node = purple_blist_node_get_first_child(node); node; |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
406 node = purple_blist_node_get_sibling_next(node)) { |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
407 PurpleBlistNode *pnode; |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
408 pnode = purple_contact_get_priority_buddy((PurpleContact*)node); |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
409 fnode = FINCH_GET_DATA(node); |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
410 if (fnode && fnode->signed_timer) { |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
411 flag |= GNT_TEXT_FLAG_BLINK; |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
412 break; |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
413 } |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
414 } |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
415 } |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
416 #endif |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
417 } |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
418 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
419 return flag; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
420 } |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
421 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
422 static void |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
423 blist_update_row_flags(PurpleBlistNode *node) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
424 { |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
425 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), node, get_blist_node_flag(node)); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
426 gnt_tree_set_row_color(GNT_TREE(ggblist->tree), node, get_display_color(node)); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
427 } |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
428 |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
429 #if 0 |
15817 | 430 static gboolean |
15822 | 431 is_contact_online(PurpleContact *contact) |
15817 | 432 { |
15822 | 433 PurpleBlistNode *node; |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
434 for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)contact)); node; |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
435 node = purple_blist_node_get_sibling_next(node)) { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
436 FinchBlistNode *fnode = FINCH_GET_DATA(node); |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
437 if (PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node) || |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
438 (fnode && fnode->signed_timer)) |
15817 | 439 return TRUE; |
440 } | |
441 return FALSE; | |
442 } | |
443 | |
444 static gboolean | |
15822 | 445 is_group_online(PurpleGroup *group) |
15817 | 446 { |
15822 | 447 PurpleBlistNode *node; |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
448 for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)group)); node; |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
449 node = purple_blist_node_get_sibling_next(node)) { |
18490
095718d51209
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:
18442
diff
changeset
|
450 if (PURPLE_BLIST_NODE_IS_CHAT(node) && |
095718d51209
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:
18442
diff
changeset
|
451 purple_account_is_connected(((PurpleChat *)node)->account)) |
15817 | 452 return TRUE; |
15822 | 453 else if (is_contact_online((PurpleContact*)node)) |
15817 | 454 return TRUE; |
455 } | |
456 return FALSE; | |
457 } | |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
458 #endif |
15817 | 459 |
460 static void | |
15822 | 461 new_node(PurpleBlistNode *node) |
15817 | 462 { |
463 } | |
464 | |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
465 static void |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
466 add_node(PurpleBlistNode *node, FinchBlist *ggblist) |
15817 | 467 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
468 if (FINCH_GET_DATA(node)) |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
469 return; |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
470 |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
471 if (!ggblist->manager->can_add_node(node)) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
472 return; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
473 |
15822 | 474 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
475 add_buddy((PurpleBuddy*)node, ggblist); | |
476 else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) | |
477 add_contact((PurpleContact*)node, ggblist); | |
478 else if (PURPLE_BLIST_NODE_IS_GROUP(node)) | |
479 add_group((PurpleGroup*)node, ggblist); | |
480 else if (PURPLE_BLIST_NODE_IS_CHAT(node)) | |
481 add_chat((PurpleChat *)node, ggblist); | |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
482 |
15817 | 483 draw_tooltip(ggblist); |
484 } | |
485 | |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
486 void finch_blist_manager_add_node(PurpleBlistNode *node) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
487 { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
488 add_node(node, ggblist); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
489 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
490 |
15817 | 491 static void |
492 remove_tooltip(FinchBlist *ggblist) | |
493 { | |
494 gnt_widget_destroy(ggblist->tooltip); | |
495 ggblist->tooltip = NULL; | |
496 ggblist->tnode = NULL; | |
497 } | |
498 | |
499 static void | |
15822 | 500 node_remove(PurpleBuddyList *list, PurpleBlistNode *node) |
15817 | 501 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
502 FinchBlist *ggblist = FINCH_GET_DATA(list); |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
503 PurpleBlistNode *parent; |
15817 | 504 |
24215
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
505 if (ggblist == NULL || FINCH_GET_DATA(node) == NULL) |
15817 | 506 return; |
507 | |
24215
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
508 if (PURPLE_BLIST_NODE_IS_GROUP(node) && ggblist->new_group) { |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
509 ggblist->new_group = g_list_remove(ggblist->new_group, node); |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
510 } |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
511 |
15817 | 512 gnt_tree_remove(GNT_TREE(ggblist->tree), node); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
513 reset_blist_node_ui_data(node); |
15817 | 514 if (ggblist->tagged) |
515 ggblist->tagged = g_list_remove(ggblist->tagged, node); | |
516 | |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
517 parent = purple_blist_node_get_parent(node); |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
518 for (node = purple_blist_node_get_first_child(node); node; |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
519 node = purple_blist_node_get_sibling_next(node)) |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
520 node_remove(list, node); |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
521 |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
522 if (parent) { |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
523 if (!ggblist->manager->can_add_node(parent)) |
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
524 node_remove(list, parent); |
18001
55a90b3fb1a1
Fix for the bug Alver reported:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17987
diff
changeset
|
525 else |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
526 node_update(list, parent); |
15817 | 527 } |
528 | |
529 draw_tooltip(ggblist); | |
530 } | |
531 | |
532 static void | |
15822 | 533 node_update(PurpleBuddyList *list, PurpleBlistNode *node) |
15817 | 534 { |
535 /* It really looks like this should never happen ... but it does. | |
536 This will at least emit a warning to the log when it | |
537 happens, so maybe someone will figure it out. */ | |
538 g_return_if_fail(node != NULL); | |
539 | |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
540 if (FINCH_GET_DATA(list)== NULL) |
15817 | 541 return; /* XXX: this is probably the place to auto-join chats */ |
542 | |
17987
1b6db70bdab2
Fix a crash exposed by nullprpl.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
543 if (ggblist->window == NULL) |
1b6db70bdab2
Fix a crash exposed by nullprpl.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
544 return; |
1b6db70bdab2
Fix a crash exposed by nullprpl.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
545 |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
546 if (FINCH_GET_DATA(node)!= NULL) { |
15817 | 547 gnt_tree_change_text(GNT_TREE(ggblist->tree), node, |
548 0, get_display_name(node)); | |
549 gnt_tree_sort_row(GNT_TREE(ggblist->tree), node); | |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
550 blist_update_row_flags(node); |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
551 if (gnt_tree_get_parent_key(GNT_TREE(ggblist->tree), node) != |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
552 ggblist->manager->find_parent(node)) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
553 node_remove(list, node); |
15817 | 554 } |
555 | |
15822 | 556 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
557 PurpleBuddy *buddy = (PurpleBuddy*)node; | |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
558 add_node((PurpleBlistNode*)buddy, FINCH_GET_DATA(list)); |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
559 node_update(list, purple_blist_node_get_parent(node)); |
15822 | 560 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
561 add_node(node, FINCH_GET_DATA(list)); |
15822 | 562 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
563 if (FINCH_GET_DATA(node)== NULL) { |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
564 /* The core seems to expect the UI to add the buddies. */ |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
565 for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node)) |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
566 add_node(node, FINCH_GET_DATA(list)); |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
567 } |
15822 | 568 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
569 if (!ggblist->manager->can_add_node(node)) |
15817 | 570 node_remove(list, node); |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
571 else |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
572 add_node(node, FINCH_GET_DATA(list)); |
15817 | 573 } |
24001
e7d85f4fb3fc
Update the tooltip if the status of the selected node changes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23342
diff
changeset
|
574 if (ggblist->tnode == node) { |
e7d85f4fb3fc
Update the tooltip if the status of the selected node changes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23342
diff
changeset
|
575 draw_tooltip(ggblist); |
e7d85f4fb3fc
Update the tooltip if the status of the selected node changes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23342
diff
changeset
|
576 } |
15817 | 577 } |
578 | |
579 static void | |
15822 | 580 new_list(PurpleBuddyList *list) |
15817 | 581 { |
582 if (ggblist) | |
583 return; | |
584 | |
585 ggblist = g_new0(FinchBlist, 1); | |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
586 FINCH_SET_DATA(list, ggblist); |
22178
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
587 ggblist->manager = finch_blist_manager_find(purple_prefs_get_string(PREF_ROOT "/grouping")); |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
588 if (!ggblist->manager) |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
589 ggblist->manager = &default_manager; |
15817 | 590 } |
591 | |
24215
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
592 static gboolean |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
593 remove_new_empty_group(gpointer data) |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
594 { |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
595 PurpleBuddyList *list; |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
596 |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
597 if (!ggblist) |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
598 return FALSE; |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
599 |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
600 list = purple_get_blist(); |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
601 g_return_val_if_fail(list, FALSE); |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
602 |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
603 ggblist->new_group_timeout = 0; |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
604 while (ggblist->new_group) { |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
605 PurpleBlistNode *group = ggblist->new_group->data; |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
606 ggblist->new_group = g_list_delete_link(ggblist->new_group, ggblist->new_group); |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
607 node_update(list, group); |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
608 } |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
609 |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
610 return FALSE; |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
611 } |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
612 |
15817 | 613 static void |
15822 | 614 add_buddy_cb(void *data, PurpleRequestFields *allfields) |
15817 | 615 { |
15822 | 616 const char *username = purple_request_fields_get_string(allfields, "screenname"); |
617 const char *alias = purple_request_fields_get_string(allfields, "alias"); | |
618 const char *group = purple_request_fields_get_string(allfields, "group"); | |
619 PurpleAccount *account = purple_request_fields_get_account(allfields, "account"); | |
15817 | 620 const char *error = NULL; |
15822 | 621 PurpleGroup *grp; |
622 PurpleBuddy *buddy; | |
15817 | 623 |
624 if (!username) | |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22786
diff
changeset
|
625 error = _("You must provide a username for the buddy."); |
15817 | 626 else if (!group) |
627 error = _("You must provide a group."); | |
628 else if (!account) | |
629 error = _("You must select an account."); | |
16926
7e4a22162bb6
Show an error message when trying to add a buddy from an offline account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16925
diff
changeset
|
630 else if (!purple_account_is_connected(account)) |
7e4a22162bb6
Show an error message when trying to add a buddy from an offline account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16925
diff
changeset
|
631 error = _("The selected account is not online."); |
15817 | 632 |
633 if (error) | |
634 { | |
17203
0d9fba04fc85
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:
17091
diff
changeset
|
635 finch_request_add_buddy(account, username, group, alias); |
15822 | 636 purple_notify_error(NULL, _("Error"), _("Error adding buddy"), error); |
15817 | 637 return; |
638 } | |
639 | |
15822 | 640 grp = purple_find_group(group); |
15817 | 641 if (!grp) |
642 { | |
15822 | 643 grp = purple_group_new(group); |
644 purple_blist_add_group(grp, NULL); | |
15817 | 645 } |
646 | |
25172
125cac3e24ee
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <paul@darkrain42.org>
parents:
24537
diff
changeset
|
647 /* XXX: Ask to merge if there's already a buddy with the same alias in the same group (#4553) */ |
125cac3e24ee
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <paul@darkrain42.org>
parents:
24537
diff
changeset
|
648 |
125cac3e24ee
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <paul@darkrain42.org>
parents:
24537
diff
changeset
|
649 if ((buddy = purple_find_buddy_in_group(account, username, grp)) == NULL) |
125cac3e24ee
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <paul@darkrain42.org>
parents:
24537
diff
changeset
|
650 { |
125cac3e24ee
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <paul@darkrain42.org>
parents:
24537
diff
changeset
|
651 buddy = purple_buddy_new(account, username, alias); |
125cac3e24ee
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <paul@darkrain42.org>
parents:
24537
diff
changeset
|
652 purple_blist_add_buddy(buddy, NULL, grp, NULL); |
125cac3e24ee
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <paul@darkrain42.org>
parents:
24537
diff
changeset
|
653 } |
125cac3e24ee
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <paul@darkrain42.org>
parents:
24537
diff
changeset
|
654 |
15822 | 655 purple_account_add_buddy(account, buddy); |
15817 | 656 } |
657 | |
658 static void | |
15822 | 659 finch_request_add_buddy(PurpleAccount *account, const char *username, const char *grp, const char *alias) |
15817 | 660 { |
15822 | 661 PurpleRequestFields *fields = purple_request_fields_new(); |
662 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); | |
663 PurpleRequestField *field; | |
15817 | 664 |
15822 | 665 purple_request_fields_add_group(fields, group); |
15817 | 666 |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22786
diff
changeset
|
667 field = purple_request_field_string_new("screenname", _("Username"), username, FALSE); |
15822 | 668 purple_request_field_group_add_field(group, field); |
15817 | 669 |
22307
d270b6aebabc
Right-clicking on a widget should trigger the context-menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22251
diff
changeset
|
670 field = purple_request_field_string_new("alias", _("Alias (optional)"), alias, FALSE); |
15822 | 671 purple_request_field_group_add_field(group, field); |
15817 | 672 |
22307
d270b6aebabc
Right-clicking on a widget should trigger the context-menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22251
diff
changeset
|
673 field = purple_request_field_string_new("group", _("Add in group"), grp, FALSE); |
15822 | 674 purple_request_field_group_add_field(group, field); |
15843
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15822
diff
changeset
|
675 purple_request_field_set_type_hint(field, "group"); |
15817 | 676 |
15822 | 677 field = purple_request_field_account_new("account", _("Account"), NULL); |
678 purple_request_field_account_set_show_all(field, FALSE); | |
15817 | 679 if (account) |
15822 | 680 purple_request_field_account_set_value(field, account); |
681 purple_request_field_group_add_field(group, field); | |
15817 | 682 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
683 purple_request_fields(NULL, _("Add Buddy"), NULL, _("Please enter buddy information."), |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
684 fields, |
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
685 _("Add"), G_CALLBACK(add_buddy_cb), |
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
686 _("Cancel"), NULL, |
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
687 account, NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
688 NULL); |
15817 | 689 } |
690 | |
691 static void | |
22838
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
692 join_chat(PurpleChat *chat) |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
693 { |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
694 PurpleAccount *account = purple_chat_get_account(chat); |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
695 const char *name; |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
696 PurpleConversation *conv; |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
697 const char *alias; |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
698 |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
699 /* This hack here is to work around the fact that there's no good way of |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
700 * getting the actual name of a chat. I don't understand why we return |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
701 * the alias for a chat when all we want is the name. */ |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
702 alias = chat->alias; |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
703 chat->alias = NULL; |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
704 name = purple_chat_get_name(chat); |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
705 conv = purple_find_conversation_with_account( |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
706 PURPLE_CONV_TYPE_CHAT, name, account); |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
707 chat->alias = (char *)alias; |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
708 |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
709 if (!conv || purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
710 serv_join_chat(purple_account_get_connection(account), |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
711 purple_chat_get_components(chat)); |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
712 } else if (conv) { |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
713 purple_conversation_present(conv); |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
714 } |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
715 } |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
716 |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
717 static void |
15822 | 718 add_chat_cb(void *data, PurpleRequestFields *allfields) |
15817 | 719 { |
15822 | 720 PurpleAccount *account; |
15817 | 721 const char *alias, *name, *group; |
15822 | 722 PurpleChat *chat; |
723 PurpleGroup *grp; | |
15817 | 724 GHashTable *hash = NULL; |
15822 | 725 PurpleConnection *gc; |
18586
4fda1fc6d7cf
Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18585
diff
changeset
|
726 gboolean autojoin; |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
727 PurplePluginProtocolInfo *info; |
15817 | 728 |
15822 | 729 account = purple_request_fields_get_account(allfields, "account"); |
730 name = purple_request_fields_get_string(allfields, "name"); | |
731 alias = purple_request_fields_get_string(allfields, "alias"); | |
732 group = purple_request_fields_get_string(allfields, "group"); | |
18586
4fda1fc6d7cf
Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18585
diff
changeset
|
733 autojoin = purple_request_fields_get_bool(allfields, "autojoin"); |
15817 | 734 |
15822 | 735 if (!purple_account_is_connected(account) || !name || !*name) |
15817 | 736 return; |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
737 |
15817 | 738 if (!group || !*group) |
739 group = _("Chats"); | |
740 | |
15822 | 741 gc = purple_account_get_connection(account); |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
742 info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
743 if (info->chat_info_defaults != NULL) |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
744 hash = info->chat_info_defaults(gc, name); |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
745 |
15822 | 746 chat = purple_chat_new(account, name, hash); |
15817 | 747 |
748 if (chat != NULL) { | |
15822 | 749 if ((grp = purple_find_group(group)) == NULL) { |
750 grp = purple_group_new(group); | |
751 purple_blist_add_group(grp, NULL); | |
15817 | 752 } |
15822 | 753 purple_blist_add_chat(chat, grp, NULL); |
754 purple_blist_alias_chat(chat, alias); | |
18586
4fda1fc6d7cf
Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18585
diff
changeset
|
755 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gnt-autojoin", autojoin); |
22838
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
756 if (autojoin) { |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
757 join_chat(chat); |
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
758 } |
15817 | 759 } |
760 } | |
761 | |
762 static void | |
15822 | 763 finch_request_add_chat(PurpleAccount *account, PurpleGroup *grp, const char *alias, const char *name) |
15817 | 764 { |
15822 | 765 PurpleRequestFields *fields = purple_request_fields_new(); |
766 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); | |
767 PurpleRequestField *field; | |
15817 | 768 |
15822 | 769 purple_request_fields_add_group(fields, group); |
15817 | 770 |
15822 | 771 field = purple_request_field_account_new("account", _("Account"), NULL); |
772 purple_request_field_account_set_show_all(field, FALSE); | |
15817 | 773 if (account) |
15822 | 774 purple_request_field_account_set_value(field, account); |
775 purple_request_field_group_add_field(group, field); | |
15817 | 776 |
15822 | 777 field = purple_request_field_string_new("name", _("Name"), name, FALSE); |
778 purple_request_field_group_add_field(group, field); | |
15817 | 779 |
15822 | 780 field = purple_request_field_string_new("alias", _("Alias"), alias, FALSE); |
781 purple_request_field_group_add_field(group, field); | |
15817 | 782 |
22220
1f256f63c52c
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22219
diff
changeset
|
783 field = purple_request_field_string_new("group", _("Group"), grp ? purple_group_get_name(grp) : NULL, FALSE); |
15822 | 784 purple_request_field_group_add_field(group, field); |
22836
08befc594de4
Setup tab-completion for groups in the 'Add Chat' dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
785 purple_request_field_set_type_hint(field, "group"); |
15817 | 786 |
18586
4fda1fc6d7cf
Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18585
diff
changeset
|
787 field = purple_request_field_bool_new("autojoin", _("Auto-join"), FALSE); |
4fda1fc6d7cf
Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18585
diff
changeset
|
788 purple_request_field_group_add_field(group, field); |
4fda1fc6d7cf
Add an 'auto-join' checkbox in the 'Add Chat' dialog, thanks to fmoo's
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18585
diff
changeset
|
789 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
790 purple_request_fields(NULL, _("Add Chat"), NULL, |
15817 | 791 _("You can edit more information from the context menu later."), |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
792 fields, _("Add"), G_CALLBACK(add_chat_cb), _("Cancel"), NULL, |
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
793 NULL, NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
794 NULL); |
15817 | 795 } |
796 | |
797 static void | |
798 add_group_cb(gpointer null, const char *group) | |
799 { | |
15822 | 800 PurpleGroup *grp; |
15817 | 801 |
24238
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
802 if (!group || !*group) { |
15822 | 803 purple_notify_error(NULL, _("Error"), _("Error adding group"), |
15817 | 804 _("You must give a name for the group to add.")); |
805 return; | |
806 } | |
807 | |
15822 | 808 grp = purple_find_group(group); |
24238
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
809 if (!grp) { |
15822 | 810 grp = purple_group_new(group); |
811 purple_blist_add_group(grp, NULL); | |
15817 | 812 } |
24238
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
813 |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
814 if (!ggblist) |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
815 return; |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
816 |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
817 /* Treat the group as a new group even if it had existed before. This should |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
818 * make things easier to add buddies to empty groups (new or old) without having |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
819 * to turn on 'show empty groups' setting */ |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
820 ggblist->new_group = g_list_prepend(ggblist->new_group, grp); |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
821 if (ggblist->new_group_timeout) |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
822 purple_timeout_remove(ggblist->new_group_timeout); |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
823 ggblist->new_group_timeout = purple_timeout_add_seconds(SHOW_EMPTY_GROUP_TIMEOUT, |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
824 remove_new_empty_group, NULL); |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
825 |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
826 /* Select the group */ |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
827 if (ggblist->tree) { |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
828 FinchBlistNode *fnode = FINCH_GET_DATA((PurpleBlistNode*)grp); |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
829 if (!fnode) |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
830 add_node((PurpleBlistNode*)grp, ggblist); |
c8ed49367d86
Instead of showing error message when trying to interactively add an
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24215
diff
changeset
|
831 gnt_tree_set_selected(GNT_TREE(ggblist->tree), grp); |
15817 | 832 } |
833 } | |
834 | |
835 static void | |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21738
diff
changeset
|
836 finch_request_add_group(void) |
15817 | 837 { |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
838 purple_request_input(NULL, _("Add Group"), NULL, _("Enter the name of the group"), |
15817 | 839 NULL, FALSE, FALSE, NULL, |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
840 _("Add"), G_CALLBACK(add_group_cb), _("Cancel"), NULL, |
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
841 NULL, NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
842 NULL); |
15817 | 843 } |
844 | |
15822 | 845 static PurpleBlistUiOps blist_ui_ops = |
15817 | 846 { |
847 new_list, | |
848 new_node, | |
849 blist_show, | |
850 node_update, | |
851 node_remove, | |
852 NULL, | |
853 NULL, | |
17091
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16958
diff
changeset
|
854 finch_request_add_buddy, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16958
diff
changeset
|
855 finch_request_add_chat, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16958
diff
changeset
|
856 finch_request_add_group, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16958
diff
changeset
|
857 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16958
diff
changeset
|
858 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16958
diff
changeset
|
859 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16958
diff
changeset
|
860 NULL |
15817 | 861 }; |
862 | |
863 static gpointer | |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21738
diff
changeset
|
864 finch_blist_get_handle(void) |
15817 | 865 { |
866 static int handle; | |
867 | |
868 return &handle; | |
869 } | |
870 | |
871 static void | |
15822 | 872 add_group(PurpleGroup *group, FinchBlist *ggblist) |
15817 | 873 { |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
874 gpointer parent; |
15822 | 875 PurpleBlistNode *node = (PurpleBlistNode *)group; |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
876 if (FINCH_GET_DATA(node)) |
15817 | 877 return; |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
878 parent = ggblist->manager->find_parent((PurpleBlistNode*)group); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
879 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
880 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
881 parent, NULL)); |
16105
1983ecd15174
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15928
diff
changeset
|
882 gnt_tree_set_expanded(GNT_TREE(ggblist->tree), node, |
1983ecd15174
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15928
diff
changeset
|
883 !purple_blist_node_get_bool(node, "collapsed")); |
15817 | 884 } |
885 | |
886 static const char * | |
15822 | 887 get_display_name(PurpleBlistNode *node) |
15817 | 888 { |
889 static char text[2096]; | |
890 char status[8] = " "; | |
891 const char *name = NULL; | |
892 | |
15822 | 893 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
894 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); /* XXX: this can return NULL?! */ |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
895 |
15817 | 896 if (node == NULL) |
897 return NULL; | |
898 | |
15822 | 899 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
15817 | 900 { |
15822 | 901 PurpleBuddy *buddy = (PurpleBuddy *)node; |
902 PurpleStatusPrimitive prim; | |
903 PurplePresence *presence; | |
904 PurpleStatus *now; | |
15817 | 905 gboolean ascii = gnt_ascii_only(); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
906 |
15822 | 907 presence = purple_buddy_get_presence(buddy); |
18437
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
908 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE)) |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
909 strncpy(status, ascii ? ":" : "☎", sizeof(status) - 1); |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
910 else { |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
911 now = purple_presence_get_active_status(presence); |
15817 | 912 |
18437
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
913 prim = purple_status_type_get_primitive(purple_status_get_type(now)); |
15817 | 914 |
18437
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
915 switch(prim) { |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
916 case PURPLE_STATUS_OFFLINE: |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
917 strncpy(status, ascii ? "x" : "⊗", sizeof(status) - 1); |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
918 break; |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
919 case PURPLE_STATUS_AVAILABLE: |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
920 strncpy(status, ascii ? "o" : "â—¯", sizeof(status) - 1); |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
921 break; |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
922 default: |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
923 strncpy(status, ascii ? "." : "⊖", sizeof(status) - 1); |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
924 break; |
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
925 } |
15817 | 926 } |
15822 | 927 name = purple_buddy_get_alias(buddy); |
15817 | 928 } |
15822 | 929 else if (PURPLE_BLIST_NODE_IS_CHAT(node)) |
15817 | 930 { |
15822 | 931 PurpleChat *chat = (PurpleChat*)node; |
932 name = purple_chat_get_name(chat); | |
15817 | 933 |
934 strncpy(status, "~", sizeof(status) - 1); | |
935 } | |
15822 | 936 else if (PURPLE_BLIST_NODE_IS_GROUP(node)) |
22220
1f256f63c52c
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22219
diff
changeset
|
937 return purple_group_get_name((PurpleGroup*)node); |
15817 | 938 |
25568
e0c8f689f60c
applied changes from aa7ce93329f5ccbe74640a92b6656ae402d8eea8
Ethan Blanton <elb@pidgin.im>
parents:
24537
diff
changeset
|
939 g_snprintf(text, sizeof(text) - 1, "%s %s", status, name); |
15817 | 940 |
941 return text; | |
942 } | |
943 | |
944 static void | |
15822 | 945 add_chat(PurpleChat *chat, FinchBlist *ggblist) |
15817 | 946 { |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
947 gpointer parent; |
15822 | 948 PurpleBlistNode *node = (PurpleBlistNode *)chat; |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
949 if (FINCH_GET_DATA(node)) |
15817 | 950 return; |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
951 if (!purple_account_is_connected(purple_chat_get_account(chat))) |
15817 | 952 return; |
953 | |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
954 parent = ggblist->manager->find_parent((PurpleBlistNode*)chat); |
15817 | 955 |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
956 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), chat, |
15817 | 957 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
958 parent, NULL)); |
15817 | 959 } |
960 | |
961 static void | |
15822 | 962 add_contact(PurpleContact *contact, FinchBlist *ggblist) |
15817 | 963 { |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
964 gpointer parent; |
15822 | 965 PurpleBlistNode *node = (PurpleBlistNode*)contact; |
15817 | 966 const char *name; |
967 | |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
968 if (FINCH_GET_DATA(node)) |
15817 | 969 return; |
21695
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
970 |
15817 | 971 name = get_display_name(node); |
972 if (name == NULL) | |
973 return; | |
21695
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
974 |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
975 parent = ggblist->manager->find_parent((PurpleBlistNode*)contact); |
15817 | 976 |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
977 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), contact, |
15817 | 978 gnt_tree_create_row(GNT_TREE(ggblist->tree), name), |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
979 parent, NULL)); |
15817 | 980 |
981 gnt_tree_set_expanded(GNT_TREE(ggblist->tree), contact, FALSE); | |
982 } | |
983 | |
984 static void | |
15822 | 985 add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist) |
15817 | 986 { |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
987 gpointer parent; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
988 PurpleBlistNode *node = (PurpleBlistNode *)buddy; |
15822 | 989 PurpleContact *contact; |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
990 |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
991 if (FINCH_GET_DATA(node)) |
15817 | 992 return; |
993 | |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
994 contact = purple_buddy_get_contact(buddy); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
995 parent = ggblist->manager->find_parent((PurpleBlistNode*)buddy); |
15817 | 996 |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
997 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, |
15817 | 998 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
999 parent, NULL)); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
1000 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
1001 blist_update_row_flags((PurpleBlistNode*)buddy); |
21695
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
1002 if (buddy == purple_contact_get_priority_buddy(contact)) |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
1003 blist_update_row_flags((PurpleBlistNode*)contact); |
15817 | 1004 } |
1005 | |
1006 #if 0 | |
1007 static void | |
15822 | 1008 buddy_signed_on(PurpleBuddy *buddy, FinchBlist *ggblist) |
15817 | 1009 { |
15822 | 1010 add_node((PurpleBlistNode*)buddy, ggblist); |
15817 | 1011 } |
1012 | |
1013 static void | |
15822 | 1014 buddy_signed_off(PurpleBuddy *buddy, FinchBlist *ggblist) |
15817 | 1015 { |
15822 | 1016 node_remove(purple_get_blist(), (PurpleBlistNode*)buddy); |
15817 | 1017 } |
1018 #endif | |
1019 | |
15822 | 1020 PurpleBlistUiOps *finch_blist_get_ui_ops() |
15817 | 1021 { |
1022 return &blist_ui_ops; | |
1023 } | |
1024 | |
1025 static void | |
1026 selection_activate(GntWidget *widget, FinchBlist *ggblist) | |
1027 { | |
1028 GntTree *tree = GNT_TREE(ggblist->tree); | |
15822 | 1029 PurpleBlistNode *node = gnt_tree_get_selection_data(tree); |
15817 | 1030 |
1031 if (!node) | |
1032 return; | |
22838
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
1033 |
15822 | 1034 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
1035 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); |
15817 | 1036 |
15822 | 1037 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
15817 | 1038 { |
15822 | 1039 PurpleBuddy *buddy = (PurpleBuddy *)node; |
18071
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1040 PurpleConversation *conv; |
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1041 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, |
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1042 purple_buddy_get_name(buddy), |
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1043 purple_buddy_get_account(buddy)); |
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1044 if (!conv) { |
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1045 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, |
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1046 purple_buddy_get_account(buddy), |
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1047 purple_buddy_get_name(buddy)); |
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1048 } else { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
1049 FinchConv *ggconv = FINCH_GET_DATA(conv); |
18071
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1050 gnt_window_present(ggconv->window); |
bb9cd8dfc61c
present existing conversation window if one exists
Richard Nelson <wabz@pidgin.im>
parents:
18069
diff
changeset
|
1051 } |
15817 | 1052 finch_conversation_set_active(conv); |
1053 } | |
15822 | 1054 else if (PURPLE_BLIST_NODE_IS_CHAT(node)) |
15817 | 1055 { |
22838
2d10cd28aa57
Check to see if we are already in a room before attempting to join. If
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22836
diff
changeset
|
1056 join_chat((PurpleChat*)node); |
15817 | 1057 } |
1058 } | |
1059 | |
1060 static void | |
1061 context_menu_callback(GntMenuItem *item, gpointer data) | |
1062 { | |
15822 | 1063 PurpleMenuAction *action = data; |
1064 PurpleBlistNode *node = ggblist->cnode; | |
15817 | 1065 if (action) { |
15822 | 1066 void (*callback)(PurpleBlistNode *, gpointer); |
1067 callback = (void (*)(PurpleBlistNode *, gpointer))action->callback; | |
15817 | 1068 if (callback) |
18512
0cb139b20d65
I can pretty much swear this worked at some point. I am not sure when this
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18490
diff
changeset
|
1069 callback(node, action->data); |
15817 | 1070 else |
1071 return; | |
1072 } | |
1073 } | |
1074 | |
1075 static void | |
15822 | 1076 gnt_append_menu_action(GntMenu *menu, PurpleMenuAction *action, gpointer parent) |
15817 | 1077 { |
1078 GList *list; | |
1079 GntMenuItem *item; | |
1080 | |
1081 if (action == NULL) | |
1082 return; | |
1083 | |
1084 item = gnt_menuitem_new(action->label); | |
1085 if (action->callback) | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15870
diff
changeset
|
1086 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), context_menu_callback, action); |
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15870
diff
changeset
|
1087 gnt_menu_add_item(menu, GNT_MENU_ITEM(item)); |
15817 | 1088 |
1089 if (action->children) { | |
1090 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); | |
1091 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); | |
1092 for (list = action->children; list; list = list->next) | |
1093 gnt_append_menu_action(GNT_MENU(sub), list->data, action); | |
1094 } | |
1095 } | |
1096 | |
1097 static void | |
15822 | 1098 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) |
15817 | 1099 { |
1100 GList *list; | |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
1101 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
15817 | 1102 |
1103 if(!prpl_info || !prpl_info->blist_node_menu) | |
1104 return; | |
1105 | |
1106 for(list = prpl_info->blist_node_menu(node); list; | |
1107 list = g_list_delete_link(list, list)) | |
1108 { | |
15822 | 1109 PurpleMenuAction *act = (PurpleMenuAction *) list->data; |
15817 | 1110 act->data = node; |
1111 gnt_append_menu_action(menu, act, NULL); | |
1112 } | |
1113 } | |
1114 | |
1115 static void | |
15822 | 1116 add_custom_action(GntMenu *menu, const char *label, PurpleCallback callback, |
15817 | 1117 gpointer data) |
1118 { | |
15822 | 1119 PurpleMenuAction *action = purple_menu_action_new(label, callback, data, NULL); |
15817 | 1120 gnt_append_menu_action(menu, action, NULL); |
1121 g_signal_connect_swapped(G_OBJECT(menu), "destroy", | |
15822 | 1122 G_CALLBACK(purple_menu_action_free), action); |
15817 | 1123 } |
1124 | |
1125 static void | |
15822 | 1126 chat_components_edit_ok(PurpleChat *chat, PurpleRequestFields *allfields) |
15817 | 1127 { |
1128 GList *groups, *fields; | |
1129 | |
15822 | 1130 for (groups = purple_request_fields_get_groups(allfields); groups; groups = groups->next) { |
1131 fields = purple_request_field_group_get_fields(groups->data); | |
15817 | 1132 for (; fields; fields = fields->next) { |
15822 | 1133 PurpleRequestField *field = fields->data; |
15817 | 1134 const char *id; |
1135 char *val; | |
1136 | |
15822 | 1137 id = purple_request_field_get_id(field); |
1138 if (purple_request_field_get_type(field) == PURPLE_REQUEST_FIELD_INTEGER) | |
1139 val = g_strdup_printf("%d", purple_request_field_int_get_value(field)); | |
15817 | 1140 else |
15822 | 1141 val = g_strdup(purple_request_field_string_get_value(field)); |
15817 | 1142 |
22786
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
1143 if (!val) { |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
1144 g_hash_table_remove(purple_chat_get_components(chat), id); |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
1145 } else { |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
1146 g_hash_table_replace(purple_chat_get_components(chat), g_strdup(id), val); /* val should not be free'd */ |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
1147 } |
15817 | 1148 } |
1149 } | |
1150 } | |
1151 | |
1152 static void | |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1153 chat_components_edit(PurpleBlistNode *selected, PurpleChat *chat) |
15817 | 1154 { |
15822 | 1155 PurpleRequestFields *fields = purple_request_fields_new(); |
1156 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); | |
1157 PurpleRequestField *field; | |
15817 | 1158 GList *parts, *iter; |
1159 struct proto_chat_entry *pce; | |
22213
16ff37f64e29
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 <imadil@gmail.com>
parents:
22212
diff
changeset
|
1160 PurpleConnection *gc; |
15817 | 1161 |
15822 | 1162 purple_request_fields_add_group(fields, group); |
15817 | 1163 |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1164 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
1165 parts = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info(gc); |
15817 | 1166 |
1167 for (iter = parts; iter; iter = iter->next) { | |
1168 pce = iter->data; | |
1169 if (pce->is_int) { | |
1170 int val; | |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1171 const char *str = g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier); |
15817 | 1172 if (!str || sscanf(str, "%d", &val) != 1) |
1173 val = pce->min; | |
15822 | 1174 field = purple_request_field_int_new(pce->identifier, pce->label, val); |
15817 | 1175 } else { |
15822 | 1176 field = purple_request_field_string_new(pce->identifier, pce->label, |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1177 g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier), FALSE); |
22786
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
1178 if (pce->secret) |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
1179 purple_request_field_string_set_masked(field, TRUE); |
15817 | 1180 } |
1181 | |
22786
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
1182 if (pce->required) |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
1183 purple_request_field_set_required(field, TRUE); |
dd8cdf1d8b19
Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22474
diff
changeset
|
1184 |
15822 | 1185 purple_request_field_group_add_field(group, field); |
15817 | 1186 g_free(pce); |
1187 } | |
1188 | |
1189 g_list_free(parts); | |
1190 | |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1191 purple_request_fields(NULL, _("Edit Chat"), NULL, _("Please Update the necessary fields."), |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1192 fields, _("Edit"), G_CALLBACK(chat_components_edit_ok), _("Cancel"), NULL, |
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1193 NULL, NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1194 chat); |
15817 | 1195 } |
1196 | |
1197 static void | |
1198 autojoin_toggled(GntMenuItem *item, gpointer data) | |
1199 { | |
15822 | 1200 PurpleMenuAction *action = data; |
1201 purple_blist_node_set_bool(action->data, "gnt-autojoin", | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15870
diff
changeset
|
1202 gnt_menuitem_check_get_checked(GNT_MENU_ITEM_CHECK(item))); |
15817 | 1203 } |
1204 | |
1205 static void | |
15822 | 1206 create_chat_menu(GntMenu *menu, PurpleChat *chat) |
15817 | 1207 { |
15822 | 1208 PurpleMenuAction *action = purple_menu_action_new(_("Auto-join"), NULL, chat, NULL); |
15817 | 1209 GntMenuItem *check = gnt_menuitem_check_new(action->label); |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15870
diff
changeset
|
1210 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(check), |
15822 | 1211 purple_blist_node_get_bool((PurpleBlistNode*)chat, "gnt-autojoin")); |
15817 | 1212 gnt_menu_add_item(menu, check); |
1213 gnt_menuitem_set_callback(check, autojoin_toggled, action); | |
1214 g_signal_connect_swapped(G_OBJECT(menu), "destroy", | |
15822 | 1215 G_CALLBACK(purple_menu_action_free), action); |
15817 | 1216 |
15822 | 1217 add_custom_action(menu, _("Edit Settings"), (PurpleCallback)chat_components_edit, chat); |
15817 | 1218 } |
1219 | |
1220 static void | |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1221 finch_add_buddy(PurpleBlistNode *selected, PurpleGroup *grp) |
15817 | 1222 { |
22220
1f256f63c52c
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22219
diff
changeset
|
1223 purple_blist_request_add_buddy(NULL, NULL, grp ? purple_group_get_name(grp) : NULL, NULL); |
15817 | 1224 } |
1225 | |
1226 static void | |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1227 finch_add_group(PurpleBlistNode *selected, PurpleGroup *grp) |
15817 | 1228 { |
15822 | 1229 purple_blist_request_add_group(); |
15817 | 1230 } |
1231 | |
1232 static void | |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1233 finch_add_chat(PurpleBlistNode *selected, PurpleGroup *grp) |
15817 | 1234 { |
15822 | 1235 purple_blist_request_add_chat(NULL, grp, NULL, NULL); |
15817 | 1236 } |
1237 | |
1238 static void | |
15822 | 1239 create_group_menu(GntMenu *menu, PurpleGroup *group) |
15817 | 1240 { |
1241 add_custom_action(menu, _("Add Buddy"), | |
15822 | 1242 PURPLE_CALLBACK(finch_add_buddy), group); |
15817 | 1243 add_custom_action(menu, _("Add Chat"), |
15822 | 1244 PURPLE_CALLBACK(finch_add_chat), group); |
15817 | 1245 add_custom_action(menu, _("Add Group"), |
15822 | 1246 PURPLE_CALLBACK(finch_add_group), group); |
15817 | 1247 } |
1248 | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17756
diff
changeset
|
1249 gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name) |
17750
319bcb73eb4e
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17203
diff
changeset
|
1250 { |
319bcb73eb4e
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17203
diff
changeset
|
1251 PurpleNotifyUserInfo *info = purple_notify_user_info_new(); |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17756
diff
changeset
|
1252 gpointer uihandle; |
17750
319bcb73eb4e
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17203
diff
changeset
|
1253 purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17756
diff
changeset
|
1254 uihandle = purple_notify_userinfo(conn, name, info, NULL, NULL); |
17750
319bcb73eb4e
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17203
diff
changeset
|
1255 purple_notify_user_info_destroy(info); |
319bcb73eb4e
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17203
diff
changeset
|
1256 |
319bcb73eb4e
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17203
diff
changeset
|
1257 serv_get_info(conn, name); |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17756
diff
changeset
|
1258 return uihandle; |
17750
319bcb73eb4e
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17203
diff
changeset
|
1259 } |
319bcb73eb4e
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17203
diff
changeset
|
1260 |
15817 | 1261 static void |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1262 finch_blist_get_buddy_info_cb(PurpleBlistNode *selected, PurpleBuddy *buddy) |
15817 | 1263 { |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1264 finch_retrieve_user_info(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy)); |
15817 | 1265 } |
1266 | |
1267 static void | |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1268 finch_blist_menu_send_file_cb(PurpleBlistNode *selected, PurpleBuddy *buddy) |
15817 | 1269 { |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1270 serv_send_file(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy), NULL); |
15817 | 1271 } |
1272 | |
1273 static void | |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1274 finch_blist_pounce_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node) |
15817 | 1275 { |
15822 | 1276 PurpleBuddy *b; |
1277 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) | |
1278 b = purple_contact_get_priority_buddy((PurpleContact *)node); | |
15817 | 1279 else |
15822 | 1280 b = (PurpleBuddy *)node; |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1281 finch_pounce_editor_show(purple_buddy_get_account(b), purple_buddy_get_name(b), NULL); |
15817 | 1282 } |
1283 | |
22250
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1284 static void |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1285 toggle_block_buddy(GntMenuItem *item, gpointer buddy) |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1286 { |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1287 gboolean block = gnt_menuitem_check_get_checked(GNT_MENU_ITEM_CHECK(item)); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1288 PurpleAccount *account = purple_buddy_get_account(buddy); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1289 const char *name = purple_buddy_get_name(buddy); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1290 |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1291 block ? purple_privacy_deny(account, name, FALSE, FALSE) : |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1292 purple_privacy_allow(account, name, FALSE, FALSE); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1293 } |
15817 | 1294 |
1295 static void | |
24285
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1296 toggle_show_offline(GntMenuItem *item, gpointer buddy) |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1297 { |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1298 purple_blist_node_set_bool(buddy, "show_offline", |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1299 !purple_blist_node_get_bool(buddy, "show_offline")); |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1300 if (!ggblist->manager->can_add_node(buddy)) |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1301 node_remove(purple_get_blist(), buddy); |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1302 else |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1303 node_update(purple_get_blist(), buddy); |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1304 } |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1305 |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1306 static void |
15822 | 1307 create_buddy_menu(GntMenu *menu, PurpleBuddy *buddy) |
15817 | 1308 { |
22250
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1309 PurpleAccount *account; |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1310 gboolean permitted; |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1311 GntMenuItem *item; |
15822 | 1312 PurplePluginProtocolInfo *prpl_info; |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1313 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
22213
16ff37f64e29
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 <imadil@gmail.com>
parents:
22212
diff
changeset
|
1314 |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
1315 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
15817 | 1316 if (prpl_info && prpl_info->get_info) |
1317 { | |
1318 add_custom_action(menu, _("Get Info"), | |
15822 | 1319 PURPLE_CALLBACK(finch_blist_get_buddy_info_cb), buddy); |
15817 | 1320 } |
1321 | |
1322 add_custom_action(menu, _("Add Buddy Pounce"), | |
15822 | 1323 PURPLE_CALLBACK(finch_blist_pounce_node_cb), buddy); |
15817 | 1324 |
1325 if (prpl_info && prpl_info->send_file) | |
1326 { | |
1327 if (!prpl_info->can_receive_file || | |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1328 prpl_info->can_receive_file(gc, purple_buddy_get_name(buddy))) |
15817 | 1329 add_custom_action(menu, _("Send File"), |
15822 | 1330 PURPLE_CALLBACK(finch_blist_menu_send_file_cb), buddy); |
15817 | 1331 } |
22250
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1332 |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1333 account = purple_buddy_get_account(buddy); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1334 permitted = purple_privacy_check(account, purple_buddy_get_name(buddy)); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1335 |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1336 item = gnt_menuitem_check_new(_("Blocked")); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1337 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), !permitted); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1338 gnt_menuitem_set_callback(item, toggle_block_buddy, buddy); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1339 gnt_menu_add_item(menu, item); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
1340 |
24285
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1341 item = gnt_menuitem_check_new(_("Show when offline")); |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1342 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline")); |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1343 gnt_menuitem_set_callback(item, toggle_show_offline, buddy); |
a4a7084ee09d
Show when offline (because the plugin doesn't work no more).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24238
diff
changeset
|
1344 gnt_menu_add_item(menu, item); |
15817 | 1345 |
1346 /* Protocol actions */ | |
1347 append_proto_menu(menu, | |
15822 | 1348 purple_account_get_connection(purple_buddy_get_account(buddy)), |
1349 (PurpleBlistNode*)buddy); | |
15817 | 1350 } |
1351 | |
1352 static void | |
15822 | 1353 append_extended_menu(GntMenu *menu, PurpleBlistNode *node) |
15817 | 1354 { |
1355 GList *iter; | |
1356 | |
15822 | 1357 for (iter = purple_blist_node_get_extended_menu(node); |
15817 | 1358 iter; iter = g_list_delete_link(iter, iter)) |
1359 { | |
1360 gnt_append_menu_action(menu, iter->data, NULL); | |
1361 } | |
1362 } | |
1363 | |
15822 | 1364 /* Xerox'd from gtkdialogs.c:purple_gtkdialogs_remove_contact_cb */ |
15817 | 1365 static void |
15822 | 1366 remove_contact(PurpleContact *contact) |
15817 | 1367 { |
15822 | 1368 PurpleBlistNode *bnode, *cnode; |
1369 PurpleGroup *group; | |
15817 | 1370 |
15822 | 1371 cnode = (PurpleBlistNode *)contact; |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1372 group = (PurpleGroup*)purple_blist_node_get_parent(cnode); |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1373 for (bnode = purple_blist_node_get_first_child(cnode); bnode; bnode = purple_blist_node_get_sibling_next(bnode)) { |
15822 | 1374 PurpleBuddy *buddy = (PurpleBuddy*)bnode; |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1375 PurpleAccount *account = purple_buddy_get_account(buddy); |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1376 if (purple_account_is_connected(account)) |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1377 purple_account_remove_buddy(account, buddy, group); |
15817 | 1378 } |
15822 | 1379 purple_blist_remove_contact(contact); |
15817 | 1380 } |
1381 | |
1382 static void | |
15822 | 1383 rename_blist_node(PurpleBlistNode *node, const char *newname) |
15817 | 1384 { |
1385 const char *name = newname; | |
1386 if (name && !*name) | |
1387 name = NULL; | |
1388 | |
15822 | 1389 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
1390 PurpleContact *contact = (PurpleContact*)node; | |
1391 PurpleBuddy *buddy = purple_contact_get_priority_buddy(contact); | |
1392 purple_blist_alias_contact(contact, name); | |
1393 purple_blist_alias_buddy(buddy, name); | |
15817 | 1394 serv_alias_buddy(buddy); |
15822 | 1395 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
1396 purple_blist_alias_buddy((PurpleBuddy*)node, name); | |
1397 serv_alias_buddy((PurpleBuddy*)node); | |
1398 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) | |
1399 purple_blist_alias_chat((PurpleChat*)node, name); | |
1400 else if (PURPLE_BLIST_NODE_IS_GROUP(node) && (name != NULL)) | |
1401 purple_blist_rename_group((PurpleGroup*)node, name); | |
15817 | 1402 else |
1403 g_return_if_reached(); | |
1404 } | |
1405 | |
1406 static void | |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1407 finch_blist_rename_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node) |
15817 | 1408 { |
1409 const char *name = NULL; | |
1410 char *prompt; | |
16276
31dad9806e9d
Use 'alias' instead of 'rename' for non-group nodes. Thankfully, this does not introduce new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
1411 const char *text; |
15817 | 1412 |
15822 | 1413 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
1414 name = purple_contact_get_alias((PurpleContact*)node); | |
1415 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) | |
1416 name = purple_buddy_get_contact_alias((PurpleBuddy*)node); | |
1417 else if (PURPLE_BLIST_NODE_IS_CHAT(node)) | |
1418 name = purple_chat_get_name((PurpleChat*)node); | |
1419 else if (PURPLE_BLIST_NODE_IS_GROUP(node)) | |
22220
1f256f63c52c
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22219
diff
changeset
|
1420 name = purple_group_get_name((PurpleGroup*)node); |
15817 | 1421 else |
1422 g_return_if_reached(); | |
1423 | |
1424 prompt = g_strdup_printf(_("Please enter the new name for %s"), name); | |
1425 | |
16958
1a336cfc410e
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16926
diff
changeset
|
1426 text = PURPLE_BLIST_NODE_IS_GROUP(node) ? _("Rename") : _("Set Alias"); |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1427 purple_request_input(node, text, prompt, _("Enter empty string to reset the name."), |
16276
31dad9806e9d
Use 'alias' instead of 'rename' for non-group nodes. Thankfully, this does not introduce new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
1428 name, FALSE, FALSE, NULL, text, G_CALLBACK(rename_blist_node), |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1429 _("Cancel"), NULL, |
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1430 NULL, NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1431 node); |
15817 | 1432 |
1433 g_free(prompt); | |
1434 } | |
1435 | |
22248
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1436 |
22356
561729870929
Fix showing a contact's log, and don't access struct internals
Richard Nelson <wabz@pidgin.im>
parents:
22307
diff
changeset
|
1437 static void showlog_cb(PurpleBlistNode *sel, PurpleBlistNode *node) |
22248
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1438 { |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1439 PurpleLogType type; |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1440 PurpleAccount *account; |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1441 char *name = NULL; |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1442 |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1443 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1444 PurpleBuddy *b = (PurpleBuddy*) node; |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1445 type = PURPLE_LOG_IM; |
25804
53c27ca1bb71
Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
1446 name = g_strdup(purple_buddy_get_name(b)); |
53c27ca1bb71
Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
1447 account = purple_buddy_get_account(b); |
22248
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1448 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1449 PurpleChat *c = (PurpleChat*) node; |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1450 PurplePluginProtocolInfo *prpl_info = NULL; |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1451 type = PURPLE_LOG_CHAT; |
25804
53c27ca1bb71
Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
1452 account = purple_chat_get_account(c); |
22248
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1453 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account))); |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1454 if (prpl_info && prpl_info->get_chat_name) { |
25804
53c27ca1bb71
Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
1455 name = prpl_info->get_chat_name(purple_chat_get_components(c)); |
22248
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1456 } |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1457 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1458 finch_log_show_contact((PurpleContact *)node); |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1459 return; |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1460 } else { |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1461 /* This callback should not have been registered for a node |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1462 * that doesn't match the type of one of the blocks above. */ |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1463 g_return_if_reached(); |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1464 } |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1465 |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1466 if (name && account) { |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1467 finch_log_show(type, name, account); |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1468 g_free(name); |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1469 } |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1470 } |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1471 |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1472 |
15822 | 1473 /* Xeroxed from gtkdialogs.c:purple_gtkdialogs_remove_group_cb*/ |
15817 | 1474 static void |
15822 | 1475 remove_group(PurpleGroup *group) |
15817 | 1476 { |
15822 | 1477 PurpleBlistNode *cnode, *bnode; |
15817 | 1478 |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1479 cnode = purple_blist_node_get_first_child(((PurpleBlistNode*)group)); |
15817 | 1480 |
1481 while (cnode) { | |
15822 | 1482 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1483 bnode = purple_blist_node_get_first_child(cnode); |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1484 cnode = purple_blist_node_get_sibling_next(cnode); |
15817 | 1485 while (bnode) { |
15822 | 1486 PurpleBuddy *buddy; |
1487 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) { | |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1488 PurpleAccount *account; |
15822 | 1489 buddy = (PurpleBuddy*)bnode; |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1490 bnode = purple_blist_node_get_sibling_next(bnode); |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1491 account = purple_buddy_get_account(buddy); |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1492 if (purple_account_is_connected(account)) { |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1493 purple_account_remove_buddy(account, buddy, group); |
15822 | 1494 purple_blist_remove_buddy(buddy); |
15817 | 1495 } |
1496 } else { | |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1497 bnode = purple_blist_node_get_sibling_next(bnode); |
15817 | 1498 } |
1499 } | |
15822 | 1500 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { |
1501 PurpleChat *chat = (PurpleChat *)cnode; | |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1502 cnode = purple_blist_node_get_sibling_next(cnode); |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
1503 if (purple_account_is_connected(purple_chat_get_account(chat))) |
15822 | 1504 purple_blist_remove_chat(chat); |
15817 | 1505 } else { |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1506 cnode = purple_blist_node_get_sibling_next(cnode); |
15817 | 1507 } |
1508 } | |
1509 | |
15822 | 1510 purple_blist_remove_group(group); |
15817 | 1511 } |
1512 | |
1513 static void | |
15822 | 1514 finch_blist_remove_node(PurpleBlistNode *node) |
15817 | 1515 { |
15822 | 1516 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
1517 remove_contact((PurpleContact*)node); | |
1518 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | |
1519 PurpleBuddy *buddy = (PurpleBuddy*)node; | |
1520 PurpleGroup *group = purple_buddy_get_group(buddy); | |
1521 purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group); | |
1522 purple_blist_remove_buddy(buddy); | |
1523 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | |
1524 purple_blist_remove_chat((PurpleChat*)node); | |
1525 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { | |
1526 remove_group((PurpleGroup*)node); | |
15817 | 1527 } |
1528 } | |
1529 | |
1530 static void | |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1531 finch_blist_remove_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node) |
15817 | 1532 { |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1533 PurpleAccount *account = NULL; |
15817 | 1534 char *primary; |
1535 const char *name, *sec = NULL; | |
1536 | |
15822 | 1537 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
1538 PurpleContact *c = (PurpleContact*)node; | |
1539 name = purple_contact_get_alias(c); | |
15817 | 1540 if (c->totalsize > 1) |
1541 sec = _("Removing this contact will also remove all the buddies in the contact"); | |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1542 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
15822 | 1543 name = purple_buddy_get_name((PurpleBuddy*)node); |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1544 account = purple_buddy_get_account((PurpleBuddy*)node); |
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1545 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
15822 | 1546 name = purple_chat_get_name((PurpleChat*)node); |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1547 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
22220
1f256f63c52c
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22219
diff
changeset
|
1548 name = purple_group_get_name((PurpleGroup*)node); |
15817 | 1549 sec = _("Removing this group will also remove all the buddies in the group"); |
1550 } | |
1551 else | |
1552 return; | |
1553 | |
1554 primary = g_strdup_printf(_("Are you sure you want to remove %s?"), name); | |
1555 | |
1556 /* XXX: anything to do with the returned ui-handle? */ | |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1557 purple_request_action(node, _("Confirm Remove"), |
15817 | 1558 primary, sec, |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1559 1, |
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1560 account, name, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1561 node, 2, |
15817 | 1562 _("Remove"), finch_blist_remove_node, |
1563 _("Cancel"), NULL); | |
1564 g_free(primary); | |
1565 } | |
1566 | |
1567 static void | |
15822 | 1568 finch_blist_toggle_tag_buddy(PurpleBlistNode *node) |
15817 | 1569 { |
1570 GList *iter; | |
1571 if (node == NULL) | |
1572 return; | |
1573 if (ggblist->tagged && (iter = g_list_find(ggblist->tagged, node)) != NULL) { | |
1574 ggblist->tagged = g_list_delete_link(ggblist->tagged, iter); | |
1575 } else { | |
1576 ggblist->tagged = g_list_prepend(ggblist->tagged, node); | |
1577 } | |
15822 | 1578 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
1579 update_buddy_display(purple_contact_get_priority_buddy(PURPLE_CONTACT(node)), ggblist); |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
1580 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1581 update_buddy_display((PurpleBuddy*)node, ggblist); |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1582 else |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1583 update_node_display(node, ggblist); |
15817 | 1584 } |
1585 | |
1586 static void | |
15822 | 1587 finch_blist_place_tagged(PurpleBlistNode *target) |
15817 | 1588 { |
15822 | 1589 PurpleGroup *tg = NULL; |
1590 PurpleContact *tc = NULL; | |
15817 | 1591 |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
1592 if (target == NULL || |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
1593 purple_blist_node_get_type(target) == PURPLE_BLIST_OTHER_NODE) |
15817 | 1594 return; |
1595 | |
15822 | 1596 if (PURPLE_BLIST_NODE_IS_GROUP(target)) |
1597 tg = (PurpleGroup*)target; | |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1598 else if (PURPLE_BLIST_NODE_IS_BUDDY(target)) { |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1599 tc = (PurpleContact*)purple_blist_node_get_parent(target); |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1600 tg = (PurpleGroup*)purple_blist_node_get_parent((PurpleBlistNode*)tc); |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1601 } else { |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1602 if (PURPLE_BLIST_NODE_IS_CONTACT(target)) |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1603 tc = (PurpleContact*)target; |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
1604 tg = (PurpleGroup*)purple_blist_node_get_parent(target); |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1605 } |
15817 | 1606 |
1607 if (ggblist->tagged) { | |
1608 GList *list = ggblist->tagged; | |
1609 ggblist->tagged = NULL; | |
1610 while (list) { | |
15822 | 1611 PurpleBlistNode *node = list->data; |
15817 | 1612 list = g_list_delete_link(list, list); |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1613 |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1614 if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1615 update_node_display(node, ggblist); |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1616 /* Add the group after the current group */ |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1617 purple_blist_add_group((PurpleGroup*)node, (PurpleBlistNode*)tg); |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1618 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1619 update_buddy_display(purple_contact_get_priority_buddy((PurpleContact*)node), ggblist); |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
1620 if (PURPLE_BLIST_NODE(tg) == target) { |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1621 /* The target is a group, just add the contact to the group. */ |
15822 | 1622 purple_blist_add_contact((PurpleContact*)node, tg, NULL); |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1623 } else if (tc) { |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1624 /* The target is either a buddy, or a contact. Merge with that contact. */ |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1625 purple_blist_merge_contact((PurpleContact*)node, (PurpleBlistNode*)tc); |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1626 } else { |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1627 /* The target is a chat. Add the contact to the group after this chat. */ |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1628 purple_blist_add_contact((PurpleContact*)node, NULL, target); |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1629 } |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1630 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1631 update_buddy_display((PurpleBuddy*)node, ggblist); |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
1632 if (PURPLE_BLIST_NODE(tg) == target) { |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1633 /* The target is a group. Add this buddy in a new contact under this group. */ |
15822 | 1634 purple_blist_add_buddy((PurpleBuddy*)node, NULL, tg, NULL); |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1635 } else if (PURPLE_BLIST_NODE_IS_CONTACT(target)) { |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1636 /* Add to the contact. */ |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1637 purple_blist_add_buddy((PurpleBuddy*)node, tc, NULL, NULL); |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1638 } else if (PURPLE_BLIST_NODE_IS_BUDDY(target)) { |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1639 /* Add to the contact after the selected buddy. */ |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1640 purple_blist_add_buddy((PurpleBuddy*)node, NULL, NULL, target); |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1641 } else if (PURPLE_BLIST_NODE_IS_CHAT(target)) { |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1642 /* Add to the selected chat's group. */ |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1643 purple_blist_add_buddy((PurpleBuddy*)node, NULL, tg, NULL); |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1644 } |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1645 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1646 update_node_display(node, ggblist); |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
1647 if (PURPLE_BLIST_NODE(tg) == target) |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1648 purple_blist_add_chat((PurpleChat*)node, tg, NULL); |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1649 else |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1650 purple_blist_add_chat((PurpleChat*)node, NULL, target); |
15817 | 1651 } |
1652 } | |
1653 } | |
1654 } | |
1655 | |
1656 static void | |
1657 context_menu_destroyed(GntWidget *widget, FinchBlist *ggblist) | |
1658 { | |
1659 ggblist->context = NULL; | |
1660 } | |
1661 | |
1662 static void | |
1663 draw_context_menu(FinchBlist *ggblist) | |
1664 { | |
15822 | 1665 PurpleBlistNode *node = NULL; |
15817 | 1666 GntWidget *context = NULL; |
1667 GntTree *tree = NULL; | |
1668 int x, y, top, width; | |
1669 char *title = NULL; | |
1670 | |
16813
e79555933fc6
Do not build the context menu if one is already being shown.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16781
diff
changeset
|
1671 if (ggblist->context) |
e79555933fc6
Do not build the context menu if one is already being shown.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16781
diff
changeset
|
1672 return; |
e79555933fc6
Do not build the context menu if one is already being shown.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16781
diff
changeset
|
1673 |
15817 | 1674 tree = GNT_TREE(ggblist->tree); |
1675 | |
1676 node = gnt_tree_get_selection_data(tree); | |
22172
0934fa012c8c
Do not show a context menu for an unknown node.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22171
diff
changeset
|
1677 if (node && purple_blist_node_get_type(node) == PURPLE_BLIST_OTHER_NODE) |
0934fa012c8c
Do not show a context menu for an unknown node.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22171
diff
changeset
|
1678 return; |
15817 | 1679 |
1680 if (ggblist->tooltip) | |
1681 remove_tooltip(ggblist); | |
1682 | |
1683 ggblist->cnode = node; | |
1684 | |
1685 ggblist->context = context = gnt_menu_new(GNT_MENU_POPUP); | |
1686 g_signal_connect(G_OBJECT(context), "destroy", G_CALLBACK(context_menu_destroyed), ggblist); | |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1687 g_signal_connect(G_OBJECT(context), "hide", G_CALLBACK(gnt_widget_destroy), NULL); |
15817 | 1688 |
1689 if (!node) { | |
1690 create_group_menu(GNT_MENU(context), NULL); | |
1691 title = g_strdup(_("Buddy List")); | |
15822 | 1692 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
1693 ggblist->cnode = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); |
18565
980d6e1b2d21
Fix a crash Eric found. These parameters were in reverse order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18535
diff
changeset
|
1694 create_buddy_menu(GNT_MENU(context), (PurpleBuddy*)ggblist->cnode); |
15822 | 1695 title = g_strdup(purple_contact_get_alias((PurpleContact*)node)); |
1696 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | |
1697 PurpleBuddy *buddy = (PurpleBuddy *)node; | |
15817 | 1698 create_buddy_menu(GNT_MENU(context), buddy); |
15822 | 1699 title = g_strdup(purple_buddy_get_name(buddy)); |
1700 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | |
1701 PurpleChat *chat = (PurpleChat*)node; | |
15817 | 1702 create_chat_menu(GNT_MENU(context), chat); |
15822 | 1703 title = g_strdup(purple_chat_get_name(chat)); |
1704 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { | |
1705 PurpleGroup *group = (PurpleGroup *)node; | |
15817 | 1706 create_group_menu(GNT_MENU(context), group); |
22220
1f256f63c52c
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22219
diff
changeset
|
1707 title = g_strdup(purple_group_get_name(group)); |
15817 | 1708 } |
1709 | |
1710 append_extended_menu(GNT_MENU(context), node); | |
1711 | |
1712 /* These are common for everything */ | |
1713 if (node) { | |
16276
31dad9806e9d
Use 'alias' instead of 'rename' for non-group nodes. Thankfully, this does not introduce new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
1714 add_custom_action(GNT_MENU(context), |
31dad9806e9d
Use 'alias' instead of 'rename' for non-group nodes. Thankfully, this does not introduce new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
1715 PURPLE_BLIST_NODE_IS_GROUP(node) ? _("Rename") : _("Alias"), |
15822 | 1716 PURPLE_CALLBACK(finch_blist_rename_node_cb), node); |
15817 | 1717 add_custom_action(GNT_MENU(context), _("Remove"), |
15822 | 1718 PURPLE_CALLBACK(finch_blist_remove_node_cb), node); |
15817 | 1719 |
15822 | 1720 if (ggblist->tagged && (PURPLE_BLIST_NODE_IS_CONTACT(node) |
1721 || PURPLE_BLIST_NODE_IS_GROUP(node))) { | |
15817 | 1722 add_custom_action(GNT_MENU(context), _("Place tagged"), |
15822 | 1723 PURPLE_CALLBACK(finch_blist_place_tagged), node); |
15817 | 1724 } |
1725 | |
15822 | 1726 if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
15817 | 1727 add_custom_action(GNT_MENU(context), _("Toggle Tag"), |
15822 | 1728 PURPLE_CALLBACK(finch_blist_toggle_tag_buddy), node); |
15817 | 1729 } |
22248
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1730 if (!PURPLE_BLIST_NODE_IS_GROUP(node)) { |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1731 add_custom_action(GNT_MENU(context), _("View Log"), |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1732 PURPLE_CALLBACK(showlog_cb), node); |
88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22220
diff
changeset
|
1733 } |
15817 | 1734 } |
1735 | |
1736 /* Set the position for the popup */ | |
1737 gnt_widget_get_position(GNT_WIDGET(tree), &x, &y); | |
1738 gnt_widget_get_size(GNT_WIDGET(tree), &width, NULL); | |
1739 top = gnt_tree_get_selection_visible_line(tree); | |
1740 | |
1741 x += width; | |
1742 y += top - 1; | |
1743 | |
1744 gnt_widget_set_position(context, x, y); | |
1745 gnt_screen_menu_show(GNT_MENU(context)); | |
1746 g_free(title); | |
1747 } | |
1748 | |
1749 static void | |
18332
1862a23b1751
Show better tooltips for contacts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18316
diff
changeset
|
1750 tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full) |
15817 | 1751 { |
15822 | 1752 PurplePlugin *prpl; |
1753 PurplePluginProtocolInfo *prpl_info; | |
1754 PurpleAccount *account; | |
1755 PurpleNotifyUserInfo *user_info; | |
18437
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
1756 PurplePresence *presence; |
15822 | 1757 const char *alias = purple_buddy_get_alias(buddy); |
15817 | 1758 char *tmp, *strip; |
1759 | |
15822 | 1760 user_info = purple_notify_user_info_new(); |
15817 | 1761 |
15822 | 1762 account = purple_buddy_get_account(buddy); |
18437
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
1763 presence = purple_buddy_get_presence(buddy); |
15817 | 1764 |
19305
f0b25c6fa806
Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18635
diff
changeset
|
1765 if (!full || g_utf8_collate(purple_buddy_get_name(buddy), alias)) { |
f0b25c6fa806
Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18635
diff
changeset
|
1766 char *esc = g_markup_escape_text(alias, -1); |
f0b25c6fa806
Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18635
diff
changeset
|
1767 purple_notify_user_info_add_pair(user_info, _("Nickname"), esc); |
f0b25c6fa806
Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18635
diff
changeset
|
1768 g_free(esc); |
f0b25c6fa806
Fix #2607. (Finch tooltip HTML display)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18635
diff
changeset
|
1769 } |
15817 | 1770 |
1771 tmp = g_strdup_printf("%s (%s)", | |
15822 | 1772 purple_account_get_username(account), |
1773 purple_account_get_protocol_name(account)); | |
1774 purple_notify_user_info_add_pair(user_info, _("Account"), tmp); | |
15817 | 1775 g_free(tmp); |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
1776 |
15822 | 1777 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
1778 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | |
15817 | 1779 if (prpl_info && prpl_info->tooltip_text) { |
18332
1862a23b1751
Show better tooltips for contacts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18316
diff
changeset
|
1780 prpl_info->tooltip_text(buddy, user_info, full); |
15817 | 1781 } |
1782 | |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16276
diff
changeset
|
1783 if (purple_prefs_get_bool("/finch/blist/idletime")) { |
15822 | 1784 PurplePresence *pre = purple_buddy_get_presence(buddy); |
1785 if (purple_presence_is_idle(pre)) { | |
1786 time_t idle = purple_presence_get_idle_time(pre); | |
15817 | 1787 if (idle > 0) { |
15822 | 1788 char *st = purple_str_seconds_to_string(time(NULL) - idle); |
1789 purple_notify_user_info_add_pair(user_info, _("Idle"), st); | |
15817 | 1790 g_free(st); |
1791 } | |
1792 } | |
1793 } | |
1794 | |
15822 | 1795 tmp = purple_notify_user_info_get_text_with_newline(user_info, "<BR>"); |
1796 purple_notify_user_info_destroy(user_info); | |
15817 | 1797 |
15822 | 1798 strip = purple_markup_strip_html(tmp); |
15817 | 1799 g_string_append(str, strip); |
18437
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
1800 |
18635
5551e5ec1ce0
Insert a newline in the tooltip.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18586
diff
changeset
|
1801 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE)) { |
5551e5ec1ce0
Insert a newline in the tooltip.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18586
diff
changeset
|
1802 g_string_append(str, "\n"); |
18437
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
1803 g_string_append(str, _("On Mobile")); |
18635
5551e5ec1ce0
Insert a newline in the tooltip.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18586
diff
changeset
|
1804 } |
18437
ecb223f9f75b
Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18428
diff
changeset
|
1805 |
15817 | 1806 g_free(strip); |
1807 g_free(tmp); | |
1808 } | |
1809 | |
1810 static GString* | |
1811 make_sure_text_fits(GString *string) | |
1812 { | |
1813 int maxw = getmaxx(stdscr) - 3; | |
1814 char *str = gnt_util_onscreen_fit_string(string->str, maxw); | |
1815 string = g_string_assign(string, str); | |
1816 g_free(str); | |
1817 return string; | |
1818 } | |
1819 | |
1820 static gboolean | |
1821 draw_tooltip_real(FinchBlist *ggblist) | |
1822 { | |
15822 | 1823 PurpleBlistNode *node; |
15817 | 1824 int x, y, top, width, w, h; |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
1825 GString *str = NULL; |
15817 | 1826 GntTree *tree; |
1827 GntWidget *widget, *box, *tv; | |
1828 char *title = NULL; | |
1829 | |
1830 widget = ggblist->tree; | |
1831 tree = GNT_TREE(widget); | |
1832 | |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
1833 if (!gnt_widget_has_focus(ggblist->tree) || |
15817 | 1834 (ggblist->context && !GNT_WIDGET_IS_FLAG_SET(ggblist->context, GNT_WIDGET_INVISIBLE))) |
1835 return FALSE; | |
1836 | |
1837 if (ggblist->tooltip) | |
1838 { | |
1839 /* XXX: Once we can properly redraw on expose events, this can be removed at the end | |
1840 * to avoid the blinking*/ | |
1841 remove_tooltip(ggblist); | |
1842 } | |
1843 | |
1844 node = gnt_tree_get_selection_data(tree); | |
1845 if (!node) | |
1846 return FALSE; | |
1847 | |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
1848 if (!ggblist->manager->create_tooltip(node, &str, &title)) |
15817 | 1849 return FALSE; |
1850 | |
1851 gnt_widget_get_position(widget, &x, &y); | |
1852 gnt_widget_get_size(widget, &width, NULL); | |
1853 top = gnt_tree_get_selection_visible_line(tree); | |
1854 | |
1855 x += width; | |
1856 y += top - 1; | |
1857 | |
1858 box = gnt_box_new(FALSE, FALSE); | |
1859 gnt_box_set_toplevel(GNT_BOX(box), TRUE); | |
1860 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_NO_SHADOW); | |
1861 gnt_box_set_title(GNT_BOX(box), title); | |
1862 | |
1863 str = make_sure_text_fits(str); | |
1864 gnt_util_get_text_bound(str->str, &w, &h); | |
18316
70325b0c5792
Use the new flags to make the tooltip look better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
1865 h = MAX(1, h); |
15817 | 1866 tv = gnt_text_view_new(); |
1867 gnt_widget_set_size(tv, w + 1, h); | |
18316
70325b0c5792
Use the new flags to make the tooltip look better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
1868 gnt_text_view_set_flag(GNT_TEXT_VIEW(tv), GNT_TEXT_VIEW_NO_SCROLL); |
15817 | 1869 gnt_box_add_widget(GNT_BOX(box), tv); |
1870 | |
22474
8445ea581a6e
Move the tooltip to the left of the buddylist if there's not enough room to show it on the right.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22429
diff
changeset
|
1871 if (x + w >= getmaxx(stdscr)) |
8445ea581a6e
Move the tooltip to the left of the buddylist if there's not enough room to show it on the right.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22429
diff
changeset
|
1872 x -= w + width + 2; |
15817 | 1873 gnt_widget_set_position(box, x, y); |
1874 GNT_WIDGET_UNSET_FLAGS(box, GNT_WIDGET_CAN_TAKE_FOCUS); | |
1875 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_TRANSIENT); | |
1876 gnt_widget_draw(box); | |
1877 | |
1878 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(tv), str->str, GNT_TEXT_FLAG_NORMAL); | |
1879 gnt_text_view_scroll(GNT_TEXT_VIEW(tv), 0); | |
1880 | |
1881 g_free(title); | |
1882 g_string_free(str, TRUE); | |
1883 ggblist->tooltip = box; | |
1884 ggblist->tnode = node; | |
1885 | |
1886 gnt_widget_set_name(ggblist->tooltip, "tooltip"); | |
1887 return FALSE; | |
1888 } | |
1889 | |
1890 static void | |
1891 draw_tooltip(FinchBlist *ggblist) | |
1892 { | |
1893 /* When an account has signed off, it removes one buddy at a time. | |
1894 * Drawing the tooltip after removing each buddy is expensive. On | |
1895 * top of that, if the selected buddy belongs to the disconnected | |
1896 * account, then retreiving the tooltip for that causes crash. So | |
1897 * let's make sure we wait for all the buddies to be removed first.*/ | |
1898 int id = g_timeout_add(0, (GSourceFunc)draw_tooltip_real, ggblist); | |
1899 g_object_set_data_full(G_OBJECT(ggblist->window), "draw_tooltip_calback", | |
1900 GINT_TO_POINTER(id), (GDestroyNotify)g_source_remove); | |
1901 } | |
1902 | |
1903 static void | |
1904 selection_changed(GntWidget *widget, gpointer old, gpointer current, FinchBlist *ggblist) | |
1905 { | |
16781
d0f9b2b217cf
Fix context menu unusualness in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16771
diff
changeset
|
1906 remove_peripherals(ggblist); |
15817 | 1907 draw_tooltip(ggblist); |
1908 } | |
1909 | |
1910 static gboolean | |
1911 context_menu(GntWidget *widget, FinchBlist *ggblist) | |
1912 { | |
1913 draw_context_menu(ggblist); | |
1914 return TRUE; | |
1915 } | |
1916 | |
1917 static gboolean | |
1918 key_pressed(GntWidget *widget, const char *text, FinchBlist *ggblist) | |
1919 { | |
1920 if (text[0] == 27 && text[1] == 0) { | |
1921 /* Escape was pressed */ | |
21305
0208beabfa33
Cancel the typeahead search when escape is pressed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
1922 if (gnt_tree_is_searching(GNT_TREE(ggblist->tree))) |
0208beabfa33
Cancel the typeahead search when escape is pressed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
1923 gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "end-search", NULL); |
15817 | 1924 remove_peripherals(ggblist); |
20625
54ff514fdd04
Pressing INSERT in the buddy list brings up the 'Add Buddy' dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20561
diff
changeset
|
1925 } else if (strcmp(text, GNT_KEY_INS) == 0) { |
26963
fd78c7022f81
Remove a now-unnecessary binding for the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26694
diff
changeset
|
1926 PurpleBlistNode *node = gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)); |
fd78c7022f81
Remove a now-unnecessary binding for the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26694
diff
changeset
|
1927 purple_blist_request_add_buddy(NULL, NULL, |
fd78c7022f81
Remove a now-unnecessary binding for the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26694
diff
changeset
|
1928 node && PURPLE_BLIST_NODE_IS_GROUP(node) ? purple_group_get_name(PURPLE_GROUP(node)) : NULL, |
fd78c7022f81
Remove a now-unnecessary binding for the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26694
diff
changeset
|
1929 NULL); |
18535
fad459189cc5
New feature: successful compilation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18512
diff
changeset
|
1930 } else if (!gnt_tree_is_searching(GNT_TREE(ggblist->tree))) { |
15817 | 1931 if (strcmp(text, "t") == 0) { |
1932 finch_blist_toggle_tag_buddy(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); | |
1933 gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "move-down"); | |
1934 } else if (strcmp(text, "a") == 0) { | |
1935 finch_blist_place_tagged(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); | |
1936 } else | |
1937 return FALSE; | |
1938 } else | |
1939 return FALSE; | |
1940 | |
1941 return TRUE; | |
1942 } | |
1943 | |
1944 static void | |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1945 update_node_display(PurpleBlistNode *node, FinchBlist *ggblist) |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1946 { |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
1947 GntTextFormatFlags flag = get_blist_node_flag(node); |
16567
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1948 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), node, flag); |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1949 } |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1950 |
7b692d5dd704
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 <imadil@gmail.com>
parents:
16483
diff
changeset
|
1951 static void |
15822 | 1952 update_buddy_display(PurpleBuddy *buddy, FinchBlist *ggblist) |
15817 | 1953 { |
15822 | 1954 PurpleContact *contact; |
21695
52bbf38a1cd2
Refactor the code a little bit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21694
diff
changeset
|
1955 |
15822 | 1956 contact = purple_buddy_get_contact(buddy); |
15817 | 1957 |
15822 | 1958 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((PurpleBlistNode*)buddy)); |
1959 gnt_tree_change_text(GNT_TREE(ggblist->tree), contact, 0, get_display_name((PurpleBlistNode*)contact)); | |
15817 | 1960 |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
1961 blist_update_row_flags((PurpleBlistNode *)buddy); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
1962 if (buddy == purple_contact_get_priority_buddy(contact)) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
1963 blist_update_row_flags((PurpleBlistNode *)contact); |
15817 | 1964 |
15822 | 1965 if (ggblist->tnode == (PurpleBlistNode*)buddy) |
15817 | 1966 draw_tooltip(ggblist); |
1967 } | |
1968 | |
1969 static void | |
15822 | 1970 buddy_status_changed(PurpleBuddy *buddy, PurpleStatus *old, PurpleStatus *now, FinchBlist *ggblist) |
15817 | 1971 { |
1972 update_buddy_display(buddy, ggblist); | |
1973 } | |
1974 | |
1975 static void | |
15822 | 1976 buddy_idle_changed(PurpleBuddy *buddy, int old, int new, FinchBlist *ggblist) |
15817 | 1977 { |
1978 update_buddy_display(buddy, ggblist); | |
1979 } | |
1980 | |
1981 static void | |
1982 remove_peripherals(FinchBlist *ggblist) | |
1983 { | |
1984 if (ggblist->tooltip) | |
1985 remove_tooltip(ggblist); | |
1986 else if (ggblist->context) | |
1987 gnt_widget_destroy(ggblist->context); | |
1988 } | |
1989 | |
1990 static void | |
1991 size_changed_cb(GntWidget *w, int wi, int h) | |
1992 { | |
1993 int width, height; | |
1994 gnt_widget_get_size(w, &width, &height); | |
15822 | 1995 purple_prefs_set_int(PREF_ROOT "/size/width", width); |
1996 purple_prefs_set_int(PREF_ROOT "/size/height", height); | |
15817 | 1997 } |
1998 | |
1999 static void | |
2000 save_position_cb(GntWidget *w, int x, int y) | |
2001 { | |
15822 | 2002 purple_prefs_set_int(PREF_ROOT "/position/x", x); |
2003 purple_prefs_set_int(PREF_ROOT "/position/y", y); | |
15817 | 2004 } |
2005 | |
2006 static void | |
2007 reset_blist_window(GntWidget *window, gpointer null) | |
2008 { | |
15822 | 2009 PurpleBlistNode *node; |
2010 purple_signals_disconnect_by_handle(finch_blist_get_handle()); | |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
2011 FINCH_SET_DATA(purple_get_blist(), NULL); |
15817 | 2012 |
15822 | 2013 node = purple_blist_get_root(); |
15817 | 2014 while (node) { |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2015 reset_blist_node_ui_data(node); |
15822 | 2016 node = purple_blist_node_next(node, TRUE); |
15817 | 2017 } |
2018 | |
2019 if (ggblist->typing) | |
25592
bd18bb4915ba
*** Plucked rev 143e16e9 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25568
diff
changeset
|
2020 purple_timeout_remove(ggblist->typing); |
15817 | 2021 remove_peripherals(ggblist); |
2022 if (ggblist->tagged) | |
2023 g_list_free(ggblist->tagged); | |
24215
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
2024 |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
2025 if (ggblist->new_group_timeout) |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
2026 purple_timeout_remove(ggblist->new_group_timeout); |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
2027 if (ggblist->new_group) |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
2028 g_list_free(ggblist->new_group); |
95da3ec97c27
Show a manually added new empty group even if the preference is not set.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24001
diff
changeset
|
2029 |
15817 | 2030 g_free(ggblist); |
2031 ggblist = NULL; | |
2032 } | |
2033 | |
2034 static void | |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21738
diff
changeset
|
2035 populate_buddylist(void) |
15817 | 2036 { |
15822 | 2037 PurpleBlistNode *node; |
2038 PurpleBuddyList *list; | |
15817 | 2039 |
22190
bcaf4a037704
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22181
diff
changeset
|
2040 if (ggblist->manager->init) |
bcaf4a037704
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22181
diff
changeset
|
2041 ggblist->manager->init(); |
bcaf4a037704
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22181
diff
changeset
|
2042 |
15822 | 2043 if (strcmp(purple_prefs_get_string(PREF_ROOT "/sort_type"), "text") == 0) { |
15817 | 2044 gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), |
2045 (GCompareFunc)blist_node_compare_text); | |
15822 | 2046 } else if (strcmp(purple_prefs_get_string(PREF_ROOT "/sort_type"), "status") == 0) { |
15817 | 2047 gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), |
2048 (GCompareFunc)blist_node_compare_status); | |
15822 | 2049 } else if (strcmp(purple_prefs_get_string(PREF_ROOT "/sort_type"), "log") == 0) { |
15817 | 2050 gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), |
2051 (GCompareFunc)blist_node_compare_log); | |
2052 } | |
2053 | |
15822 | 2054 list = purple_get_blist(); |
2055 node = purple_blist_get_root(); | |
15817 | 2056 while (node) |
2057 { | |
2058 node_update(list, node); | |
15822 | 2059 node = purple_blist_node_next(node, FALSE); |
15817 | 2060 } |
2061 } | |
2062 | |
2063 static void | |
2064 destroy_status_list(GList *list) | |
2065 { | |
2066 g_list_foreach(list, (GFunc)g_free, NULL); | |
2067 g_list_free(list); | |
2068 } | |
2069 | |
2070 static void | |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21738
diff
changeset
|
2071 populate_status_dropdown(void) |
15817 | 2072 { |
2073 int i; | |
2074 GList *iter; | |
2075 GList *items = NULL; | |
2076 StatusBoxItem *item = NULL; | |
2077 | |
2078 /* First the primitives */ | |
15822 | 2079 PurpleStatusPrimitive prims[] = {PURPLE_STATUS_AVAILABLE, PURPLE_STATUS_AWAY, |
2080 PURPLE_STATUS_INVISIBLE, PURPLE_STATUS_OFFLINE, PURPLE_STATUS_UNSET}; | |
15817 | 2081 |
2082 gnt_combo_box_remove_all(GNT_COMBO_BOX(ggblist->status)); | |
2083 | |
15822 | 2084 for (i = 0; prims[i] != PURPLE_STATUS_UNSET; i++) |
15817 | 2085 { |
2086 item = g_new0(StatusBoxItem, 1); | |
2087 item->type = STATUS_PRIMITIVE; | |
2088 item->u.prim = prims[i]; | |
2089 items = g_list_prepend(items, item); | |
2090 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, | |
15822 | 2091 purple_primitive_get_name_from_type(prims[i])); |
15817 | 2092 } |
2093 | |
2094 /* Now the popular statuses */ | |
18585
823946ddd527
Memory leak fix.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18584
diff
changeset
|
2095 for (iter = purple_savedstatuses_get_popular(6); iter; iter = g_list_delete_link(iter, iter)) |
15817 | 2096 { |
2097 item = g_new0(StatusBoxItem, 1); | |
2098 item->type = STATUS_SAVED_POPULAR; | |
2099 item->u.saved = iter->data; | |
2100 items = g_list_prepend(items, item); | |
2101 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, | |
15822 | 2102 purple_savedstatus_get_title(iter->data)); |
15817 | 2103 } |
2104 | |
2105 /* New savedstatus */ | |
2106 item = g_new0(StatusBoxItem, 1); | |
2107 item->type = STATUS_SAVED_NEW; | |
2108 items = g_list_prepend(items, item); | |
2109 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, | |
2110 _("New...")); | |
2111 | |
2112 /* More savedstatuses */ | |
2113 item = g_new0(StatusBoxItem, 1); | |
2114 item->type = STATUS_SAVED_ALL; | |
2115 items = g_list_prepend(items, item); | |
2116 gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, | |
2117 _("Saved...")); | |
2118 | |
2119 /* The keys for the combobox are created here, and never used | |
2120 * anywhere else. So make sure the keys are freed when the widget | |
2121 * is destroyed. */ | |
2122 g_object_set_data_full(G_OBJECT(ggblist->status), "list of statuses", | |
2123 items, (GDestroyNotify)destroy_status_list); | |
2124 } | |
2125 | |
2126 static void | |
15822 | 2127 redraw_blist(const char *name, PurplePrefType type, gconstpointer val, gpointer data) |
15817 | 2128 { |
15822 | 2129 PurpleBlistNode *node, *sel; |
22178
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2130 FinchBlistManager *manager; |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2131 |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2132 if (ggblist == NULL) |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2133 return; |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2134 |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2135 manager = finch_blist_manager_find(purple_prefs_get_string(PREF_ROOT "/grouping")); |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2136 if (manager == NULL) |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2137 manager = &default_manager; |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2138 if (ggblist->manager != manager) { |
22190
bcaf4a037704
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22181
diff
changeset
|
2139 if (ggblist->manager->uninit) |
bcaf4a037704
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22181
diff
changeset
|
2140 ggblist->manager->uninit(); |
bcaf4a037704
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22181
diff
changeset
|
2141 |
22178
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2142 ggblist->manager = manager; |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2143 if (manager->can_add_node == NULL) |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2144 manager->can_add_node = default_can_add_node; |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2145 if (manager->find_parent == NULL) |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2146 manager->find_parent = default_find_parent; |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2147 if (manager->create_tooltip == NULL) |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2148 manager->create_tooltip = default_create_tooltip; |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2149 } |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2150 |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2151 if (ggblist->window == NULL) |
15817 | 2152 return; |
2153 | |
2154 sel = gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)); | |
2155 gnt_tree_remove_all(GNT_TREE(ggblist->tree)); | |
22190
bcaf4a037704
Init and uninit the buddylist managers at appropriate times.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22181
diff
changeset
|
2156 |
15822 | 2157 node = purple_blist_get_root(); |
2158 for (; node; node = purple_blist_node_next(node, TRUE)) | |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2159 reset_blist_node_ui_data(node); |
15817 | 2160 populate_buddylist(); |
2161 gnt_tree_set_selected(GNT_TREE(ggblist->tree), sel); | |
2162 draw_tooltip(ggblist); | |
2163 } | |
2164 | |
2165 void finch_blist_init() | |
2166 { | |
21738
e3e64d1e4869
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21695
diff
changeset
|
2167 color_available = gnt_style_get_color(NULL, "color-available"); |
21694
2de3a2de5f13
Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21691
diff
changeset
|
2168 if (!color_available) |
2de3a2de5f13
Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21691
diff
changeset
|
2169 color_available = gnt_color_add_pair(COLOR_GREEN, -1); |
21738
e3e64d1e4869
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21695
diff
changeset
|
2170 color_away = gnt_style_get_color(NULL, "color-away"); |
21694
2de3a2de5f13
Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21691
diff
changeset
|
2171 if (!color_away) |
2de3a2de5f13
Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21691
diff
changeset
|
2172 color_away = gnt_color_add_pair(COLOR_BLUE, -1); |
21738
e3e64d1e4869
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21695
diff
changeset
|
2173 color_idle = gnt_style_get_color(NULL, "color-idle"); |
21694
2de3a2de5f13
Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21691
diff
changeset
|
2174 if (!color_idle) |
2de3a2de5f13
Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21691
diff
changeset
|
2175 color_idle = gnt_color_add_pair(COLOR_CYAN, -1); |
21738
e3e64d1e4869
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21695
diff
changeset
|
2176 color_offline = gnt_style_get_color(NULL, "color-offline"); |
21694
2de3a2de5f13
Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21691
diff
changeset
|
2177 if (!color_offline) |
2de3a2de5f13
Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21691
diff
changeset
|
2178 color_offline = gnt_color_add_pair(COLOR_RED, -1); |
2de3a2de5f13
Update the changelogs. Correct the man page. Allow 'default' to mean the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21691
diff
changeset
|
2179 |
15822 | 2180 purple_prefs_add_none(PREF_ROOT); |
2181 purple_prefs_add_none(PREF_ROOT "/size"); | |
2182 purple_prefs_add_int(PREF_ROOT "/size/width", 20); | |
2183 purple_prefs_add_int(PREF_ROOT "/size/height", 17); | |
2184 purple_prefs_add_none(PREF_ROOT "/position"); | |
2185 purple_prefs_add_int(PREF_ROOT "/position/x", 0); | |
2186 purple_prefs_add_int(PREF_ROOT "/position/y", 0); | |
2187 purple_prefs_add_bool(PREF_ROOT "/idletime", TRUE); | |
2188 purple_prefs_add_bool(PREF_ROOT "/showoffline", FALSE); | |
18441
24ecab0d40b3
Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18437
diff
changeset
|
2189 purple_prefs_add_bool(PREF_ROOT "/emptygroups", FALSE); |
15822 | 2190 purple_prefs_add_string(PREF_ROOT "/sort_type", "text"); |
22178
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2191 purple_prefs_add_string(PREF_ROOT "/grouping", "default"); |
15817 | 2192 |
15822 | 2193 purple_prefs_connect_callback(finch_blist_get_handle(), |
18441
24ecab0d40b3
Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18437
diff
changeset
|
2194 PREF_ROOT "/emptygroups", redraw_blist, NULL); |
24ecab0d40b3
Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18437
diff
changeset
|
2195 purple_prefs_connect_callback(finch_blist_get_handle(), |
15817 | 2196 PREF_ROOT "/showoffline", redraw_blist, NULL); |
15822 | 2197 purple_prefs_connect_callback(finch_blist_get_handle(), |
15817 | 2198 PREF_ROOT "/sort_type", redraw_blist, NULL); |
22178
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2199 purple_prefs_connect_callback(finch_blist_get_handle(), |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2200 PREF_ROOT "/grouping", redraw_blist, NULL); |
15817 | 2201 |
15822 | 2202 purple_signal_connect(purple_connections_get_handle(), "signed-on", purple_blist_get_handle(), |
15817 | 2203 G_CALLBACK(account_signed_on_cb), NULL); |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2204 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2205 finch_blist_install_manager(&default_manager); |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2206 |
15817 | 2207 return; |
2208 } | |
2209 | |
2210 static gboolean | |
2211 remove_typing_cb(gpointer null) | |
2212 { | |
15822 | 2213 PurpleSavedStatus *current; |
15817 | 2214 const char *message, *newmessage; |
24537
0f7a248848ed
Properly escape the status message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
2215 char *escnewmessage; |
15822 | 2216 PurpleStatusPrimitive prim, newprim; |
15817 | 2217 StatusBoxItem *item; |
2218 | |
15822 | 2219 current = purple_savedstatus_get_current(); |
2220 message = purple_savedstatus_get_message(current); | |
2221 prim = purple_savedstatus_get_type(current); | |
15817 | 2222 |
2223 newmessage = gnt_entry_get_text(GNT_ENTRY(ggblist->statustext)); | |
2224 item = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(ggblist->status)); | |
24537
0f7a248848ed
Properly escape the status message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
2225 escnewmessage = newmessage ? g_markup_escape_text(newmessage, -1) : NULL; |
16655
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2226 |
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2227 switch (item->type) { |
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2228 case STATUS_PRIMITIVE: |
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2229 newprim = item->u.prim; |
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2230 break; |
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2231 case STATUS_SAVED_POPULAR: |
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2232 newprim = purple_savedstatus_get_type(item->u.saved); |
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2233 break; |
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2234 default: |
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2235 goto end; /* 'New' or 'Saved' is selected, but this should never happen. */ |
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2236 } |
15817 | 2237 |
24537
0f7a248848ed
Properly escape the status message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
2238 if (newprim != prim || ((message && !escnewmessage) || |
0f7a248848ed
Properly escape the status message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
2239 (!message && escnewmessage) || |
0f7a248848ed
Properly escape the status message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
2240 (message && escnewmessage && g_utf8_collate(message, escnewmessage) != 0))) |
15817 | 2241 { |
24537
0f7a248848ed
Properly escape the status message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
2242 PurpleSavedStatus *status = purple_savedstatus_find_transient_by_type_and_message(newprim, escnewmessage); |
15817 | 2243 /* Holy Crap! That's a LAWNG function name */ |
2244 if (status == NULL) | |
2245 { | |
15822 | 2246 status = purple_savedstatus_new(NULL, newprim); |
24537
0f7a248848ed
Properly escape the status message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
2247 purple_savedstatus_set_message(status, escnewmessage); |
15817 | 2248 } |
2249 | |
15822 | 2250 purple_savedstatus_activate(status); |
15817 | 2251 } |
2252 | |
2253 gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree); | |
16655
1c9835f8b29c
A rare crash fix for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16567
diff
changeset
|
2254 end: |
24537
0f7a248848ed
Properly escape the status message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24285
diff
changeset
|
2255 g_free(escnewmessage); |
15817 | 2256 if (ggblist->typing) |
25592
bd18bb4915ba
*** Plucked rev 143e16e9 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25568
diff
changeset
|
2257 purple_timeout_remove(ggblist->typing); |
15817 | 2258 ggblist->typing = 0; |
2259 return FALSE; | |
2260 } | |
2261 | |
2262 static void | |
2263 status_selection_changed(GntComboBox *box, StatusBoxItem *old, StatusBoxItem *now, gpointer null) | |
2264 { | |
2265 gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), NULL); | |
2266 if (now->type == STATUS_SAVED_POPULAR) | |
2267 { | |
2268 /* Set the status immediately */ | |
15822 | 2269 purple_savedstatus_activate(now->u.saved); |
15817 | 2270 } |
2271 else if (now->type == STATUS_PRIMITIVE) | |
2272 { | |
2273 /* Move the focus to the entry box */ | |
2274 /* XXX: Make sure the selected status can have a message */ | |
2275 gnt_box_move_focus(GNT_BOX(ggblist->window), 1); | |
25592
bd18bb4915ba
*** Plucked rev 143e16e9 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25568
diff
changeset
|
2276 ggblist->typing = purple_timeout_add_seconds(TYPING_TIMEOUT_S, (GSourceFunc)remove_typing_cb, NULL); |
15817 | 2277 } |
2278 else if (now->type == STATUS_SAVED_ALL) | |
2279 { | |
2280 /* Restore the selection to reflect current status. */ | |
15822 | 2281 savedstatus_changed(purple_savedstatus_get_current(), NULL); |
15817 | 2282 gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree); |
2283 finch_savedstatus_show_all(); | |
2284 } | |
2285 else if (now->type == STATUS_SAVED_NEW) | |
2286 { | |
15822 | 2287 savedstatus_changed(purple_savedstatus_get_current(), NULL); |
15817 | 2288 gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree); |
2289 finch_savedstatus_edit(NULL); | |
2290 } | |
2291 else | |
2292 g_return_if_reached(); | |
2293 } | |
2294 | |
2295 static gboolean | |
2296 status_text_changed(GntEntry *entry, const char *text, gpointer null) | |
2297 { | |
2298 if ((text[0] == 27 || (text[0] == '\t' && text[1] == '\0')) && ggblist->typing == 0) | |
2299 return FALSE; | |
2300 | |
2301 if (ggblist->typing) | |
25592
bd18bb4915ba
*** Plucked rev 143e16e9 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25568
diff
changeset
|
2302 purple_timeout_remove(ggblist->typing); |
15817 | 2303 ggblist->typing = 0; |
2304 | |
2305 if (text[0] == '\r' && text[1] == 0) | |
2306 { | |
2307 /* Set the status only after you press 'Enter' */ | |
2308 remove_typing_cb(NULL); | |
2309 return TRUE; | |
2310 } | |
2311 | |
25592
bd18bb4915ba
*** Plucked rev 143e16e9 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25568
diff
changeset
|
2312 ggblist->typing = purple_timeout_add_seconds(TYPING_TIMEOUT_S, (GSourceFunc)remove_typing_cb, NULL); |
15817 | 2313 return FALSE; |
2314 } | |
2315 | |
2316 static void | |
15822 | 2317 savedstatus_changed(PurpleSavedStatus *now, PurpleSavedStatus *old) |
15817 | 2318 { |
2319 GList *list; | |
15822 | 2320 PurpleStatusPrimitive prim; |
15817 | 2321 const char *message; |
2322 gboolean found = FALSE, saved = TRUE; | |
2323 | |
2324 if (!ggblist) | |
2325 return; | |
2326 | |
2327 /* Block the signals we don't want to emit */ | |
2328 g_signal_handlers_block_matched(ggblist->status, G_SIGNAL_MATCH_FUNC, | |
2329 0, 0, NULL, status_selection_changed, NULL); | |
2330 g_signal_handlers_block_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC, | |
2331 0, 0, NULL, status_text_changed, NULL); | |
2332 | |
15822 | 2333 prim = purple_savedstatus_get_type(now); |
2334 message = purple_savedstatus_get_message(now); | |
15817 | 2335 |
2336 /* Rebuild the status dropdown */ | |
2337 populate_status_dropdown(); | |
2338 | |
2339 while (!found) { | |
2340 list = g_object_get_data(G_OBJECT(ggblist->status), "list of statuses"); | |
2341 for (; list; list = list->next) | |
2342 { | |
2343 StatusBoxItem *item = list->data; | |
2344 if ((saved && item->type != STATUS_PRIMITIVE && item->u.saved == now) || | |
2345 (!saved && item->type == STATUS_PRIMITIVE && item->u.prim == prim)) | |
2346 { | |
15822 | 2347 char *mess = purple_unescape_html(message); |
15817 | 2348 gnt_combo_box_set_selected(GNT_COMBO_BOX(ggblist->status), item); |
2349 gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), mess); | |
2350 gnt_widget_draw(ggblist->status); | |
2351 g_free(mess); | |
2352 found = TRUE; | |
2353 break; | |
2354 } | |
2355 } | |
2356 if (!saved) | |
2357 break; | |
2358 saved = FALSE; | |
2359 } | |
2360 | |
2361 g_signal_handlers_unblock_matched(ggblist->status, G_SIGNAL_MATCH_FUNC, | |
2362 0, 0, NULL, status_selection_changed, NULL); | |
2363 g_signal_handlers_unblock_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC, | |
2364 0, 0, NULL, status_text_changed, NULL); | |
2365 } | |
2366 | |
2367 static int | |
16483
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2368 blist_node_compare_position(PurpleBlistNode *n1, PurpleBlistNode *n2) |
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2369 { |
22212
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22192
diff
changeset
|
2370 while ((n1 = purple_blist_node_get_sibling_prev(n1)) != NULL) |
16483
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2371 if (n1 == n2) |
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2372 return 1; |
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2373 return -1; |
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2374 } |
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2375 |
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2376 static int |
15822 | 2377 blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2) |
15817 | 2378 { |
2379 const char *s1, *s2; | |
2380 char *us1, *us2; | |
2381 int ret; | |
17240
29b3dc9cc8c5
It's valid for different types to be compared. In that case, use existing positions.
Richard Nelson <wabz@pidgin.im>
parents:
17203
diff
changeset
|
2382 |
22212
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22192
diff
changeset
|
2383 if (purple_blist_node_get_type(n1) != purple_blist_node_get_type(n2)) |
17240
29b3dc9cc8c5
It's valid for different types to be compared. In that case, use existing positions.
Richard Nelson <wabz@pidgin.im>
parents:
17203
diff
changeset
|
2384 return blist_node_compare_position(n1, n2); |
29b3dc9cc8c5
It's valid for different types to be compared. In that case, use existing positions.
Richard Nelson <wabz@pidgin.im>
parents:
17203
diff
changeset
|
2385 |
22212
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22192
diff
changeset
|
2386 switch (purple_blist_node_get_type(n1)) |
15817 | 2387 { |
15822 | 2388 case PURPLE_BLIST_CHAT_NODE: |
2389 s1 = purple_chat_get_name((PurpleChat*)n1); | |
2390 s2 = purple_chat_get_name((PurpleChat*)n2); | |
15817 | 2391 break; |
15822 | 2392 case PURPLE_BLIST_BUDDY_NODE: |
2393 return purple_presence_compare(purple_buddy_get_presence((PurpleBuddy*)n1), | |
2394 purple_buddy_get_presence((PurpleBuddy*)n2)); | |
15817 | 2395 break; |
15822 | 2396 case PURPLE_BLIST_CONTACT_NODE: |
2397 s1 = purple_contact_get_alias((PurpleContact*)n1); | |
2398 s2 = purple_contact_get_alias((PurpleContact*)n2); | |
15817 | 2399 break; |
2400 default: | |
16483
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2401 return blist_node_compare_position(n1, n2); |
15817 | 2402 } |
2403 | |
2404 us1 = g_utf8_strup(s1, -1); | |
2405 us2 = g_utf8_strup(s2, -1); | |
2406 ret = g_utf8_collate(us1, us2); | |
2407 g_free(us1); | |
2408 g_free(us2); | |
2409 | |
2410 return ret; | |
2411 } | |
2412 | |
2413 static int | |
15822 | 2414 blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2) |
15817 | 2415 { |
2416 int ret; | |
2417 | |
22212
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22192
diff
changeset
|
2418 if (purple_blist_node_get_type(n1) != purple_blist_node_get_type(n2)) |
17240
29b3dc9cc8c5
It's valid for different types to be compared. In that case, use existing positions.
Richard Nelson <wabz@pidgin.im>
parents:
17203
diff
changeset
|
2419 return blist_node_compare_position(n1, n2); |
15817 | 2420 |
22212
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22192
diff
changeset
|
2421 switch (purple_blist_node_get_type(n1)) { |
15822 | 2422 case PURPLE_BLIST_CONTACT_NODE: |
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
2423 n1 = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(n1))); |
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
25804
diff
changeset
|
2424 n2 = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(n2))); |
15817 | 2425 /* now compare the presence of the priority buddies */ |
15822 | 2426 case PURPLE_BLIST_BUDDY_NODE: |
2427 ret = purple_presence_compare(purple_buddy_get_presence((PurpleBuddy*)n1), | |
2428 purple_buddy_get_presence((PurpleBuddy*)n2)); | |
15817 | 2429 if (ret != 0) |
2430 return ret; | |
2431 break; | |
2432 default: | |
16483
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2433 return blist_node_compare_position(n1, n2); |
15817 | 2434 break; |
2435 } | |
2436 | |
2437 /* Sort alphabetically if presence is not comparable */ | |
2438 ret = blist_node_compare_text(n1, n2); | |
2439 | |
2440 return ret; | |
2441 } | |
2442 | |
2443 static int | |
15822 | 2444 get_contact_log_size(PurpleBlistNode *c) |
15817 | 2445 { |
2446 int log = 0; | |
15822 | 2447 PurpleBlistNode *node; |
15817 | 2448 |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
2449 for (node = purple_blist_node_get_first_child(c); node; node = purple_blist_node_get_sibling_next(node)) { |
15822 | 2450 PurpleBuddy *b = (PurpleBuddy*)node; |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
2451 log += purple_log_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b), |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
2452 purple_buddy_get_account(b)); |
15817 | 2453 } |
2454 | |
2455 return log; | |
2456 } | |
2457 | |
2458 static int | |
15822 | 2459 blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2) |
15817 | 2460 { |
2461 int ret; | |
15822 | 2462 PurpleBuddy *b1, *b2; |
15817 | 2463 |
22212
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22192
diff
changeset
|
2464 if (purple_blist_node_get_type(n1) != purple_blist_node_get_type(n2)) |
17240
29b3dc9cc8c5
It's valid for different types to be compared. In that case, use existing positions.
Richard Nelson <wabz@pidgin.im>
parents:
17203
diff
changeset
|
2465 return blist_node_compare_position(n1, n2); |
15817 | 2466 |
22212
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22192
diff
changeset
|
2467 switch (purple_blist_node_get_type(n1)) { |
15822 | 2468 case PURPLE_BLIST_BUDDY_NODE: |
2469 b1 = (PurpleBuddy*)n1; | |
2470 b2 = (PurpleBuddy*)n2; | |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
2471 ret = purple_log_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b2), purple_buddy_get_account(b2)) - |
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
2472 purple_log_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b1), purple_buddy_get_account(b1)); |
15817 | 2473 if (ret != 0) |
2474 return ret; | |
2475 break; | |
15822 | 2476 case PURPLE_BLIST_CONTACT_NODE: |
15817 | 2477 ret = get_contact_log_size(n2) - get_contact_log_size(n1); |
2478 if (ret != 0) | |
2479 return ret; | |
2480 break; | |
2481 default: | |
16483
0b97b224a829
Never change the orders of chats or the groups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
2482 return blist_node_compare_position(n1, n2); |
15817 | 2483 } |
2484 ret = blist_node_compare_text(n1, n2); | |
2485 return ret; | |
2486 } | |
2487 | |
2488 static void | |
2489 plugin_action(GntMenuItem *item, gpointer data) | |
2490 { | |
15822 | 2491 PurplePluginAction *action = data; |
15817 | 2492 if (action && action->callback) |
2493 action->callback(action); | |
2494 } | |
2495 | |
2496 static void | |
15822 | 2497 build_plugin_actions(GntMenuItem *item, PurplePlugin *plugin, gpointer context) |
15817 | 2498 { |
2499 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); | |
2500 GList *actions; | |
2501 GntMenuItem *menuitem; | |
2502 | |
2503 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); | |
15822 | 2504 for (actions = PURPLE_PLUGIN_ACTIONS(plugin, context); actions; |
15817 | 2505 actions = g_list_delete_link(actions, actions)) { |
2506 if (actions->data) { | |
15822 | 2507 PurplePluginAction *action = actions->data; |
15817 | 2508 action->plugin = plugin; |
2509 action->context = context; | |
2510 menuitem = gnt_menuitem_new(action->label); | |
2511 gnt_menu_add_item(GNT_MENU(sub), menuitem); | |
2512 | |
2513 gnt_menuitem_set_callback(menuitem, plugin_action, action); | |
2514 g_object_set_data_full(G_OBJECT(menuitem), "plugin_action", | |
15822 | 2515 action, (GDestroyNotify)purple_plugin_action_free); |
15817 | 2516 } |
2517 } | |
2518 } | |
2519 | |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2520 static gboolean |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2521 buddy_recent_signed_on_off(gpointer data) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2522 { |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2523 PurpleBlistNode *node = data; |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
2524 FinchBlistNode *fnode = FINCH_GET_DATA(node); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2525 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2526 purple_timeout_remove(fnode->signed_timer); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2527 fnode->signed_timer = 0; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2528 |
22181
8509419a666c
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 <imadil@gmail.com>
parents:
22178
diff
changeset
|
2529 if (!ggblist->manager->can_add_node(node)) { |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2530 node_remove(purple_get_blist(), node); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2531 } else { |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2532 update_node_display(node, ggblist); |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
2533 if (purple_blist_node_get_parent(node) && PURPLE_BLIST_NODE_IS_CONTACT(purple_blist_node_get_parent(node))) |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
2534 update_node_display(purple_blist_node_get_parent(node), ggblist); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2535 } |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2536 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2537 return FALSE; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2538 } |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2539 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2540 static gboolean |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2541 buddy_signed_on_off_cb(gpointer data) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2542 { |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2543 PurpleBlistNode *node = data; |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
2544 FinchBlistNode *fnode = FINCH_GET_DATA(node); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2545 if (!ggblist || !fnode) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2546 return FALSE; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2547 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2548 if (fnode->signed_timer) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2549 purple_timeout_remove(fnode->signed_timer); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2550 fnode->signed_timer = purple_timeout_add_seconds(6, (GSourceFunc)buddy_recent_signed_on_off, data); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2551 update_node_display(node, ggblist); |
22168
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
2552 if (purple_blist_node_get_parent(node) && PURPLE_BLIST_NODE_IS_CONTACT(purple_blist_node_get_parent(node))) |
2bff44d78523
Add some accessor functions for PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22012
diff
changeset
|
2553 update_node_display(purple_blist_node_get_parent(node), ggblist); |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2554 return FALSE; |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2555 } |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2556 |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2557 static void |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2558 buddy_signed_on_off(PurpleBuddy* buddy, gpointer null) |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2559 { |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2560 g_idle_add(buddy_signed_on_off_cb, buddy); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2561 } |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
2562 |
15817 | 2563 static void |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21738
diff
changeset
|
2564 reconstruct_plugins_menu(void) |
15817 | 2565 { |
2566 GntWidget *sub; | |
2567 GntMenuItem *plg; | |
2568 GList *iter; | |
2569 | |
2570 if (!ggblist) | |
2571 return; | |
2572 | |
2573 if (ggblist->plugins == NULL) | |
2574 ggblist->plugins = gnt_menuitem_new(_("Plugins")); | |
2575 | |
2576 plg = ggblist->plugins; | |
2577 sub = gnt_menu_new(GNT_MENU_POPUP); | |
2578 gnt_menuitem_set_submenu(plg, GNT_MENU(sub)); | |
2579 | |
15822 | 2580 for (iter = purple_plugins_get_loaded(); iter; iter = iter->next) { |
2581 PurplePlugin *plugin = iter->data; | |
15817 | 2582 GntMenuItem *item; |
15822 | 2583 if (PURPLE_IS_PROTOCOL_PLUGIN(plugin)) |
15817 | 2584 continue; |
2585 | |
15822 | 2586 if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin)) |
15817 | 2587 continue; |
2588 | |
2589 item = gnt_menuitem_new(_(plugin->info->name)); | |
2590 gnt_menu_add_item(GNT_MENU(sub), item); | |
2591 build_plugin_actions(item, plugin, NULL); | |
2592 } | |
2593 } | |
2594 | |
2595 static void | |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21738
diff
changeset
|
2596 reconstruct_accounts_menu(void) |
15817 | 2597 { |
2598 GntWidget *sub; | |
2599 GntMenuItem *acc, *item; | |
2600 GList *iter; | |
2601 | |
2602 if (!ggblist) | |
2603 return; | |
2604 | |
2605 if (ggblist->accounts == NULL) | |
2606 ggblist->accounts = gnt_menuitem_new(_("Accounts")); | |
2607 | |
2608 acc = ggblist->accounts; | |
2609 sub = gnt_menu_new(GNT_MENU_POPUP); | |
2610 gnt_menuitem_set_submenu(acc, GNT_MENU(sub)); | |
2611 | |
15822 | 2612 for (iter = purple_accounts_get_all_active(); iter; |
15817 | 2613 iter = g_list_delete_link(iter, iter)) { |
15822 | 2614 PurpleAccount *account = iter->data; |
2615 PurpleConnection *gc = purple_account_get_connection(account); | |
2616 PurplePlugin *prpl; | |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2617 |
15822 | 2618 if (!gc || !PURPLE_CONNECTION_IS_CONNECTED(gc)) |
15817 | 2619 continue; |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
2620 prpl = purple_connection_get_prpl(gc); |
15817 | 2621 |
15822 | 2622 if (PURPLE_PLUGIN_HAS_ACTIONS(prpl)) { |
2623 item = gnt_menuitem_new(purple_account_get_username(account)); | |
15817 | 2624 gnt_menu_add_item(GNT_MENU(sub), item); |
2625 build_plugin_actions(item, prpl, gc); | |
2626 } | |
2627 } | |
2628 } | |
2629 | |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2630 static void |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2631 reconstruct_grouping_menu(void) |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2632 { |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2633 GList *iter; |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2634 GntWidget *subsub; |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2635 |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2636 if (!ggblist || !ggblist->grouping) |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2637 return; |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2638 |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2639 subsub = gnt_menu_new(GNT_MENU_POPUP); |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2640 gnt_menuitem_set_submenu(ggblist->grouping, GNT_MENU(subsub)); |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2641 |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2642 for (iter = managers; iter; iter = iter->next) { |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2643 char menuid[128]; |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2644 FinchBlistManager *manager = iter->data; |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2645 GntMenuItem *item = gnt_menuitem_new(_(manager->name)); |
25568
e0c8f689f60c
applied changes from aa7ce93329f5ccbe74640a92b6656ae402d8eea8
Ethan Blanton <elb@pidgin.im>
parents:
24537
diff
changeset
|
2646 g_snprintf(menuid, sizeof(menuid), "grouping-%s", manager->id); |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2647 gnt_menuitem_set_id(GNT_MENU_ITEM(item), menuid); |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2648 gnt_menu_add_item(GNT_MENU(subsub), item); |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2649 g_object_set_data_full(G_OBJECT(item), "grouping-id", g_strdup(manager->id), g_free); |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2650 gnt_menuitem_set_callback(item, menu_group_set_cb, NULL); |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2651 } |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2652 } |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
2653 |
19375
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2654 static gboolean |
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2655 auto_join_chats(gpointer data) |
15817 | 2656 { |
15822 | 2657 PurpleBlistNode *node; |
19375
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2658 PurpleConnection *pc = data; |
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2659 PurpleAccount *account = purple_connection_get_account(pc); |
15817 | 2660 |
15822 | 2661 for (node = purple_blist_get_root(); node; |
2662 node = purple_blist_node_next(node, FALSE)) { | |
2663 if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | |
2664 PurpleChat *chat = (PurpleChat*)node; | |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
2665 if (purple_chat_get_account(chat) == account && |
16771
d7ad8013b914
Fix this spectacularly braindead code. I must've been on the good stuff when I wrote this. Fixes #364.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16655
diff
changeset
|
2666 purple_blist_node_get_bool(node, "gnt-autojoin")) |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
2667 serv_join_chat(purple_account_get_connection(account), purple_chat_get_components(chat)); |
15817 | 2668 } |
2669 } | |
19375
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2670 return FALSE; |
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2671 } |
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2672 |
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2673 static void |
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2674 account_signed_on_cb(PurpleConnection *gc, gpointer null) |
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2675 { |
f520bf6dd4bc
I think this fixes the auto-rejoin-after-auto-reconnect bug in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19305
diff
changeset
|
2676 g_idle_add(auto_join_chats, gc); |
15817 | 2677 } |
18442
6d8aed4adcd6
Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18441
diff
changeset
|
2678 |
6d8aed4adcd6
Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18441
diff
changeset
|
2679 static void toggle_pref_cb(GntMenuItem *item, gpointer n) |
18441
24ecab0d40b3
Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18437
diff
changeset
|
2680 { |
18442
6d8aed4adcd6
Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18441
diff
changeset
|
2681 purple_prefs_set_bool(n, !purple_prefs_get_bool(n)); |
15817 | 2682 } |
2683 | |
2684 static void sort_blist_change_cb(GntMenuItem *item, gpointer n) | |
2685 { | |
15822 | 2686 purple_prefs_set_string(PREF_ROOT "/sort_type", n); |
15817 | 2687 } |
2688 | |
22250
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2689 static void |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2690 block_select_cb(gpointer data, PurpleRequestFields *fields) |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2691 { |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2692 PurpleAccount *account = purple_request_fields_get_account(fields, "account"); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2693 const char *name = purple_request_fields_get_string(fields, "screenname"); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2694 if (account && name && *name != '\0') { |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2695 if (purple_request_fields_get_choice(fields, "block") == 1) { |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2696 purple_privacy_deny(account, name, FALSE, FALSE); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2697 } else { |
22251 | 2698 purple_privacy_allow(account, name, FALSE, FALSE); |
22250
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2699 } |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2700 } |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2701 } |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2702 |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2703 static void |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2704 block_select(GntMenuItem *item, gpointer n) |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2705 { |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2706 PurpleRequestFields *fields; |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2707 PurpleRequestFieldGroup *group; |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2708 PurpleRequestField *field; |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2709 |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2710 fields = purple_request_fields_new(); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2711 |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2712 group = purple_request_field_group_new(NULL); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2713 purple_request_fields_add_group(fields, group); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2714 |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2715 field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2716 purple_request_field_set_type_hint(field, "screenname"); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2717 purple_request_field_set_required(field, TRUE); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2718 purple_request_field_group_add_field(group, field); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2719 |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2720 field = purple_request_field_account_new("account", _("Account"), NULL); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2721 purple_request_field_set_type_hint(field, "account"); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2722 purple_request_field_set_visible(field, |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2723 (purple_connections_get_all() != NULL && |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2724 purple_connections_get_all()->next != NULL)); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2725 purple_request_field_set_required(field, TRUE); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2726 purple_request_field_group_add_field(group, field); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2727 |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2728 field = purple_request_field_choice_new("block", _("Block/Unblock"), 1); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2729 purple_request_field_choice_add(field, _("Block")); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2730 purple_request_field_choice_add(field, _("Unblock")); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2731 purple_request_field_group_add_field(group, field); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2732 |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2733 purple_request_fields(purple_get_blist(), _("Block/Unblock"), |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2734 NULL, |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22786
diff
changeset
|
2735 _("Please enter the username or alias of the person " |
22250
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2736 "you would like to Block/Unblock."), |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2737 fields, |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2738 _("OK"), G_CALLBACK(block_select_cb), |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2739 _("Cancel"), NULL, |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2740 NULL, NULL, NULL, |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2741 NULL); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2742 } |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2743 |
18428
1dbd8ce2f11f
Fix a bug where buddies from offline accounts were showing up.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
2744 /* send_im_select* -- Xerox */ |
15817 | 2745 static void |
15822 | 2746 send_im_select_cb(gpointer data, PurpleRequestFields *fields) |
15817 | 2747 { |
15822 | 2748 PurpleAccount *account; |
15817 | 2749 const char *username; |
22429
b0b8c94118c8
Make sure an existing conversation selected from the 'Send IM' dialog is given the focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22356
diff
changeset
|
2750 PurpleConversation *conv; |
15817 | 2751 |
15822 | 2752 account = purple_request_fields_get_account(fields, "account"); |
2753 username = purple_request_fields_get_string(fields, "screenname"); | |
15817 | 2754 |
22429
b0b8c94118c8
Make sure an existing conversation selected from the 'Send IM' dialog is given the focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22356
diff
changeset
|
2755 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username); |
b0b8c94118c8
Make sure an existing conversation selected from the 'Send IM' dialog is given the focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22356
diff
changeset
|
2756 purple_conversation_present(conv); |
15817 | 2757 } |
2758 | |
2759 static void | |
2760 send_im_select(GntMenuItem *item, gpointer n) | |
2761 { | |
15822 | 2762 PurpleRequestFields *fields; |
2763 PurpleRequestFieldGroup *group; | |
2764 PurpleRequestField *field; | |
15817 | 2765 |
15822 | 2766 fields = purple_request_fields_new(); |
15817 | 2767 |
15822 | 2768 group = purple_request_field_group_new(NULL); |
2769 purple_request_fields_add_group(fields, group); | |
15817 | 2770 |
20739
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2771 field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE); |
15822 | 2772 purple_request_field_set_type_hint(field, "screenname"); |
2773 purple_request_field_set_required(field, TRUE); | |
2774 purple_request_field_group_add_field(group, field); | |
15817 | 2775 |
20739
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2776 field = purple_request_field_account_new("account", _("Account"), NULL); |
15822 | 2777 purple_request_field_set_type_hint(field, "account"); |
2778 purple_request_field_set_visible(field, | |
2779 (purple_connections_get_all() != NULL && | |
2780 purple_connections_get_all()->next != NULL)); | |
2781 purple_request_field_set_required(field, TRUE); | |
2782 purple_request_field_group_add_field(group, field); | |
15817 | 2783 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2784 purple_request_fields(purple_get_blist(), _("New Instant Message"), |
15817 | 2785 NULL, |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22786
diff
changeset
|
2786 _("Please enter the username or alias of the person " |
15817 | 2787 "you would like to IM."), |
2788 fields, | |
2789 _("OK"), G_CALLBACK(send_im_select_cb), | |
2790 _("Cancel"), NULL, | |
16439
08db93bbd798
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 <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
2791 NULL, NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2792 NULL); |
15817 | 2793 } |
2794 | |
2795 static void | |
20739
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2796 join_chat_select_cb(gpointer data, PurpleRequestFields *fields) |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2797 { |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2798 PurpleAccount *account; |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2799 const char *name; |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2800 PurpleConnection *gc; |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2801 PurpleChat *chat; |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2802 GHashTable *hash = NULL; |
23279
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2803 PurpleConversation *conv; |
20739
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2804 |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2805 account = purple_request_fields_get_account(fields, "account"); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2806 name = purple_request_fields_get_string(fields, "chat"); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2807 |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2808 if (!purple_account_is_connected(account)) |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2809 return; |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2810 |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
2811 gc = purple_account_get_connection(account); |
23279
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2812 /* Create a new conversation now. This will give focus to the new window. |
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2813 * But it's necessary to pretend that we left the chat, because otherwise |
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2814 * a new conversation window will pop up when we finally join the chat. */ |
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2815 if (!(conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, name, account))) { |
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2816 conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); |
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2817 purple_conv_chat_left(PURPLE_CONV_CHAT(conv)); |
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2818 } else { |
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2819 purple_conversation_present(conv); |
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2820 } |
a601807bae2b
Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22840
diff
changeset
|
2821 |
20739
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2822 chat = purple_blist_find_chat(account, name); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2823 if (chat == NULL) { |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
2824 PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
2825 if (info->chat_info_defaults != NULL) |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22213
diff
changeset
|
2826 hash = info->chat_info_defaults(gc, name); |
20739
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2827 } else { |
22219
797230b3e48e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
2828 hash = purple_chat_get_components(chat); |
20739
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2829 } |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2830 serv_join_chat(gc, hash); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2831 if (chat == NULL && hash != NULL) |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2832 g_hash_table_destroy(hash); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2833 } |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2834 |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2835 static void |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2836 join_chat_select(GntMenuItem *item, gpointer n) |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2837 { |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2838 PurpleRequestFields *fields; |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2839 PurpleRequestFieldGroup *group; |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2840 PurpleRequestField *field; |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2841 |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2842 fields = purple_request_fields_new(); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2843 |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2844 group = purple_request_field_group_new(NULL); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2845 purple_request_fields_add_group(fields, group); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2846 |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2847 field = purple_request_field_string_new("chat", _("Channel"), NULL, FALSE); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2848 purple_request_field_set_required(field, TRUE); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2849 purple_request_field_group_add_field(group, field); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2850 |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2851 field = purple_request_field_account_new("account", _("Account"), NULL); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2852 purple_request_field_set_type_hint(field, "account"); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2853 purple_request_field_set_visible(field, |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2854 (purple_connections_get_all() != NULL && |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2855 purple_connections_get_all()->next != NULL)); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2856 purple_request_field_set_required(field, TRUE); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2857 purple_request_field_group_add_field(group, field); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2858 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2859 purple_request_fields(purple_get_blist(), _("Join a Chat"), |
20739
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2860 NULL, |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2861 _("Please enter the name of the chat you want to join."), |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2862 fields, |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2863 _("Join"), G_CALLBACK(join_chat_select_cb), |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2864 _("Cancel"), NULL, |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2865 NULL, NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2866 NULL); |
15817 | 2867 } |
2868 | |
2869 static void | |
22840
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2870 view_log_select_cb(gpointer data, PurpleRequestFields *fields) |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2871 { |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2872 PurpleAccount *account; |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2873 const char *name; |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2874 PurpleBuddy *buddy; |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2875 PurpleContact *contact; |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2876 |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2877 account = purple_request_fields_get_account(fields, "account"); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2878 name = purple_request_fields_get_string(fields, "screenname"); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2879 |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2880 buddy = purple_find_buddy(account, name); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2881 if (buddy) { |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2882 contact = purple_buddy_get_contact(buddy); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2883 } else { |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2884 contact = NULL; |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2885 } |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2886 |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2887 if (contact) { |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2888 finch_log_show_contact(contact); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2889 } else { |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2890 finch_log_show(PURPLE_LOG_IM, name, account); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2891 } |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2892 } |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2893 |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2894 static void |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2895 view_log_cb(GntMenuItem *item, gpointer n) |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2896 { |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2897 PurpleRequestFields *fields; |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2898 PurpleRequestFieldGroup *group; |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2899 PurpleRequestField *field; |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2900 |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2901 fields = purple_request_fields_new(); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2902 |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2903 group = purple_request_field_group_new(NULL); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2904 purple_request_fields_add_group(fields, group); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2905 |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2906 field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2907 purple_request_field_set_type_hint(field, "screenname-all"); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2908 purple_request_field_set_required(field, TRUE); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2909 purple_request_field_group_add_field(group, field); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2910 |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2911 field = purple_request_field_account_new("account", _("Account"), NULL); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2912 purple_request_field_set_type_hint(field, "account"); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2913 purple_request_field_set_visible(field, |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2914 (purple_accounts_get_all() != NULL && |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2915 purple_accounts_get_all()->next != NULL)); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2916 purple_request_field_set_required(field, TRUE); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2917 purple_request_field_group_add_field(group, field); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2918 purple_request_field_account_set_show_all(field, TRUE); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2919 |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2920 purple_request_fields(purple_get_blist(), _("View Log"), |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2921 NULL, |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2922 _("Please enter the username or alias of the person " |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2923 "whose log you would like to view."), |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2924 fields, |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2925 _("OK"), G_CALLBACK(view_log_select_cb), |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2926 _("Cancel"), NULL, |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2927 NULL, NULL, NULL, |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2928 NULL); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2929 } |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2930 |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2931 static void |
23288
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
2932 view_all_logs_cb(GntMenuItem *item, gpointer n) |
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
2933 { |
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
2934 finch_log_show(PURPLE_LOG_IM, NULL, NULL); |
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
2935 } |
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
2936 |
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
2937 static void |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2938 menu_add_buddy_cb(GntMenuItem *item, gpointer null) |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2939 { |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2940 purple_blist_request_add_buddy(NULL, NULL, NULL, NULL); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2941 } |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2942 |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2943 static void |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2944 menu_add_chat_cb(GntMenuItem *item, gpointer null) |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2945 { |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2946 purple_blist_request_add_chat(NULL, NULL, NULL, NULL); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2947 } |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2948 |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2949 static void |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2950 menu_add_group_cb(GntMenuItem *item, gpointer null) |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2951 { |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2952 purple_blist_request_add_group(); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2953 } |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2954 |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2955 static void |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2956 menu_group_set_cb(GntMenuItem *item, gpointer null) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2957 { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2958 const char *id = g_object_get_data(G_OBJECT(item), "grouping-id"); |
22178
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
2959 purple_prefs_set_string(PREF_ROOT "/grouping", id); |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2960 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2961 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
2962 static void |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21738
diff
changeset
|
2963 create_menu(void) |
15817 | 2964 { |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
2965 GntWidget *menu, *sub, *subsub; |
15817 | 2966 GntMenuItem *item; |
2967 GntWindow *window; | |
2968 | |
2969 if (!ggblist) | |
2970 return; | |
2971 | |
2972 window = GNT_WINDOW(ggblist->window); | |
2973 ggblist->menu = menu = gnt_menu_new(GNT_MENU_TOPLEVEL); | |
2974 gnt_window_set_menu(window, GNT_MENU(menu)); | |
2975 | |
2976 item = gnt_menuitem_new(_("Options")); | |
2977 gnt_menu_add_item(GNT_MENU(menu), item); | |
2978 | |
2979 sub = gnt_menu_new(GNT_MENU_POPUP); | |
2980 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); | |
2981 | |
2982 item = gnt_menuitem_new(_("Send IM...")); | |
21214
05bb2853f350
Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20739
diff
changeset
|
2983 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "send-im"); |
15817 | 2984 gnt_menu_add_item(GNT_MENU(sub), item); |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15870
diff
changeset
|
2985 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), send_im_select, NULL); |
15817 | 2986 |
22250
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2987 item = gnt_menuitem_new(_("Block/Unblock...")); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2988 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "block-unblock"); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2989 gnt_menu_add_item(GNT_MENU(sub), item); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2990 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), block_select, NULL); |
9b620ed4fbc4
Add a [X] Blocked item to the buddy context menu, and add a dialog to
Richard Nelson <wabz@pidgin.im>
parents:
22248
diff
changeset
|
2991 |
20739
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2992 item = gnt_menuitem_new(_("Join Chat...")); |
21214
05bb2853f350
Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20739
diff
changeset
|
2993 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "join-chat"); |
20739
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2994 gnt_menu_add_item(GNT_MENU(sub), item); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2995 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), join_chat_select, NULL); |
3f9520e09805
Add a 'Join Chat...' item in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20625
diff
changeset
|
2996 |
22840
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2997 item = gnt_menuitem_new(_("View Log...")); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2998 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "view-log"); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
2999 gnt_menu_add_item(GNT_MENU(sub), item); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
3000 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), view_log_cb, NULL); |
04e0d8677b9a
Add a 'View log' option in the buddylist menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22838
diff
changeset
|
3001 |
23288
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
3002 item = gnt_menuitem_new(_("View All Logs")); |
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
3003 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "view-all-logs"); |
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
3004 gnt_menu_add_item(GNT_MENU(sub), item); |
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
3005 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), view_all_logs_cb, NULL); |
5f9793c8510a
Added "View All Logs" menu in the buddylist to display a list of all IM
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23279
diff
changeset
|
3006 |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3007 item = gnt_menuitem_new(_("Show")); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3008 gnt_menu_add_item(GNT_MENU(sub), item); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3009 subsub = gnt_menu_new(GNT_MENU_POPUP); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3010 gnt_menuitem_set_submenu(item, GNT_MENU(subsub)); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3011 |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3012 item = gnt_menuitem_check_new(_("Empty groups")); |
21214
05bb2853f350
Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20739
diff
changeset
|
3013 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "show-empty-groups"); |
18441
24ecab0d40b3
Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18437
diff
changeset
|
3014 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), |
24ecab0d40b3
Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18437
diff
changeset
|
3015 purple_prefs_get_bool(PREF_ROOT "/emptygroups")); |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3016 gnt_menu_add_item(GNT_MENU(subsub), item); |
18442
6d8aed4adcd6
Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18441
diff
changeset
|
3017 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), toggle_pref_cb, PREF_ROOT "/emptygroups"); |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
3018 |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3019 item = gnt_menuitem_check_new(_("Offline buddies")); |
21214
05bb2853f350
Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20739
diff
changeset
|
3020 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "show-offline-buddies"); |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15870
diff
changeset
|
3021 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), |
15822 | 3022 purple_prefs_get_bool(PREF_ROOT "/showoffline")); |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3023 gnt_menu_add_item(GNT_MENU(subsub), item); |
18442
6d8aed4adcd6
Minor changes to remove a couple of lines of duplication.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18441
diff
changeset
|
3024 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), toggle_pref_cb, PREF_ROOT "/showoffline"); |
15817 | 3025 |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3026 item = gnt_menuitem_new(_("Sort")); |
15817 | 3027 gnt_menu_add_item(GNT_MENU(sub), item); |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3028 subsub = gnt_menu_new(GNT_MENU_POPUP); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3029 gnt_menuitem_set_submenu(item, GNT_MENU(subsub)); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3030 |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3031 item = gnt_menuitem_new(_("By Status")); |
21214
05bb2853f350
Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20739
diff
changeset
|
3032 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "sort-status"); |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3033 gnt_menu_add_item(GNT_MENU(subsub), item); |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15870
diff
changeset
|
3034 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), sort_blist_change_cb, "status"); |
15817 | 3035 |
20597
591267f6f1d5
propagate from branch 'im.pidgin.pidgin' (head 025faf23aaac403798451974c320c4de6df470d5)
Gabriel Schulhof <nix@go-nix.ca>
diff
changeset
|
3036 item = gnt_menuitem_new(_("Alphabetically")); |
21214
05bb2853f350
Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20739
diff
changeset
|
3037 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "sort-alpha"); |
20597
591267f6f1d5
propagate from branch 'im.pidgin.pidgin' (head 025faf23aaac403798451974c320c4de6df470d5)
Gabriel Schulhof <nix@go-nix.ca>
diff
changeset
|
3038 gnt_menu_add_item(GNT_MENU(subsub), item); |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15870
diff
changeset
|
3039 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), sort_blist_change_cb, "text"); |
15817 | 3040 |
20604
6c6fd163a992
Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents:
20603
diff
changeset
|
3041 item = gnt_menuitem_new(_("By Log Size")); |
21214
05bb2853f350
Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20739
diff
changeset
|
3042 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "sort-log"); |
20604
6c6fd163a992
Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents:
20603
diff
changeset
|
3043 gnt_menu_add_item(GNT_MENU(subsub), item); |
6c6fd163a992
Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents:
20603
diff
changeset
|
3044 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), sort_blist_change_cb, "log"); |
6c6fd163a992
Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents:
20603
diff
changeset
|
3045 |
6c6fd163a992
Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents:
20603
diff
changeset
|
3046 item = gnt_menuitem_new(_("Add")); |
15817 | 3047 gnt_menu_add_item(GNT_MENU(sub), item); |
20604
6c6fd163a992
Restoring gntblist.c:create_menu
Gabriel Schulhof <nix@go-nix.ca>
parents:
20603
diff
changeset
|
3048 |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3049 subsub = gnt_menu_new(GNT_MENU_POPUP); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3050 gnt_menuitem_set_submenu(item, GNT_MENU(subsub)); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3051 |
22174
18ad08694be4
Mark some strings for translation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22172
diff
changeset
|
3052 item = gnt_menuitem_new(_("Buddy")); |
21214
05bb2853f350
Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20739
diff
changeset
|
3053 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "add-buddy"); |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3054 gnt_menu_add_item(GNT_MENU(subsub), item); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3055 gnt_menuitem_set_callback(item, menu_add_buddy_cb, NULL); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3056 |
22174
18ad08694be4
Mark some strings for translation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22172
diff
changeset
|
3057 item = gnt_menuitem_new(_("Chat")); |
21214
05bb2853f350
Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20739
diff
changeset
|
3058 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "add-chat"); |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3059 gnt_menu_add_item(GNT_MENU(subsub), item); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3060 gnt_menuitem_set_callback(item, menu_add_chat_cb, NULL); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3061 |
22174
18ad08694be4
Mark some strings for translation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22172
diff
changeset
|
3062 item = gnt_menuitem_new(_("Group")); |
21214
05bb2853f350
Add IDs to the menuitems in the buddylist menu so they can have acceletor keys.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20739
diff
changeset
|
3063 gnt_menuitem_set_id(GNT_MENU_ITEM(item), "add-group"); |
20561
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3064 gnt_menu_add_item(GNT_MENU(subsub), item); |
c7b2c6ae3bea
Re-arrange the menu. Add 'Add buddy/chat/group' in the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
3065 gnt_menuitem_set_callback(item, menu_add_group_cb, NULL); |
15817 | 3066 |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
3067 ggblist->grouping = item = gnt_menuitem_new(_("Grouping")); |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3068 gnt_menu_add_item(GNT_MENU(sub), item); |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
3069 reconstruct_grouping_menu(); |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3070 |
15817 | 3071 reconstruct_accounts_menu(); |
3072 gnt_menu_add_item(GNT_MENU(menu), ggblist->accounts); | |
3073 | |
3074 reconstruct_plugins_menu(); | |
3075 gnt_menu_add_item(GNT_MENU(menu), ggblist->plugins); | |
3076 } | |
3077 | |
3078 void finch_blist_show() | |
3079 { | |
15822 | 3080 blist_show(purple_get_blist()); |
15817 | 3081 } |
3082 | |
3083 static void | |
16105
1983ecd15174
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15928
diff
changeset
|
3084 group_collapsed(GntWidget *widget, PurpleBlistNode *node, gboolean collapsed, gpointer null) |
1983ecd15174
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15928
diff
changeset
|
3085 { |
16106 | 3086 if (PURPLE_BLIST_NODE_IS_GROUP(node)) |
3087 purple_blist_node_set_bool(node, "collapsed", collapsed); | |
16105
1983ecd15174
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15928
diff
changeset
|
3088 } |
1983ecd15174
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15928
diff
changeset
|
3089 |
1983ecd15174
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15928
diff
changeset
|
3090 static void |
15822 | 3091 blist_show(PurpleBuddyList *list) |
15817 | 3092 { |
3093 if (ggblist == NULL) | |
3094 new_list(list); | |
18345
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18332
diff
changeset
|
3095 else if (ggblist->window) { |
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18332
diff
changeset
|
3096 gnt_window_present(ggblist->window); |
15817 | 3097 return; |
18345
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18332
diff
changeset
|
3098 } |
15817 | 3099 |
3100 ggblist->window = gnt_vwindow_new(FALSE); | |
3101 gnt_widget_set_name(ggblist->window, "buddylist"); | |
3102 gnt_box_set_toplevel(GNT_BOX(ggblist->window), TRUE); | |
3103 gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List")); | |
3104 gnt_box_set_pad(GNT_BOX(ggblist->window), 0); | |
3105 | |
3106 ggblist->tree = gnt_tree_new(); | |
3107 | |
3108 GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER); | |
15822 | 3109 gnt_widget_set_size(ggblist->tree, purple_prefs_get_int(PREF_ROOT "/size/width"), |
3110 purple_prefs_get_int(PREF_ROOT "/size/height")); | |
3111 gnt_widget_set_position(ggblist->window, purple_prefs_get_int(PREF_ROOT "/position/x"), | |
3112 purple_prefs_get_int(PREF_ROOT "/position/y")); | |
15817 | 3113 |
3114 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); | |
3115 | |
3116 ggblist->status = gnt_combo_box_new(); | |
3117 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->status); | |
3118 ggblist->statustext = gnt_entry_new(NULL); | |
3119 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->statustext); | |
3120 | |
3121 gnt_widget_show(ggblist->window); | |
3122 | |
15822 | 3123 purple_signal_connect(purple_connections_get_handle(), "signed-on", finch_blist_get_handle(), |
3124 PURPLE_CALLBACK(reconstruct_accounts_menu), NULL); | |
3125 purple_signal_connect(purple_connections_get_handle(), "signed-off", finch_blist_get_handle(), | |
3126 PURPLE_CALLBACK(reconstruct_accounts_menu), NULL); | |
26694
83e6e710cbf3
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <paul@darkrain42.org>
parents:
26650
diff
changeset
|
3127 purple_signal_connect(purple_accounts_get_handle(), "account-actions-changed", finch_blist_get_handle(), |
83e6e710cbf3
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <paul@darkrain42.org>
parents:
26650
diff
changeset
|
3128 PURPLE_CALLBACK(reconstruct_accounts_menu), NULL); |
15822 | 3129 purple_signal_connect(purple_blist_get_handle(), "buddy-status-changed", finch_blist_get_handle(), |
3130 PURPLE_CALLBACK(buddy_status_changed), ggblist); | |
3131 purple_signal_connect(purple_blist_get_handle(), "buddy-idle-changed", finch_blist_get_handle(), | |
3132 PURPLE_CALLBACK(buddy_idle_changed), ggblist); | |
15817 | 3133 |
15822 | 3134 purple_signal_connect(purple_plugins_get_handle(), "plugin-load", finch_blist_get_handle(), |
3135 PURPLE_CALLBACK(reconstruct_plugins_menu), NULL); | |
3136 purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", finch_blist_get_handle(), | |
3137 PURPLE_CALLBACK(reconstruct_plugins_menu), NULL); | |
15817 | 3138 |
21981
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
3139 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", finch_blist_get_handle(), |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
3140 PURPLE_CALLBACK(buddy_signed_on_off), ggblist); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
3141 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", finch_blist_get_handle(), |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
3142 PURPLE_CALLBACK(buddy_signed_on_off), ggblist); |
05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21738
diff
changeset
|
3143 |
15817 | 3144 #if 0 |
3145 /* These I plan to use to indicate unread-messages etc. */ | |
15822 | 3146 purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", finch_blist_get_handle(), |
3147 PURPLE_CALLBACK(received_im_msg), list); | |
3148 purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg", finch_blist_get_handle(), | |
3149 PURPLE_CALLBACK(sent_im_msg), NULL); | |
15817 | 3150 |
15822 | 3151 purple_signal_connect(purple_conversations_get_handle(), "received-chat-msg", finch_blist_get_handle(), |
3152 PURPLE_CALLBACK(received_chat_msg), list); | |
15817 | 3153 #endif |
3154 | |
3155 g_signal_connect(G_OBJECT(ggblist->tree), "selection_changed", G_CALLBACK(selection_changed), ggblist); | |
3156 g_signal_connect(G_OBJECT(ggblist->tree), "key_pressed", G_CALLBACK(key_pressed), ggblist); | |
3157 g_signal_connect(G_OBJECT(ggblist->tree), "context-menu", G_CALLBACK(context_menu), ggblist); | |
16105
1983ecd15174
Remember the collapsed state of groups in the blist
Richard Nelson <wabz@pidgin.im>
parents:
15928
diff
changeset
|
3158 g_signal_connect(G_OBJECT(ggblist->tree), "collapse-toggled", G_CALLBACK(group_collapsed), NULL); |
15817 | 3159 g_signal_connect(G_OBJECT(ggblist->tree), "activate", G_CALLBACK(selection_activate), ggblist); |
3160 g_signal_connect_data(G_OBJECT(ggblist->tree), "gained-focus", G_CALLBACK(draw_tooltip), | |
3161 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); | |
3162 g_signal_connect_data(G_OBJECT(ggblist->tree), "lost-focus", G_CALLBACK(remove_peripherals), | |
3163 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); | |
17707
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
16655
diff
changeset
|
3164 g_signal_connect_data(G_OBJECT(ggblist->window), "workspace-hidden", G_CALLBACK(remove_peripherals), |
3c3fc1432a01
Let windows know when the workspace they are in is being hidden/shown
Richard Nelson <wabz@pidgin.im>
parents:
16655
diff
changeset
|
3165 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); |
15817 | 3166 g_signal_connect(G_OBJECT(ggblist->tree), "size_changed", G_CALLBACK(size_changed_cb), NULL); |
3167 g_signal_connect(G_OBJECT(ggblist->window), "position_set", G_CALLBACK(save_position_cb), NULL); | |
3168 g_signal_connect(G_OBJECT(ggblist->window), "destroy", G_CALLBACK(reset_blist_window), NULL); | |
3169 | |
3170 /* Status signals */ | |
15822 | 3171 purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-changed", finch_blist_get_handle(), |
3172 PURPLE_CALLBACK(savedstatus_changed), NULL); | |
15817 | 3173 g_signal_connect(G_OBJECT(ggblist->status), "selection_changed", |
3174 G_CALLBACK(status_selection_changed), NULL); | |
3175 g_signal_connect(G_OBJECT(ggblist->statustext), "key_pressed", | |
3176 G_CALLBACK(status_text_changed), NULL); | |
3177 | |
3178 create_menu(); | |
3179 | |
3180 populate_buddylist(); | |
3181 | |
15822 | 3182 savedstatus_changed(purple_savedstatus_get_current(), NULL); |
15817 | 3183 } |
3184 | |
3185 void finch_blist_uninit() | |
3186 { | |
3187 if (ggblist == NULL) | |
3188 return; | |
3189 | |
3190 gnt_widget_destroy(ggblist->window); | |
3191 g_free(ggblist); | |
3192 ggblist = NULL; | |
3193 } | |
3194 | |
3195 gboolean finch_blist_get_position(int *x, int *y) | |
3196 { | |
3197 if (!ggblist || !ggblist->window) | |
3198 return FALSE; | |
3199 gnt_widget_get_position(ggblist->window, x, y); | |
3200 return TRUE; | |
3201 } | |
3202 | |
3203 void finch_blist_set_position(int x, int y) | |
3204 { | |
3205 gnt_widget_set_position(ggblist->window, x, y); | |
3206 } | |
3207 | |
3208 gboolean finch_blist_get_size(int *width, int *height) | |
3209 { | |
3210 if (!ggblist || !ggblist->window) | |
3211 return FALSE; | |
3212 gnt_widget_get_size(ggblist->window, width, height); | |
3213 return TRUE; | |
3214 } | |
3215 | |
3216 void finch_blist_set_size(int width, int height) | |
3217 { | |
3218 gnt_widget_set_size(ggblist->window, width, height); | |
3219 } | |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3220 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3221 void finch_blist_install_manager(const FinchBlistManager *manager) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3222 { |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
3223 if (!g_list_find(managers, manager)) { |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3224 managers = g_list_append(managers, (gpointer)manager); |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
3225 reconstruct_grouping_menu(); |
22178
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
3226 if (strcmp(manager->id, purple_prefs_get_string(PREF_ROOT "/grouping")) == 0) |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
3227 purple_prefs_trigger_callback(PREF_ROOT "/grouping"); |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
3228 } |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3229 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3230 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3231 void finch_blist_uninstall_manager(const FinchBlistManager *manager) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3232 { |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
3233 if (g_list_find(managers, manager)) { |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
3234 managers = g_list_remove(managers, manager); |
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
3235 reconstruct_grouping_menu(); |
22178
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
3236 if (strcmp(manager->id, purple_prefs_get_string(PREF_ROOT "/grouping")) == 0) |
b0bce463aa4e
Remember the selected grouping option.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22177
diff
changeset
|
3237 purple_prefs_trigger_callback(PREF_ROOT "/grouping"); |
22177
71d0761fe572
Reconstruct the 'Grouping' menu when a blist manager is un/installed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22174
diff
changeset
|
3238 } |
22171
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3239 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3240 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3241 FinchBlistManager * finch_blist_manager_find(const char *id) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3242 { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3243 GList *iter = managers; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3244 if (!id) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3245 return NULL; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3246 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3247 for (; iter; iter = iter->next) { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3248 FinchBlistManager *m = iter->data; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3249 if (strcmp(id, m->id) == 0) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3250 return m; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3251 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3252 return NULL; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3253 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3254 |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3255 GntTree * finch_blist_get_tree(void) |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3256 { |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3257 return ggblist ? GNT_TREE(ggblist->tree) : NULL; |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3258 } |
2c9646c55369
Add a buddy list manager for finch. This allows plugins to show the buddylist
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22168
diff
changeset
|
3259 |