Mercurial > pidgin
annotate finch/gntaccount.c @ 23867:4bc74deeb503
propagate from branch 'im.pidgin.pidgin' (head 434563a4b8fadb9593c241db4bb5ffd0bf2c0627)
to branch 'im.pidgin.soc.2008.vv' (head 59d05cb38af9346d82ce57477273f7b381054bcc)
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Sat, 09 Aug 2008 02:24:38 +0000 |
parents | ff29208e03ef |
children | bb99ee66120e |
rev | line source |
---|---|
15817 | 1 /** |
2 * @file gntaccount.c GNT Account API | |
16194
0f0832c13fcb
Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@wiktel.com>
parents:
15870
diff
changeset
|
3 * @ingroup finch |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19768
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19768
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19768
diff
changeset
|
6 /* finch |
15817 | 7 * |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
8 * Finch is the legal property of its developers, whose names are too numerous |
15817 | 9 * to list here. Please refer to the COPYRIGHT file distributed with this |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19392
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15817 | 25 */ |
26 #include <gnt.h> | |
27 #include <gntbox.h> | |
28 #include <gntbutton.h> | |
29 #include <gntcheckbox.h> | |
30 #include <gntcombobox.h> | |
31 #include <gntentry.h> | |
32 #include <gntlabel.h> | |
33 #include <gntline.h> | |
34 #include <gnttree.h> | |
18511
7ee0e0597a26
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18432
diff
changeset
|
35 #include <gntutils.h> |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
36 #include <gntwindow.h> |
15817 | 37 |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18063
diff
changeset
|
38 #include "finch.h" |
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18063
diff
changeset
|
39 |
15817 | 40 #include <account.h> |
41 #include <accountopt.h> | |
42 #include <connection.h> | |
43 #include <notify.h> | |
44 #include <plugin.h> | |
45 #include <request.h> | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
46 #include <savedstatuses.h> |
15817 | 47 |
48 #include "gntaccount.h" | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
49 #include "gntblist.h" |
15817 | 50 |
51 #include <string.h> | |
52 | |
53 typedef struct | |
54 { | |
55 GntWidget *window; | |
56 GntWidget *tree; | |
57 } FinchAccountList; | |
58 | |
59 static FinchAccountList accounts; | |
60 | |
61 typedef struct | |
62 { | |
15822 | 63 PurpleAccount *account; /* NULL for a new account */ |
15817 | 64 |
65 GntWidget *window; | |
66 | |
67 GntWidget *protocol; | |
68 GntWidget *screenname; | |
69 GntWidget *password; | |
70 GntWidget *alias; | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
71 |
15817 | 72 GntWidget *splits; |
73 GList *split_entries; | |
74 | |
75 GList *prpl_entries; | |
76 GntWidget *prpls; | |
77 | |
78 GntWidget *newmail; | |
79 GntWidget *remember; | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
80 GntWidget *regserver; |
15817 | 81 } AccountEditDialog; |
82 | |
83 /* This is necessary to close an edit-dialog when an account is deleted */ | |
84 static GList *accountdialogs; | |
85 | |
86 static void | |
15822 | 87 account_add(PurpleAccount *account) |
15817 | 88 { |
89 gnt_tree_add_choice(GNT_TREE(accounts.tree), account, | |
90 gnt_tree_create_row(GNT_TREE(accounts.tree), | |
15822 | 91 purple_account_get_username(account), |
92 purple_account_get_protocol_name(account)), | |
15817 | 93 NULL, NULL); |
94 gnt_tree_set_choice(GNT_TREE(accounts.tree), account, | |
15822 | 95 purple_account_get_enabled(account, FINCH_UI)); |
15817 | 96 } |
97 | |
98 static void | |
99 edit_dialog_destroy(AccountEditDialog *dialog) | |
100 { | |
101 accountdialogs = g_list_remove(accountdialogs, dialog); | |
102 g_list_free(dialog->prpl_entries); | |
103 g_list_free(dialog->split_entries); | |
104 g_free(dialog); | |
105 } | |
106 | |
107 static void | |
108 save_account_cb(AccountEditDialog *dialog) | |
109 { | |
15822 | 110 PurpleAccount *account; |
111 PurplePlugin *plugin; | |
112 PurplePluginProtocolInfo *prplinfo; | |
15817 | 113 const char *value; |
114 GString *username; | |
115 | |
116 /* XXX: Do some error checking first. */ | |
117 | |
118 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | |
15822 | 119 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
15817 | 120 |
121 /* Screenname && user-splits */ | |
122 value = gnt_entry_get_text(GNT_ENTRY(dialog->screenname)); | |
123 | |
124 if (value == NULL || *value == '\0') | |
125 { | |
15822 | 126 purple_notify_error(NULL, _("Error"), _("Account was not added"), |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22257
diff
changeset
|
127 _("Username of an account must be non-empty.")); |
15817 | 128 return; |
129 } | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
130 |
15817 | 131 username = g_string_new(value); |
132 | |
133 if (prplinfo != NULL) | |
134 { | |
135 GList *iter, *entries; | |
136 for (iter = prplinfo->user_splits, entries = dialog->split_entries; | |
137 iter && entries; iter = iter->next, entries = entries->next) | |
138 { | |
15822 | 139 PurpleAccountUserSplit *split = iter->data; |
15817 | 140 GntWidget *entry = entries->data; |
141 | |
142 value = gnt_entry_get_text(GNT_ENTRY(entry)); | |
143 if (value == NULL || *value == '\0') | |
15822 | 144 value = purple_account_user_split_get_default_value(split); |
15817 | 145 g_string_append_printf(username, "%c%s", |
15822 | 146 purple_account_user_split_get_separator(split), |
15817 | 147 value); |
148 } | |
149 } | |
150 | |
151 if (dialog->account == NULL) | |
152 { | |
15822 | 153 account = purple_account_new(username->str, purple_plugin_get_id(plugin)); |
154 purple_accounts_add(account); | |
15817 | 155 } |
156 else | |
157 { | |
158 account = dialog->account; | |
159 | |
160 /* Protocol */ | |
15822 | 161 purple_account_set_protocol_id(account, purple_plugin_get_id(plugin)); |
162 purple_account_set_username(account, username->str); | |
15817 | 163 } |
164 g_string_free(username, TRUE); | |
165 | |
166 /* Alias */ | |
167 value = gnt_entry_get_text(GNT_ENTRY(dialog->alias)); | |
168 if (value && *value) | |
15822 | 169 purple_account_set_alias(account, value); |
15817 | 170 |
171 /* Remember password and password */ | |
15822 | 172 purple_account_set_remember_password(account, |
15817 | 173 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->remember))); |
174 value = gnt_entry_get_text(GNT_ENTRY(dialog->password)); | |
19762
656506d8935e
Don't prompt for the password again if the user entered it once in the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
175 if (value && *value) |
15822 | 176 purple_account_set_password(account, value); |
15817 | 177 else |
15822 | 178 purple_account_set_password(account, NULL); |
15817 | 179 |
180 /* Mail notification */ | |
15822 | 181 purple_account_set_check_mail(account, |
15817 | 182 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->newmail))); |
183 | |
184 /* Protocol options */ | |
185 if (prplinfo) | |
186 { | |
187 GList *iter, *entries; | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
188 |
15817 | 189 for (iter = prplinfo->protocol_options, entries = dialog->prpl_entries; |
190 iter && entries; iter = iter->next, entries = entries->next) | |
191 { | |
15822 | 192 PurpleAccountOption *option = iter->data; |
15817 | 193 GntWidget *entry = entries->data; |
15822 | 194 PurplePrefType type = purple_account_option_get_type(option); |
195 const char *setting = purple_account_option_get_setting(option); | |
15817 | 196 |
15822 | 197 if (type == PURPLE_PREF_STRING) |
15817 | 198 { |
199 const char *value = gnt_entry_get_text(GNT_ENTRY(entry)); | |
15822 | 200 purple_account_set_string(account, setting, value); |
15817 | 201 } |
15822 | 202 else if (type == PURPLE_PREF_INT) |
15817 | 203 { |
204 const char *str = gnt_entry_get_text(GNT_ENTRY(entry)); | |
205 int value = 0; | |
206 if (str) | |
207 value = atoi(str); | |
15822 | 208 purple_account_set_int(account, setting, value); |
15817 | 209 } |
15822 | 210 else if (type == PURPLE_PREF_BOOLEAN) |
15817 | 211 { |
212 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(entry)); | |
15822 | 213 purple_account_set_bool(account, setting, value); |
15817 | 214 } |
15822 | 215 else if (type == PURPLE_PREF_STRING_LIST) |
15817 | 216 { |
217 /* TODO: */ | |
218 } | |
219 else | |
220 { | |
221 g_assert_not_reached(); | |
222 } | |
223 } | |
224 } | |
225 | |
226 /* XXX: Proxy options */ | |
227 | |
19392
74f7d5e4a605
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18829
diff
changeset
|
228 if (accounts.window && accounts.tree) { |
74f7d5e4a605
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18829
diff
changeset
|
229 gnt_tree_set_selected(GNT_TREE(accounts.tree), account); |
74f7d5e4a605
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18829
diff
changeset
|
230 gnt_box_give_focus_to_child(GNT_BOX(accounts.window), accounts.tree); |
74f7d5e4a605
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18829
diff
changeset
|
231 } |
74f7d5e4a605
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18829
diff
changeset
|
232 |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
233 if (prplinfo && prplinfo->register_user && |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
234 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->regserver))) { |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
235 purple_account_register(account); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
236 } else if (dialog->account == NULL) { |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
237 /* This is a new account. Set it to the current status. */ |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
238 /* Xerox from gtkaccount.c :D */ |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
239 const PurpleSavedStatus *saved_status; |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
240 saved_status = purple_savedstatus_get_current(); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
241 if (saved_status != NULL) { |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
242 purple_savedstatus_activate_for_account(saved_status, account); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
243 purple_account_set_enabled(account, FINCH_UI, TRUE); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
244 } |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
245 } |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
246 |
15817 | 247 gnt_widget_destroy(dialog->window); |
248 } | |
249 | |
250 static void | |
251 update_user_splits(AccountEditDialog *dialog) | |
252 { | |
253 GntWidget *hbox; | |
15822 | 254 PurplePlugin *plugin; |
255 PurplePluginProtocolInfo *prplinfo; | |
15817 | 256 GList *iter, *entries; |
257 char *username = NULL; | |
258 | |
259 if (dialog->splits) | |
260 { | |
261 gnt_box_remove_all(GNT_BOX(dialog->splits)); | |
262 g_list_free(dialog->split_entries); | |
263 } | |
264 else | |
265 { | |
266 dialog->splits = gnt_vbox_new(FALSE); | |
267 gnt_box_set_pad(GNT_BOX(dialog->splits), 0); | |
268 gnt_box_set_fill(GNT_BOX(dialog->splits), TRUE); | |
269 } | |
270 | |
271 dialog->split_entries = NULL; | |
272 | |
273 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | |
274 if (!plugin) | |
275 return; | |
15822 | 276 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
15817 | 277 |
15822 | 278 username = dialog->account ? g_strdup(purple_account_get_username(dialog->account)) : NULL; |
15817 | 279 |
280 for (iter = prplinfo->user_splits; iter; iter = iter->next) | |
281 { | |
15822 | 282 PurpleAccountUserSplit *split = iter->data; |
15817 | 283 GntWidget *entry; |
284 char *buf; | |
285 | |
286 hbox = gnt_hbox_new(TRUE); | |
287 gnt_box_add_widget(GNT_BOX(dialog->splits), hbox); | |
288 | |
15822 | 289 buf = g_strdup_printf("%s:", purple_account_user_split_get_text(split)); |
15817 | 290 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(buf)); |
291 | |
292 entry = gnt_entry_new(NULL); | |
293 gnt_box_add_widget(GNT_BOX(hbox), entry); | |
294 | |
295 dialog->split_entries = g_list_append(dialog->split_entries, entry); | |
296 g_free(buf); | |
297 } | |
298 | |
299 for (iter = g_list_last(prplinfo->user_splits), entries = g_list_last(dialog->split_entries); | |
300 iter && entries; iter = iter->prev, entries = entries->prev) | |
301 { | |
302 GntWidget *entry = entries->data; | |
15822 | 303 PurpleAccountUserSplit *split = iter->data; |
15817 | 304 const char *value = NULL; |
305 char *s; | |
306 | |
307 if (dialog->account) | |
308 { | |
18037
e3e42a99070e
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17346
diff
changeset
|
309 if(purple_account_user_split_get_reverse(split)) |
e3e42a99070e
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17346
diff
changeset
|
310 s = strrchr(username, purple_account_user_split_get_separator(split)); |
e3e42a99070e
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17346
diff
changeset
|
311 else |
e3e42a99070e
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17346
diff
changeset
|
312 s = strchr(username, purple_account_user_split_get_separator(split)); |
e3e42a99070e
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17346
diff
changeset
|
313 |
15817 | 314 if (s != NULL) |
315 { | |
316 *s = '\0'; | |
317 s++; | |
318 value = s; | |
319 } | |
320 } | |
321 if (value == NULL) | |
15822 | 322 value = purple_account_user_split_get_default_value(split); |
15817 | 323 |
324 if (value != NULL) | |
325 gnt_entry_set_text(GNT_ENTRY(entry), value); | |
326 } | |
327 | |
328 if (username != NULL) | |
329 gnt_entry_set_text(GNT_ENTRY(dialog->screenname), username); | |
330 | |
331 g_free(username); | |
332 } | |
333 | |
334 static void | |
335 add_protocol_options(AccountEditDialog *dialog) | |
336 { | |
15822 | 337 PurplePlugin *plugin; |
338 PurplePluginProtocolInfo *prplinfo; | |
15817 | 339 GList *iter; |
340 GntWidget *vbox, *box; | |
15822 | 341 PurpleAccount *account; |
15817 | 342 |
343 if (dialog->prpls) | |
344 gnt_box_remove_all(GNT_BOX(dialog->prpls)); | |
345 else | |
346 { | |
347 dialog->prpls = vbox = gnt_vbox_new(FALSE); | |
348 gnt_box_set_pad(GNT_BOX(vbox), 0); | |
349 gnt_box_set_alignment(GNT_BOX(vbox), GNT_ALIGN_LEFT); | |
350 gnt_box_set_fill(GNT_BOX(vbox), TRUE); | |
351 } | |
352 | |
353 if (dialog->prpl_entries) | |
354 { | |
355 g_list_free(dialog->prpl_entries); | |
356 dialog->prpl_entries = NULL; | |
357 } | |
358 | |
359 vbox = dialog->prpls; | |
360 | |
361 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | |
362 if (!plugin) | |
363 return; | |
364 | |
15822 | 365 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
15817 | 366 |
367 account = dialog->account; | |
368 | |
369 for (iter = prplinfo->protocol_options; iter; iter = iter->next) | |
370 { | |
15822 | 371 PurpleAccountOption *option = iter->data; |
372 PurplePrefType type = purple_account_option_get_type(option); | |
15817 | 373 |
374 box = gnt_hbox_new(TRUE); | |
375 gnt_box_set_pad(GNT_BOX(box), 0); | |
376 gnt_box_add_widget(GNT_BOX(vbox), box); | |
377 | |
15822 | 378 if (type == PURPLE_PREF_BOOLEAN) |
15817 | 379 { |
15822 | 380 GntWidget *widget = gnt_check_box_new(purple_account_option_get_text(option)); |
15817 | 381 gnt_box_add_widget(GNT_BOX(box), widget); |
382 dialog->prpl_entries = g_list_append(dialog->prpl_entries, widget); | |
383 | |
384 if (account) | |
385 gnt_check_box_set_checked(GNT_CHECK_BOX(widget), | |
15822 | 386 purple_account_get_bool(account, |
387 purple_account_option_get_setting(option), | |
388 purple_account_option_get_default_bool(option))); | |
15817 | 389 else |
390 gnt_check_box_set_checked(GNT_CHECK_BOX(widget), | |
15822 | 391 purple_account_option_get_default_bool(option)); |
15817 | 392 } |
393 else | |
394 { | |
395 gnt_box_add_widget(GNT_BOX(box), | |
15822 | 396 gnt_label_new(purple_account_option_get_text(option))); |
15817 | 397 |
15822 | 398 if (type == PURPLE_PREF_STRING_LIST) |
15817 | 399 { |
400 /* TODO: Use a combobox */ | |
401 /* Don't forget to append the widget to prpl_entries */ | |
402 } | |
403 else | |
404 { | |
405 GntWidget *entry = gnt_entry_new(NULL); | |
406 gnt_box_add_widget(GNT_BOX(box), entry); | |
407 dialog->prpl_entries = g_list_append(dialog->prpl_entries, entry); | |
408 | |
15822 | 409 if (type == PURPLE_PREF_STRING) |
15817 | 410 { |
15822 | 411 const char *dv = purple_account_option_get_default_string(option); |
15817 | 412 |
413 if (account) | |
414 gnt_entry_set_text(GNT_ENTRY(entry), | |
15822 | 415 purple_account_get_string(account, |
416 purple_account_option_get_setting(option), dv)); | |
15817 | 417 else |
418 gnt_entry_set_text(GNT_ENTRY(entry), dv); | |
419 } | |
15822 | 420 else if (type == PURPLE_PREF_INT) |
15817 | 421 { |
422 char str[32]; | |
15822 | 423 int value = purple_account_option_get_default_int(option); |
15817 | 424 if (account) |
15822 | 425 value = purple_account_get_int(account, |
426 purple_account_option_get_setting(option), value); | |
15817 | 427 snprintf(str, sizeof(str), "%d", value); |
428 gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); | |
429 gnt_entry_set_text(GNT_ENTRY(entry), str); | |
430 } | |
431 else | |
432 { | |
433 g_assert_not_reached(); | |
434 } | |
435 } | |
436 } | |
437 } | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
438 |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
439 /* Show the registration checkbox only in a new account dialog, |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
440 * and when the selected prpl has the support for it. */ |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
441 gnt_widget_set_visible(dialog->regserver, account == NULL && |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
442 prplinfo->register_user != NULL); |
15817 | 443 } |
444 | |
445 static void | |
446 update_user_options(AccountEditDialog *dialog) | |
447 { | |
15822 | 448 PurplePlugin *plugin; |
449 PurplePluginProtocolInfo *prplinfo; | |
15817 | 450 |
451 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | |
452 if (!plugin) | |
453 return; | |
454 | |
15822 | 455 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
15817 | 456 |
457 if (dialog->newmail == NULL) | |
458 dialog->newmail = gnt_check_box_new(_("New mail notifications")); | |
459 if (dialog->account) | |
460 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->newmail), | |
15822 | 461 purple_account_get_check_mail(dialog->account)); |
15817 | 462 if (!prplinfo || !(prplinfo->options & OPT_PROTO_MAIL_CHECK)) |
463 gnt_widget_set_visible(dialog->newmail, FALSE); | |
464 else | |
465 gnt_widget_set_visible(dialog->newmail, TRUE); | |
466 | |
467 if (dialog->remember == NULL) | |
468 dialog->remember = gnt_check_box_new(_("Remember password")); | |
469 if (dialog->account) | |
470 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->remember), | |
15822 | 471 purple_account_get_remember_password(dialog->account)); |
15817 | 472 } |
473 | |
474 static void | |
15822 | 475 prpl_changed_cb(GntWidget *combo, PurplePlugin *old, PurplePlugin *new, AccountEditDialog *dialog) |
15817 | 476 { |
477 update_user_splits(dialog); | |
478 add_protocol_options(dialog); | |
479 update_user_options(dialog); /* This may not be necessary here */ | |
480 gnt_box_readjust(GNT_BOX(dialog->window)); | |
481 gnt_widget_draw(dialog->window); | |
482 } | |
483 | |
484 static void | |
15822 | 485 edit_account(PurpleAccount *account) |
15817 | 486 { |
487 GntWidget *window, *hbox; | |
488 GntWidget *combo, *button, *entry; | |
489 GList *list, *iter; | |
490 AccountEditDialog *dialog; | |
491 | |
492 if (account) | |
493 { | |
494 GList *iter; | |
495 for (iter = accountdialogs; iter; iter = iter->next) | |
496 { | |
497 AccountEditDialog *dlg = iter->data; | |
498 if (dlg->account == account) | |
499 return; | |
500 } | |
501 } | |
502 | |
18432
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
503 list = purple_plugins_get_protocols(); |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
504 if (list == NULL) { |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
505 purple_notify_error(NULL, _("Error"), |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
506 _("There's no protocol plugins installed."), |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
507 _("(You probably forgot to 'make install'.)")); |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
508 return; |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
509 } |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
510 |
15817 | 511 dialog = g_new0(AccountEditDialog, 1); |
512 accountdialogs = g_list_prepend(accountdialogs, dialog); | |
513 | |
514 dialog->window = window = gnt_vbox_new(FALSE); | |
515 dialog->account = account; | |
516 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
517 gnt_box_set_title(GNT_BOX(window), account ? _("Modify Account") : _("New Account")); | |
518 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
519 gnt_box_set_pad(GNT_BOX(window), 0); | |
520 gnt_widget_set_name(window, "edit-account"); | |
521 gnt_box_set_fill(GNT_BOX(window), TRUE); | |
522 | |
523 hbox = gnt_hbox_new(TRUE); | |
524 gnt_box_set_pad(GNT_BOX(hbox), 0); | |
525 gnt_box_add_widget(GNT_BOX(window), hbox); | |
526 | |
527 dialog->protocol = combo = gnt_combo_box_new(); | |
528 for (iter = list; iter; iter = iter->next) | |
529 { | |
530 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), iter->data, | |
15822 | 531 ((PurplePlugin*)iter->data)->info->name); |
15817 | 532 } |
533 | |
534 if (account) | |
535 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), | |
15822 | 536 purple_plugins_find_with_id(purple_account_get_protocol_id(account))); |
15817 | 537 else |
538 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), list->data); | |
539 | |
540 g_signal_connect(G_OBJECT(combo), "selection-changed", G_CALLBACK(prpl_changed_cb), dialog); | |
541 | |
542 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Protocol:"))); | |
543 gnt_box_add_widget(GNT_BOX(hbox), combo); | |
544 | |
545 hbox = gnt_hbox_new(TRUE); | |
546 gnt_box_set_pad(GNT_BOX(hbox), 0); | |
547 gnt_box_add_widget(GNT_BOX(window), hbox); | |
548 | |
549 dialog->screenname = entry = gnt_entry_new(NULL); | |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22257
diff
changeset
|
550 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Username:"))); |
15817 | 551 gnt_box_add_widget(GNT_BOX(hbox), entry); |
552 | |
553 /* User splits */ | |
554 update_user_splits(dialog); | |
555 gnt_box_add_widget(GNT_BOX(window), dialog->splits); | |
556 | |
557 hbox = gnt_hbox_new(TRUE); | |
558 gnt_box_set_pad(GNT_BOX(hbox), 0); | |
559 gnt_box_add_widget(GNT_BOX(window), hbox); | |
560 | |
561 dialog->password = entry = gnt_entry_new(NULL); | |
562 gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); | |
563 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Password:"))); | |
564 gnt_box_add_widget(GNT_BOX(hbox), entry); | |
565 if (account) | |
15822 | 566 gnt_entry_set_text(GNT_ENTRY(entry), purple_account_get_password(account)); |
15817 | 567 |
568 hbox = gnt_hbox_new(TRUE); | |
569 gnt_box_set_pad(GNT_BOX(hbox), 0); | |
570 gnt_box_add_widget(GNT_BOX(window), hbox); | |
571 | |
572 dialog->alias = entry = gnt_entry_new(NULL); | |
573 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Alias:"))); | |
574 gnt_box_add_widget(GNT_BOX(hbox), entry); | |
575 if (account) | |
15822 | 576 gnt_entry_set_text(GNT_ENTRY(entry), purple_account_get_alias(account)); |
15817 | 577 |
578 /* User options */ | |
579 update_user_options(dialog); | |
580 gnt_box_add_widget(GNT_BOX(window), dialog->remember); | |
581 gnt_box_add_widget(GNT_BOX(window), dialog->newmail); | |
582 | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
583 /* Register checkbox */ |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
584 dialog->regserver = gnt_check_box_new(_("Create this account on the server")); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
585 gnt_box_add_widget(GNT_BOX(window), dialog->regserver); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
586 |
15817 | 587 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); |
588 | |
589 /* The advanced box */ | |
590 add_protocol_options(dialog); | |
591 gnt_box_add_widget(GNT_BOX(window), dialog->prpls); | |
592 | |
593 /* TODO: Add proxy options */ | |
594 | |
595 /* The button box */ | |
596 hbox = gnt_hbox_new(FALSE); | |
597 gnt_box_add_widget(GNT_BOX(window), hbox); | |
598 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); | |
599 | |
600 button = gnt_button_new(_("Cancel")); | |
601 gnt_box_add_widget(GNT_BOX(hbox), button); | |
602 g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), window); | |
603 | |
604 button = gnt_button_new(_("Save")); | |
605 gnt_box_add_widget(GNT_BOX(hbox), button); | |
606 g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(save_account_cb), dialog); | |
607 | |
608 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(edit_dialog_destroy), dialog); | |
609 | |
610 gnt_widget_show(window); | |
611 gnt_box_readjust(GNT_BOX(window)); | |
612 gnt_widget_draw(window); | |
613 } | |
614 | |
615 static void | |
616 add_account_cb(GntWidget *widget, gpointer null) | |
617 { | |
618 edit_account(NULL); | |
619 } | |
620 | |
621 static void | |
622 modify_account_cb(GntWidget *widget, GntTree *tree) | |
623 { | |
15822 | 624 PurpleAccount *account = gnt_tree_get_selection_data(tree); |
15817 | 625 if (!account) |
626 return; | |
627 edit_account(account); | |
628 } | |
629 | |
630 static void | |
15822 | 631 really_delete_account(PurpleAccount *account) |
15817 | 632 { |
633 GList *iter; | |
634 for (iter = accountdialogs; iter; iter = iter->next) | |
635 { | |
636 AccountEditDialog *dlg = iter->data; | |
637 if (dlg->account == account) | |
638 { | |
639 gnt_widget_destroy(dlg->window); | |
640 break; | |
641 } | |
642 } | |
15822 | 643 purple_request_close_with_handle(account); /* Close any other opened delete window */ |
644 purple_accounts_delete(account); | |
15817 | 645 } |
646 | |
647 static void | |
648 delete_account_cb(GntWidget *widget, GntTree *tree) | |
649 { | |
15822 | 650 PurpleAccount *account; |
15817 | 651 char *prompt; |
652 | |
653 account = gnt_tree_get_selection_data(tree); | |
654 if (!account) | |
655 return; | |
656 | |
657 prompt = g_strdup_printf(_("Are you sure you want to delete %s?"), | |
15822 | 658 purple_account_get_username(account)); |
15817 | 659 |
22257
8233bbcf3e86
The Gnome Human Interface Guidelines say, "if pressing this button by
Mark Doliner <mark@kingant.net>
parents:
22213
diff
changeset
|
660 purple_request_action(account, _("Delete Account"), prompt, NULL, |
8233bbcf3e86
The Gnome Human Interface Guidelines say, "if pressing this button by
Mark Doliner <mark@kingant.net>
parents:
22213
diff
changeset
|
661 PURPLE_DEFAULT_ACTION_NONE, |
16462
4b6d81d26b56
Fix a warning introduced with the request api changes.
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
662 account, NULL, NULL, account, 2, |
4b6d81d26b56
Fix a warning introduced with the request api changes.
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
663 _("Delete"), really_delete_account, |
4b6d81d26b56
Fix a warning introduced with the request api changes.
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
664 _("Cancel"), NULL); |
15817 | 665 g_free(prompt); |
666 } | |
667 | |
668 static void | |
669 account_toggled(GntWidget *widget, void *key, gpointer null) | |
670 { | |
15822 | 671 PurpleAccount *account = key; |
15817 | 672 |
15822 | 673 purple_account_set_enabled(account, FINCH_UI, gnt_tree_get_choice(GNT_TREE(widget), key)); |
15817 | 674 } |
675 | |
676 static void | |
677 reset_accounts_win(GntWidget *widget, gpointer null) | |
678 { | |
679 accounts.window = NULL; | |
680 accounts.tree = NULL; | |
681 } | |
682 | |
683 void finch_accounts_show_all() | |
684 { | |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
685 GList *iter; |
15817 | 686 GntWidget *box, *button; |
687 | |
18345
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
688 if (accounts.window) { |
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
689 gnt_window_present(accounts.window); |
15817 | 690 return; |
18345
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
691 } |
15817 | 692 |
693 accounts.window = gnt_vbox_new(FALSE); | |
694 gnt_box_set_toplevel(GNT_BOX(accounts.window), TRUE); | |
695 gnt_box_set_title(GNT_BOX(accounts.window), _("Accounts")); | |
696 gnt_box_set_pad(GNT_BOX(accounts.window), 0); | |
697 gnt_box_set_alignment(GNT_BOX(accounts.window), GNT_ALIGN_MID); | |
698 gnt_widget_set_name(accounts.window, "accounts"); | |
699 | |
700 gnt_box_add_widget(GNT_BOX(accounts.window), | |
701 gnt_label_new(_("You can enable/disable accounts from the following list."))); | |
702 | |
703 gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); | |
704 | |
705 accounts.tree = gnt_tree_new_with_columns(2); | |
706 GNT_WIDGET_SET_FLAGS(accounts.tree, GNT_WIDGET_NO_BORDER); | |
707 | |
15822 | 708 for (iter = purple_accounts_get_all(); iter; iter = iter->next) |
15817 | 709 { |
15822 | 710 PurpleAccount *account = iter->data; |
15817 | 711 account_add(account); |
712 } | |
713 | |
714 g_signal_connect(G_OBJECT(accounts.tree), "toggled", G_CALLBACK(account_toggled), NULL); | |
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:
22007
diff
changeset
|
715 |
15817 | 716 gnt_tree_set_col_width(GNT_TREE(accounts.tree), 0, 40); |
717 gnt_tree_set_col_width(GNT_TREE(accounts.tree), 1, 10); | |
718 gnt_box_add_widget(GNT_BOX(accounts.window), accounts.tree); | |
719 | |
720 gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); | |
721 | |
722 box = gnt_hbox_new(FALSE); | |
723 | |
724 button = gnt_button_new(_("Add")); | |
725 gnt_box_add_widget(GNT_BOX(box), button); | |
18511
7ee0e0597a26
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18432
diff
changeset
|
726 gnt_util_set_trigger_widget(GNT_WIDGET(accounts.tree), GNT_KEY_INS, button); |
15817 | 727 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(add_account_cb), NULL); |
728 | |
729 button = gnt_button_new(_("Modify")); | |
730 gnt_box_add_widget(GNT_BOX(box), button); | |
731 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(modify_account_cb), accounts.tree); | |
732 | |
733 button = gnt_button_new(_("Delete")); | |
734 gnt_box_add_widget(GNT_BOX(box), button); | |
18511
7ee0e0597a26
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18432
diff
changeset
|
735 gnt_util_set_trigger_widget(GNT_WIDGET(accounts.tree), GNT_KEY_DEL, button); |
15817 | 736 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(delete_account_cb), accounts.tree); |
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:
22007
diff
changeset
|
737 |
15817 | 738 gnt_box_add_widget(GNT_BOX(accounts.window), box); |
739 | |
740 g_signal_connect(G_OBJECT(accounts.window), "destroy", G_CALLBACK(reset_accounts_win), NULL); | |
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:
22007
diff
changeset
|
741 |
15817 | 742 gnt_widget_show(accounts.window); |
743 } | |
744 | |
19768
41cad24fd6df
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19762
diff
changeset
|
745 void finch_account_dialog_show(PurpleAccount *account) |
41cad24fd6df
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19762
diff
changeset
|
746 { |
41cad24fd6df
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19762
diff
changeset
|
747 edit_account(account); |
41cad24fd6df
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19762
diff
changeset
|
748 } |
41cad24fd6df
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19762
diff
changeset
|
749 |
15817 | 750 static gpointer |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21570
diff
changeset
|
751 finch_accounts_get_handle(void) |
15817 | 752 { |
753 static int handle; | |
754 | |
755 return &handle; | |
756 } | |
757 | |
758 static void | |
15822 | 759 account_added_callback(PurpleAccount *account) |
15817 | 760 { |
761 if (accounts.window == NULL) | |
762 return; | |
763 account_add(account); | |
764 gnt_widget_draw(accounts.tree); | |
765 } | |
766 | |
767 static void | |
15822 | 768 account_removed_callback(PurpleAccount *account) |
15817 | 769 { |
770 if (accounts.window == NULL) | |
771 return; | |
772 | |
773 gnt_tree_remove(GNT_TREE(accounts.tree), account); | |
774 } | |
775 | |
17346
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
776 static void |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
777 account_abled_cb(PurpleAccount *account, gpointer user_data) |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
778 { |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
779 if (accounts.window == NULL) |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
780 return; |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
781 gnt_tree_set_choice(GNT_TREE(accounts.tree), account, |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
782 GPOINTER_TO_INT(user_data)); |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
783 } |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
784 |
15817 | 785 void finch_accounts_init() |
786 { | |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
787 GList *iter; |
15817 | 788 |
15822 | 789 purple_signal_connect(purple_accounts_get_handle(), "account-added", |
790 finch_accounts_get_handle(), PURPLE_CALLBACK(account_added_callback), | |
15817 | 791 NULL); |
15822 | 792 purple_signal_connect(purple_accounts_get_handle(), "account-removed", |
793 finch_accounts_get_handle(), PURPLE_CALLBACK(account_removed_callback), | |
15817 | 794 NULL); |
17346
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
795 purple_signal_connect(purple_accounts_get_handle(), "account-disabled", |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
796 finch_accounts_get_handle(), |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
797 PURPLE_CALLBACK(account_abled_cb), GINT_TO_POINTER(FALSE)); |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
798 purple_signal_connect(purple_accounts_get_handle(), "account-enabled", |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
799 finch_accounts_get_handle(), |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
800 PURPLE_CALLBACK(account_abled_cb), GINT_TO_POINTER(TRUE)); |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
801 |
17816
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
802 iter = purple_accounts_get_all(); |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
803 if (iter) { |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
804 for (; iter; iter = iter->next) { |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
805 if (purple_account_get_enabled(iter->data, FINCH_UI)) |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
806 break; |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
807 } |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
808 if (!iter) |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
809 finch_accounts_show_all(); |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
810 } else { |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
811 edit_account(NULL); |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
812 finch_accounts_show_all(); |
15817 | 813 } |
814 } | |
815 | |
816 void finch_accounts_uninit() | |
817 { | |
818 if (accounts.window) | |
819 gnt_widget_destroy(accounts.window); | |
820 } | |
821 | |
822 /* The following uiops stuff are copied from gtkaccount.c */ | |
823 typedef struct | |
824 { | |
15822 | 825 PurpleAccount *account; |
15817 | 826 char *username; |
827 char *alias; | |
828 } AddUserData; | |
829 | |
830 static char * | |
15822 | 831 make_info(PurpleAccount *account, PurpleConnection *gc, const char *remote_user, |
15817 | 832 const char *id, const char *alias, const char *msg) |
833 { | |
834 if (msg != NULL && *msg == '\0') | |
835 msg = NULL; | |
836 | |
837 return g_strdup_printf(_("%s%s%s%s has made %s his or her buddy%s%s"), | |
838 remote_user, | |
839 (alias != NULL ? " (" : ""), | |
840 (alias != NULL ? alias : ""), | |
841 (alias != NULL ? ")" : ""), | |
842 (id != NULL | |
843 ? id | |
15822 | 844 : (purple_connection_get_display_name(gc) != NULL |
845 ? purple_connection_get_display_name(gc) | |
846 : purple_account_get_username(account))), | |
15817 | 847 (msg != NULL ? ": " : "."), |
848 (msg != NULL ? msg : "")); | |
849 } | |
850 | |
851 static void | |
15822 | 852 notify_added(PurpleAccount *account, const char *remote_user, |
15817 | 853 const char *id, const char *alias, |
854 const char *msg) | |
855 { | |
856 char *buffer; | |
15822 | 857 PurpleConnection *gc; |
15817 | 858 |
15822 | 859 gc = purple_account_get_connection(account); |
15817 | 860 |
861 buffer = make_info(account, gc, remote_user, id, alias, msg); | |
862 | |
15822 | 863 purple_notify_info(NULL, NULL, buffer, NULL); |
15817 | 864 |
865 g_free(buffer); | |
866 } | |
867 | |
868 static void | |
869 free_add_user_data(AddUserData *data) | |
870 { | |
871 g_free(data->username); | |
872 | |
873 if (data->alias != NULL) | |
874 g_free(data->alias); | |
875 | |
876 g_free(data); | |
877 } | |
878 | |
879 static void | |
880 add_user_cb(AddUserData *data) | |
881 { | |
15822 | 882 PurpleConnection *gc = purple_account_get_connection(data->account); |
15817 | 883 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
884 if (g_list_find(purple_connections_get_all(), gc)) |
15817 | 885 { |
15822 | 886 purple_blist_request_add_buddy(data->account, data->username, |
15817 | 887 NULL, data->alias); |
888 } | |
889 | |
890 free_add_user_data(data); | |
891 } | |
892 | |
893 static void | |
15822 | 894 request_add(PurpleAccount *account, const char *remote_user, |
15817 | 895 const char *id, const char *alias, |
896 const char *msg) | |
897 { | |
898 char *buffer; | |
15822 | 899 PurpleConnection *gc; |
15817 | 900 AddUserData *data; |
901 | |
15822 | 902 gc = purple_account_get_connection(account); |
15817 | 903 |
904 data = g_new0(AddUserData, 1); | |
905 data->account = account; | |
906 data->username = g_strdup(remote_user); | |
907 data->alias = (alias != NULL ? g_strdup(alias) : NULL); | |
908 | |
909 buffer = make_info(account, gc, remote_user, id, alias, msg); | |
15822 | 910 purple_request_action(NULL, NULL, _("Add buddy to your list?"), |
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16194
diff
changeset
|
911 buffer, PURPLE_DEFAULT_ACTION_NONE, |
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:
16194
diff
changeset
|
912 account, remote_user, 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:
16194
diff
changeset
|
913 data, 2, |
15817 | 914 _("Add"), G_CALLBACK(add_user_cb), |
915 _("Cancel"), G_CALLBACK(free_add_user_data)); | |
916 g_free(buffer); | |
917 } | |
918 | |
919 /* Copied from gtkaccount.c */ | |
920 typedef struct { | |
15822 | 921 PurpleAccountRequestAuthorizationCb auth_cb; |
922 PurpleAccountRequestAuthorizationCb deny_cb; | |
15817 | 923 void *data; |
924 char *username; | |
925 char *alias; | |
15822 | 926 PurpleAccount *account; |
15817 | 927 } auth_and_add; |
928 | |
929 static void | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
930 free_auth_and_add(auth_and_add *aa) |
15817 | 931 { |
932 g_free(aa->username); | |
933 g_free(aa->alias); | |
934 g_free(aa); | |
935 } | |
936 | |
937 static void | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
938 authorize_and_add_cb(auth_and_add *aa) |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
939 { |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
940 aa->auth_cb(aa->data); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
941 purple_blist_request_add_buddy(aa->account, aa->username, |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
942 NULL, aa->alias); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
943 } |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
944 |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
945 static void |
15817 | 946 deny_no_add_cb(auth_and_add *aa) |
947 { | |
948 aa->deny_cb(aa->data); | |
949 } | |
950 | |
951 static void * | |
18829
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
952 finch_request_authorize(PurpleAccount *account, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
953 const char *remote_user, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
954 const char *id, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
955 const char *alias, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
956 const char *message, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
957 gboolean on_list, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
958 PurpleAccountRequestAuthorizationCb auth_cb, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
959 PurpleAccountRequestAuthorizationCb deny_cb, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
960 void *user_data) |
15817 | 961 { |
962 char *buffer; | |
15822 | 963 PurpleConnection *gc; |
15817 | 964 void *uihandle; |
965 | |
15822 | 966 gc = purple_account_get_connection(account); |
15817 | 967 if (message != NULL && *message == '\0') |
968 message = NULL; | |
969 | |
18516
15f0c935e699
I changed a string during a string freeze\! Sorry\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18511
diff
changeset
|
970 buffer = g_strdup_printf(_("%s%s%s%s wants to add %s to his or her buddy list%s%s"), |
15817 | 971 remote_user, |
972 (alias != NULL ? " (" : ""), | |
973 (alias != NULL ? alias : ""), | |
974 (alias != NULL ? ")" : ""), | |
975 (id != NULL | |
976 ? id | |
15822 | 977 : (purple_connection_get_display_name(gc) != NULL |
978 ? purple_connection_get_display_name(gc) | |
979 : purple_account_get_username(account))), | |
18516
15f0c935e699
I changed a string during a string freeze\! Sorry\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18511
diff
changeset
|
980 (message != NULL ? ": " : "."), |
15817 | 981 (message != NULL ? message : "")); |
982 if (!on_list) { | |
17805
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
983 GntWidget *widget; |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
984 GList *iter; |
15817 | 985 auth_and_add *aa = g_new(auth_and_add, 1); |
17805
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
986 |
18829
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
987 aa->auth_cb = auth_cb; |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
988 aa->deny_cb = deny_cb; |
15817 | 989 aa->data = user_data; |
990 aa->username = g_strdup(remote_user); | |
991 aa->alias = g_strdup(alias); | |
992 aa->account = account; | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
993 |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
994 uihandle = gnt_vwindow_new(FALSE); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
995 gnt_box_set_title(GNT_BOX(uihandle), _("Authorize buddy?")); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
996 gnt_box_set_pad(GNT_BOX(uihandle), 0); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
997 |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
998 widget = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, |
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16194
diff
changeset
|
999 PURPLE_DEFAULT_ACTION_NONE, |
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:
16194
diff
changeset
|
1000 account, remote_user, 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:
16194
diff
changeset
|
1001 aa, 2, |
15817 | 1002 _("Authorize"), authorize_and_add_cb, |
1003 _("Deny"), deny_no_add_cb); | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1004 gnt_screen_release(widget); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1005 gnt_box_set_toplevel(GNT_BOX(widget), FALSE); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1006 gnt_box_add_widget(GNT_BOX(uihandle), widget); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1007 |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1008 gnt_box_add_widget(GNT_BOX(uihandle), gnt_hline_new()); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1009 |
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:
22007
diff
changeset
|
1010 widget = finch_retrieve_user_info(purple_account_get_connection(account), remote_user); |
17805
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1011 for (iter = GNT_BOX(widget)->list; iter; iter = iter->next) { |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1012 if (GNT_IS_BUTTON(iter->data)) { |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1013 gnt_widget_destroy(iter->data); |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1014 gnt_box_remove(GNT_BOX(widget), iter->data); |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1015 break; |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1016 } |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1017 } |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1018 gnt_box_set_toplevel(GNT_BOX(widget), FALSE); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1019 gnt_screen_release(widget); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1020 gnt_box_add_widget(GNT_BOX(uihandle), widget); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1021 gnt_widget_show(uihandle); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1022 |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1023 g_signal_connect_swapped(G_OBJECT(uihandle), "destroy", G_CALLBACK(free_auth_and_add), aa); |
15817 | 1024 } else { |
15822 | 1025 uihandle = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, |
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16194
diff
changeset
|
1026 PURPLE_DEFAULT_ACTION_NONE, |
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:
16194
diff
changeset
|
1027 account, remote_user, 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:
16194
diff
changeset
|
1028 user_data, 2, |
15817 | 1029 _("Authorize"), auth_cb, |
1030 _("Deny"), deny_cb); | |
1031 } | |
1032 g_free(buffer); | |
1033 return uihandle; | |
1034 } | |
1035 | |
1036 static void | |
1037 finch_request_close(void *uihandle) | |
1038 { | |
15822 | 1039 purple_request_close(PURPLE_REQUEST_ACTION, uihandle); |
15817 | 1040 } |
1041 | |
15822 | 1042 static PurpleAccountUiOps ui_ops = |
15817 | 1043 { |
17091
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1044 notify_added, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1045 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1046 request_add, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1047 finch_request_authorize, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1048 finch_request_close, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1049 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1050 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1051 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1052 NULL |
15817 | 1053 }; |
1054 | |
15822 | 1055 PurpleAccountUiOps *finch_accounts_get_ui_ops() |
15817 | 1056 { |
1057 return &ui_ops; | |
1058 } | |
1059 | |
23807
ff29208e03ef
propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
diff
changeset
|
1060 |