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