Mercurial > pidgin.yaz
comparison finch/gntaccount.c @ 15823:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 0e3a8505ebbe |
children | 66dff3dfdea6 |
comparison
equal
deleted
inserted
replaced
15822:84b0f9b23ede | 15823:32c366eeeb99 |
---|---|
1 /** | 1 /** |
2 * @file gntaccount.c GNT Account API | 2 * @file gntaccount.c GNT Account API |
3 * @ingroup gntui | 3 * @ingroup gntui |
4 * | 4 * |
5 * gaim | 5 * purple |
6 * | 6 * |
7 * Gaim is the legal property of its developers, whose names are too numerous | 7 * Purple is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | 8 * to list here. Please refer to the COPYRIGHT file distributed with this |
9 * source distribution. | 9 * source distribution. |
10 * | 10 * |
11 * This program is free software; you can redistribute it and/or modify | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | 12 * it under the terms of the GNU General Public License as published by |
38 #include <notify.h> | 38 #include <notify.h> |
39 #include <plugin.h> | 39 #include <plugin.h> |
40 #include <request.h> | 40 #include <request.h> |
41 | 41 |
42 #include "gntaccount.h" | 42 #include "gntaccount.h" |
43 #include "gntgaim.h" | 43 #include "finch.h" |
44 | 44 |
45 #include <string.h> | 45 #include <string.h> |
46 | 46 |
47 typedef struct | 47 typedef struct |
48 { | 48 { |
52 | 52 |
53 static FinchAccountList accounts; | 53 static FinchAccountList accounts; |
54 | 54 |
55 typedef struct | 55 typedef struct |
56 { | 56 { |
57 GaimAccount *account; /* NULL for a new account */ | 57 PurpleAccount *account; /* NULL for a new account */ |
58 | 58 |
59 GntWidget *window; | 59 GntWidget *window; |
60 | 60 |
61 GntWidget *protocol; | 61 GntWidget *protocol; |
62 GntWidget *screenname; | 62 GntWidget *screenname; |
75 | 75 |
76 /* This is necessary to close an edit-dialog when an account is deleted */ | 76 /* This is necessary to close an edit-dialog when an account is deleted */ |
77 static GList *accountdialogs; | 77 static GList *accountdialogs; |
78 | 78 |
79 static void | 79 static void |
80 account_add(GaimAccount *account) | 80 account_add(PurpleAccount *account) |
81 { | 81 { |
82 gnt_tree_add_choice(GNT_TREE(accounts.tree), account, | 82 gnt_tree_add_choice(GNT_TREE(accounts.tree), account, |
83 gnt_tree_create_row(GNT_TREE(accounts.tree), | 83 gnt_tree_create_row(GNT_TREE(accounts.tree), |
84 gaim_account_get_username(account), | 84 purple_account_get_username(account), |
85 gaim_account_get_protocol_name(account)), | 85 purple_account_get_protocol_name(account)), |
86 NULL, NULL); | 86 NULL, NULL); |
87 gnt_tree_set_choice(GNT_TREE(accounts.tree), account, | 87 gnt_tree_set_choice(GNT_TREE(accounts.tree), account, |
88 gaim_account_get_enabled(account, GAIM_GNT_UI)); | 88 purple_account_get_enabled(account, FINCH_UI)); |
89 } | 89 } |
90 | 90 |
91 static void | 91 static void |
92 edit_dialog_destroy(AccountEditDialog *dialog) | 92 edit_dialog_destroy(AccountEditDialog *dialog) |
93 { | 93 { |
98 } | 98 } |
99 | 99 |
100 static void | 100 static void |
101 save_account_cb(AccountEditDialog *dialog) | 101 save_account_cb(AccountEditDialog *dialog) |
102 { | 102 { |
103 GaimAccount *account; | 103 PurpleAccount *account; |
104 GaimPlugin *plugin; | 104 PurplePlugin *plugin; |
105 GaimPluginProtocolInfo *prplinfo; | 105 PurplePluginProtocolInfo *prplinfo; |
106 const char *value; | 106 const char *value; |
107 GString *username; | 107 GString *username; |
108 | 108 |
109 /* XXX: Do some error checking first. */ | 109 /* XXX: Do some error checking first. */ |
110 | 110 |
111 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | 111 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
112 prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); | 112 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
113 | 113 |
114 /* Screenname && user-splits */ | 114 /* Screenname && user-splits */ |
115 value = gnt_entry_get_text(GNT_ENTRY(dialog->screenname)); | 115 value = gnt_entry_get_text(GNT_ENTRY(dialog->screenname)); |
116 | 116 |
117 if (value == NULL || *value == '\0') | 117 if (value == NULL || *value == '\0') |
118 { | 118 { |
119 gaim_notify_error(NULL, _("Error"), _("Account was not added"), | 119 purple_notify_error(NULL, _("Error"), _("Account was not added"), |
120 _("Screenname of an account must be non-empty.")); | 120 _("Screenname of an account must be non-empty.")); |
121 return; | 121 return; |
122 } | 122 } |
123 | 123 |
124 username = g_string_new(value); | 124 username = g_string_new(value); |
127 { | 127 { |
128 GList *iter, *entries; | 128 GList *iter, *entries; |
129 for (iter = prplinfo->user_splits, entries = dialog->split_entries; | 129 for (iter = prplinfo->user_splits, entries = dialog->split_entries; |
130 iter && entries; iter = iter->next, entries = entries->next) | 130 iter && entries; iter = iter->next, entries = entries->next) |
131 { | 131 { |
132 GaimAccountUserSplit *split = iter->data; | 132 PurpleAccountUserSplit *split = iter->data; |
133 GntWidget *entry = entries->data; | 133 GntWidget *entry = entries->data; |
134 | 134 |
135 value = gnt_entry_get_text(GNT_ENTRY(entry)); | 135 value = gnt_entry_get_text(GNT_ENTRY(entry)); |
136 if (value == NULL || *value == '\0') | 136 if (value == NULL || *value == '\0') |
137 value = gaim_account_user_split_get_default_value(split); | 137 value = purple_account_user_split_get_default_value(split); |
138 g_string_append_printf(username, "%c%s", | 138 g_string_append_printf(username, "%c%s", |
139 gaim_account_user_split_get_separator(split), | 139 purple_account_user_split_get_separator(split), |
140 value); | 140 value); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 if (dialog->account == NULL) | 144 if (dialog->account == NULL) |
145 { | 145 { |
146 account = gaim_account_new(username->str, gaim_plugin_get_id(plugin)); | 146 account = purple_account_new(username->str, purple_plugin_get_id(plugin)); |
147 gaim_accounts_add(account); | 147 purple_accounts_add(account); |
148 } | 148 } |
149 else | 149 else |
150 { | 150 { |
151 account = dialog->account; | 151 account = dialog->account; |
152 | 152 |
153 /* Protocol */ | 153 /* Protocol */ |
154 gaim_account_set_protocol_id(account, gaim_plugin_get_id(plugin)); | 154 purple_account_set_protocol_id(account, purple_plugin_get_id(plugin)); |
155 gaim_account_set_username(account, username->str); | 155 purple_account_set_username(account, username->str); |
156 } | 156 } |
157 g_string_free(username, TRUE); | 157 g_string_free(username, TRUE); |
158 | 158 |
159 /* Alias */ | 159 /* Alias */ |
160 value = gnt_entry_get_text(GNT_ENTRY(dialog->alias)); | 160 value = gnt_entry_get_text(GNT_ENTRY(dialog->alias)); |
161 if (value && *value) | 161 if (value && *value) |
162 gaim_account_set_alias(account, value); | 162 purple_account_set_alias(account, value); |
163 | 163 |
164 /* Remember password and password */ | 164 /* Remember password and password */ |
165 gaim_account_set_remember_password(account, | 165 purple_account_set_remember_password(account, |
166 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->remember))); | 166 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->remember))); |
167 value = gnt_entry_get_text(GNT_ENTRY(dialog->password)); | 167 value = gnt_entry_get_text(GNT_ENTRY(dialog->password)); |
168 if (value && *value && gaim_account_get_remember_password(account)) | 168 if (value && *value && purple_account_get_remember_password(account)) |
169 gaim_account_set_password(account, value); | 169 purple_account_set_password(account, value); |
170 else | 170 else |
171 gaim_account_set_password(account, NULL); | 171 purple_account_set_password(account, NULL); |
172 | 172 |
173 /* Mail notification */ | 173 /* Mail notification */ |
174 gaim_account_set_check_mail(account, | 174 purple_account_set_check_mail(account, |
175 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->newmail))); | 175 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->newmail))); |
176 | 176 |
177 /* Protocol options */ | 177 /* Protocol options */ |
178 if (prplinfo) | 178 if (prplinfo) |
179 { | 179 { |
180 GList *iter, *entries; | 180 GList *iter, *entries; |
181 | 181 |
182 for (iter = prplinfo->protocol_options, entries = dialog->prpl_entries; | 182 for (iter = prplinfo->protocol_options, entries = dialog->prpl_entries; |
183 iter && entries; iter = iter->next, entries = entries->next) | 183 iter && entries; iter = iter->next, entries = entries->next) |
184 { | 184 { |
185 GaimAccountOption *option = iter->data; | 185 PurpleAccountOption *option = iter->data; |
186 GntWidget *entry = entries->data; | 186 GntWidget *entry = entries->data; |
187 GaimPrefType type = gaim_account_option_get_type(option); | 187 PurplePrefType type = purple_account_option_get_type(option); |
188 const char *setting = gaim_account_option_get_setting(option); | 188 const char *setting = purple_account_option_get_setting(option); |
189 | 189 |
190 if (type == GAIM_PREF_STRING) | 190 if (type == PURPLE_PREF_STRING) |
191 { | 191 { |
192 const char *value = gnt_entry_get_text(GNT_ENTRY(entry)); | 192 const char *value = gnt_entry_get_text(GNT_ENTRY(entry)); |
193 gaim_account_set_string(account, setting, value); | 193 purple_account_set_string(account, setting, value); |
194 } | 194 } |
195 else if (type == GAIM_PREF_INT) | 195 else if (type == PURPLE_PREF_INT) |
196 { | 196 { |
197 const char *str = gnt_entry_get_text(GNT_ENTRY(entry)); | 197 const char *str = gnt_entry_get_text(GNT_ENTRY(entry)); |
198 int value = 0; | 198 int value = 0; |
199 if (str) | 199 if (str) |
200 value = atoi(str); | 200 value = atoi(str); |
201 gaim_account_set_int(account, setting, value); | 201 purple_account_set_int(account, setting, value); |
202 } | 202 } |
203 else if (type == GAIM_PREF_BOOLEAN) | 203 else if (type == PURPLE_PREF_BOOLEAN) |
204 { | 204 { |
205 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(entry)); | 205 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(entry)); |
206 gaim_account_set_bool(account, setting, value); | 206 purple_account_set_bool(account, setting, value); |
207 } | 207 } |
208 else if (type == GAIM_PREF_STRING_LIST) | 208 else if (type == PURPLE_PREF_STRING_LIST) |
209 { | 209 { |
210 /* TODO: */ | 210 /* TODO: */ |
211 } | 211 } |
212 else | 212 else |
213 { | 213 { |
223 | 223 |
224 static void | 224 static void |
225 update_user_splits(AccountEditDialog *dialog) | 225 update_user_splits(AccountEditDialog *dialog) |
226 { | 226 { |
227 GntWidget *hbox; | 227 GntWidget *hbox; |
228 GaimPlugin *plugin; | 228 PurplePlugin *plugin; |
229 GaimPluginProtocolInfo *prplinfo; | 229 PurplePluginProtocolInfo *prplinfo; |
230 GList *iter, *entries; | 230 GList *iter, *entries; |
231 char *username = NULL; | 231 char *username = NULL; |
232 | 232 |
233 if (dialog->splits) | 233 if (dialog->splits) |
234 { | 234 { |
245 dialog->split_entries = NULL; | 245 dialog->split_entries = NULL; |
246 | 246 |
247 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | 247 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
248 if (!plugin) | 248 if (!plugin) |
249 return; | 249 return; |
250 prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); | 250 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
251 | 251 |
252 username = dialog->account ? g_strdup(gaim_account_get_username(dialog->account)) : NULL; | 252 username = dialog->account ? g_strdup(purple_account_get_username(dialog->account)) : NULL; |
253 | 253 |
254 for (iter = prplinfo->user_splits; iter; iter = iter->next) | 254 for (iter = prplinfo->user_splits; iter; iter = iter->next) |
255 { | 255 { |
256 GaimAccountUserSplit *split = iter->data; | 256 PurpleAccountUserSplit *split = iter->data; |
257 GntWidget *entry; | 257 GntWidget *entry; |
258 char *buf; | 258 char *buf; |
259 | 259 |
260 hbox = gnt_hbox_new(TRUE); | 260 hbox = gnt_hbox_new(TRUE); |
261 gnt_box_add_widget(GNT_BOX(dialog->splits), hbox); | 261 gnt_box_add_widget(GNT_BOX(dialog->splits), hbox); |
262 | 262 |
263 buf = g_strdup_printf("%s:", gaim_account_user_split_get_text(split)); | 263 buf = g_strdup_printf("%s:", purple_account_user_split_get_text(split)); |
264 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(buf)); | 264 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(buf)); |
265 | 265 |
266 entry = gnt_entry_new(NULL); | 266 entry = gnt_entry_new(NULL); |
267 gnt_box_add_widget(GNT_BOX(hbox), entry); | 267 gnt_box_add_widget(GNT_BOX(hbox), entry); |
268 | 268 |
272 | 272 |
273 for (iter = g_list_last(prplinfo->user_splits), entries = g_list_last(dialog->split_entries); | 273 for (iter = g_list_last(prplinfo->user_splits), entries = g_list_last(dialog->split_entries); |
274 iter && entries; iter = iter->prev, entries = entries->prev) | 274 iter && entries; iter = iter->prev, entries = entries->prev) |
275 { | 275 { |
276 GntWidget *entry = entries->data; | 276 GntWidget *entry = entries->data; |
277 GaimAccountUserSplit *split = iter->data; | 277 PurpleAccountUserSplit *split = iter->data; |
278 const char *value = NULL; | 278 const char *value = NULL; |
279 char *s; | 279 char *s; |
280 | 280 |
281 if (dialog->account) | 281 if (dialog->account) |
282 { | 282 { |
283 s = strrchr(username, gaim_account_user_split_get_separator(split)); | 283 s = strrchr(username, purple_account_user_split_get_separator(split)); |
284 if (s != NULL) | 284 if (s != NULL) |
285 { | 285 { |
286 *s = '\0'; | 286 *s = '\0'; |
287 s++; | 287 s++; |
288 value = s; | 288 value = s; |
289 } | 289 } |
290 } | 290 } |
291 if (value == NULL) | 291 if (value == NULL) |
292 value = gaim_account_user_split_get_default_value(split); | 292 value = purple_account_user_split_get_default_value(split); |
293 | 293 |
294 if (value != NULL) | 294 if (value != NULL) |
295 gnt_entry_set_text(GNT_ENTRY(entry), value); | 295 gnt_entry_set_text(GNT_ENTRY(entry), value); |
296 } | 296 } |
297 | 297 |
302 } | 302 } |
303 | 303 |
304 static void | 304 static void |
305 add_protocol_options(AccountEditDialog *dialog) | 305 add_protocol_options(AccountEditDialog *dialog) |
306 { | 306 { |
307 GaimPlugin *plugin; | 307 PurplePlugin *plugin; |
308 GaimPluginProtocolInfo *prplinfo; | 308 PurplePluginProtocolInfo *prplinfo; |
309 GList *iter; | 309 GList *iter; |
310 GntWidget *vbox, *box; | 310 GntWidget *vbox, *box; |
311 GaimAccount *account; | 311 PurpleAccount *account; |
312 | 312 |
313 if (dialog->prpls) | 313 if (dialog->prpls) |
314 gnt_box_remove_all(GNT_BOX(dialog->prpls)); | 314 gnt_box_remove_all(GNT_BOX(dialog->prpls)); |
315 else | 315 else |
316 { | 316 { |
330 | 330 |
331 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | 331 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
332 if (!plugin) | 332 if (!plugin) |
333 return; | 333 return; |
334 | 334 |
335 prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); | 335 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
336 | 336 |
337 account = dialog->account; | 337 account = dialog->account; |
338 | 338 |
339 for (iter = prplinfo->protocol_options; iter; iter = iter->next) | 339 for (iter = prplinfo->protocol_options; iter; iter = iter->next) |
340 { | 340 { |
341 GaimAccountOption *option = iter->data; | 341 PurpleAccountOption *option = iter->data; |
342 GaimPrefType type = gaim_account_option_get_type(option); | 342 PurplePrefType type = purple_account_option_get_type(option); |
343 | 343 |
344 box = gnt_hbox_new(TRUE); | 344 box = gnt_hbox_new(TRUE); |
345 gnt_box_set_pad(GNT_BOX(box), 0); | 345 gnt_box_set_pad(GNT_BOX(box), 0); |
346 gnt_box_add_widget(GNT_BOX(vbox), box); | 346 gnt_box_add_widget(GNT_BOX(vbox), box); |
347 | 347 |
348 if (type == GAIM_PREF_BOOLEAN) | 348 if (type == PURPLE_PREF_BOOLEAN) |
349 { | 349 { |
350 GntWidget *widget = gnt_check_box_new(gaim_account_option_get_text(option)); | 350 GntWidget *widget = gnt_check_box_new(purple_account_option_get_text(option)); |
351 gnt_box_add_widget(GNT_BOX(box), widget); | 351 gnt_box_add_widget(GNT_BOX(box), widget); |
352 dialog->prpl_entries = g_list_append(dialog->prpl_entries, widget); | 352 dialog->prpl_entries = g_list_append(dialog->prpl_entries, widget); |
353 | 353 |
354 if (account) | 354 if (account) |
355 gnt_check_box_set_checked(GNT_CHECK_BOX(widget), | 355 gnt_check_box_set_checked(GNT_CHECK_BOX(widget), |
356 gaim_account_get_bool(account, | 356 purple_account_get_bool(account, |
357 gaim_account_option_get_setting(option), | 357 purple_account_option_get_setting(option), |
358 gaim_account_option_get_default_bool(option))); | 358 purple_account_option_get_default_bool(option))); |
359 else | 359 else |
360 gnt_check_box_set_checked(GNT_CHECK_BOX(widget), | 360 gnt_check_box_set_checked(GNT_CHECK_BOX(widget), |
361 gaim_account_option_get_default_bool(option)); | 361 purple_account_option_get_default_bool(option)); |
362 } | 362 } |
363 else | 363 else |
364 { | 364 { |
365 gnt_box_add_widget(GNT_BOX(box), | 365 gnt_box_add_widget(GNT_BOX(box), |
366 gnt_label_new(gaim_account_option_get_text(option))); | 366 gnt_label_new(purple_account_option_get_text(option))); |
367 | 367 |
368 if (type == GAIM_PREF_STRING_LIST) | 368 if (type == PURPLE_PREF_STRING_LIST) |
369 { | 369 { |
370 /* TODO: Use a combobox */ | 370 /* TODO: Use a combobox */ |
371 /* Don't forget to append the widget to prpl_entries */ | 371 /* Don't forget to append the widget to prpl_entries */ |
372 } | 372 } |
373 else | 373 else |
374 { | 374 { |
375 GntWidget *entry = gnt_entry_new(NULL); | 375 GntWidget *entry = gnt_entry_new(NULL); |
376 gnt_box_add_widget(GNT_BOX(box), entry); | 376 gnt_box_add_widget(GNT_BOX(box), entry); |
377 dialog->prpl_entries = g_list_append(dialog->prpl_entries, entry); | 377 dialog->prpl_entries = g_list_append(dialog->prpl_entries, entry); |
378 | 378 |
379 if (type == GAIM_PREF_STRING) | 379 if (type == PURPLE_PREF_STRING) |
380 { | 380 { |
381 const char *dv = gaim_account_option_get_default_string(option); | 381 const char *dv = purple_account_option_get_default_string(option); |
382 | 382 |
383 if (account) | 383 if (account) |
384 gnt_entry_set_text(GNT_ENTRY(entry), | 384 gnt_entry_set_text(GNT_ENTRY(entry), |
385 gaim_account_get_string(account, | 385 purple_account_get_string(account, |
386 gaim_account_option_get_setting(option), dv)); | 386 purple_account_option_get_setting(option), dv)); |
387 else | 387 else |
388 gnt_entry_set_text(GNT_ENTRY(entry), dv); | 388 gnt_entry_set_text(GNT_ENTRY(entry), dv); |
389 } | 389 } |
390 else if (type == GAIM_PREF_INT) | 390 else if (type == PURPLE_PREF_INT) |
391 { | 391 { |
392 char str[32]; | 392 char str[32]; |
393 int value = gaim_account_option_get_default_int(option); | 393 int value = purple_account_option_get_default_int(option); |
394 if (account) | 394 if (account) |
395 value = gaim_account_get_int(account, | 395 value = purple_account_get_int(account, |
396 gaim_account_option_get_setting(option), value); | 396 purple_account_option_get_setting(option), value); |
397 snprintf(str, sizeof(str), "%d", value); | 397 snprintf(str, sizeof(str), "%d", value); |
398 gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); | 398 gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); |
399 gnt_entry_set_text(GNT_ENTRY(entry), str); | 399 gnt_entry_set_text(GNT_ENTRY(entry), str); |
400 } | 400 } |
401 else | 401 else |
408 } | 408 } |
409 | 409 |
410 static void | 410 static void |
411 update_user_options(AccountEditDialog *dialog) | 411 update_user_options(AccountEditDialog *dialog) |
412 { | 412 { |
413 GaimPlugin *plugin; | 413 PurplePlugin *plugin; |
414 GaimPluginProtocolInfo *prplinfo; | 414 PurplePluginProtocolInfo *prplinfo; |
415 | 415 |
416 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | 416 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
417 if (!plugin) | 417 if (!plugin) |
418 return; | 418 return; |
419 | 419 |
420 prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); | 420 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
421 | 421 |
422 if (dialog->newmail == NULL) | 422 if (dialog->newmail == NULL) |
423 dialog->newmail = gnt_check_box_new(_("New mail notifications")); | 423 dialog->newmail = gnt_check_box_new(_("New mail notifications")); |
424 if (dialog->account) | 424 if (dialog->account) |
425 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->newmail), | 425 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->newmail), |
426 gaim_account_get_check_mail(dialog->account)); | 426 purple_account_get_check_mail(dialog->account)); |
427 if (!prplinfo || !(prplinfo->options & OPT_PROTO_MAIL_CHECK)) | 427 if (!prplinfo || !(prplinfo->options & OPT_PROTO_MAIL_CHECK)) |
428 gnt_widget_set_visible(dialog->newmail, FALSE); | 428 gnt_widget_set_visible(dialog->newmail, FALSE); |
429 else | 429 else |
430 gnt_widget_set_visible(dialog->newmail, TRUE); | 430 gnt_widget_set_visible(dialog->newmail, TRUE); |
431 | 431 |
432 if (dialog->remember == NULL) | 432 if (dialog->remember == NULL) |
433 dialog->remember = gnt_check_box_new(_("Remember password")); | 433 dialog->remember = gnt_check_box_new(_("Remember password")); |
434 if (dialog->account) | 434 if (dialog->account) |
435 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->remember), | 435 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->remember), |
436 gaim_account_get_remember_password(dialog->account)); | 436 purple_account_get_remember_password(dialog->account)); |
437 } | 437 } |
438 | 438 |
439 static void | 439 static void |
440 prpl_changed_cb(GntWidget *combo, GaimPlugin *old, GaimPlugin *new, AccountEditDialog *dialog) | 440 prpl_changed_cb(GntWidget *combo, PurplePlugin *old, PurplePlugin *new, AccountEditDialog *dialog) |
441 { | 441 { |
442 update_user_splits(dialog); | 442 update_user_splits(dialog); |
443 add_protocol_options(dialog); | 443 add_protocol_options(dialog); |
444 update_user_options(dialog); /* This may not be necessary here */ | 444 update_user_options(dialog); /* This may not be necessary here */ |
445 gnt_box_readjust(GNT_BOX(dialog->window)); | 445 gnt_box_readjust(GNT_BOX(dialog->window)); |
446 gnt_widget_draw(dialog->window); | 446 gnt_widget_draw(dialog->window); |
447 } | 447 } |
448 | 448 |
449 static void | 449 static void |
450 edit_account(GaimAccount *account) | 450 edit_account(PurpleAccount *account) |
451 { | 451 { |
452 GntWidget *window, *hbox; | 452 GntWidget *window, *hbox; |
453 GntWidget *combo, *button, *entry; | 453 GntWidget *combo, *button, *entry; |
454 GList *list, *iter; | 454 GList *list, *iter; |
455 AccountEditDialog *dialog; | 455 AccountEditDialog *dialog; |
480 hbox = gnt_hbox_new(TRUE); | 480 hbox = gnt_hbox_new(TRUE); |
481 gnt_box_set_pad(GNT_BOX(hbox), 0); | 481 gnt_box_set_pad(GNT_BOX(hbox), 0); |
482 gnt_box_add_widget(GNT_BOX(window), hbox); | 482 gnt_box_add_widget(GNT_BOX(window), hbox); |
483 | 483 |
484 dialog->protocol = combo = gnt_combo_box_new(); | 484 dialog->protocol = combo = gnt_combo_box_new(); |
485 list = gaim_plugins_get_protocols(); | 485 list = purple_plugins_get_protocols(); |
486 for (iter = list; iter; iter = iter->next) | 486 for (iter = list; iter; iter = iter->next) |
487 { | 487 { |
488 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), iter->data, | 488 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), iter->data, |
489 ((GaimPlugin*)iter->data)->info->name); | 489 ((PurplePlugin*)iter->data)->info->name); |
490 } | 490 } |
491 | 491 |
492 if (account) | 492 if (account) |
493 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), | 493 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), |
494 gaim_plugins_find_with_id(gaim_account_get_protocol_id(account))); | 494 purple_plugins_find_with_id(purple_account_get_protocol_id(account))); |
495 else | 495 else |
496 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), list->data); | 496 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), list->data); |
497 | 497 |
498 g_signal_connect(G_OBJECT(combo), "selection-changed", G_CALLBACK(prpl_changed_cb), dialog); | 498 g_signal_connect(G_OBJECT(combo), "selection-changed", G_CALLBACK(prpl_changed_cb), dialog); |
499 | 499 |
519 dialog->password = entry = gnt_entry_new(NULL); | 519 dialog->password = entry = gnt_entry_new(NULL); |
520 gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); | 520 gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); |
521 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Password:"))); | 521 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Password:"))); |
522 gnt_box_add_widget(GNT_BOX(hbox), entry); | 522 gnt_box_add_widget(GNT_BOX(hbox), entry); |
523 if (account) | 523 if (account) |
524 gnt_entry_set_text(GNT_ENTRY(entry), gaim_account_get_password(account)); | 524 gnt_entry_set_text(GNT_ENTRY(entry), purple_account_get_password(account)); |
525 | 525 |
526 hbox = gnt_hbox_new(TRUE); | 526 hbox = gnt_hbox_new(TRUE); |
527 gnt_box_set_pad(GNT_BOX(hbox), 0); | 527 gnt_box_set_pad(GNT_BOX(hbox), 0); |
528 gnt_box_add_widget(GNT_BOX(window), hbox); | 528 gnt_box_add_widget(GNT_BOX(window), hbox); |
529 | 529 |
530 dialog->alias = entry = gnt_entry_new(NULL); | 530 dialog->alias = entry = gnt_entry_new(NULL); |
531 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Alias:"))); | 531 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Alias:"))); |
532 gnt_box_add_widget(GNT_BOX(hbox), entry); | 532 gnt_box_add_widget(GNT_BOX(hbox), entry); |
533 if (account) | 533 if (account) |
534 gnt_entry_set_text(GNT_ENTRY(entry), gaim_account_get_alias(account)); | 534 gnt_entry_set_text(GNT_ENTRY(entry), purple_account_get_alias(account)); |
535 | 535 |
536 /* User options */ | 536 /* User options */ |
537 update_user_options(dialog); | 537 update_user_options(dialog); |
538 gnt_box_add_widget(GNT_BOX(window), dialog->remember); | 538 gnt_box_add_widget(GNT_BOX(window), dialog->remember); |
539 gnt_box_add_widget(GNT_BOX(window), dialog->newmail); | 539 gnt_box_add_widget(GNT_BOX(window), dialog->newmail); |
573 } | 573 } |
574 | 574 |
575 static void | 575 static void |
576 modify_account_cb(GntWidget *widget, GntTree *tree) | 576 modify_account_cb(GntWidget *widget, GntTree *tree) |
577 { | 577 { |
578 GaimAccount *account = gnt_tree_get_selection_data(tree); | 578 PurpleAccount *account = gnt_tree_get_selection_data(tree); |
579 if (!account) | 579 if (!account) |
580 return; | 580 return; |
581 edit_account(account); | 581 edit_account(account); |
582 } | 582 } |
583 | 583 |
584 static void | 584 static void |
585 really_delete_account(GaimAccount *account) | 585 really_delete_account(PurpleAccount *account) |
586 { | 586 { |
587 GList *iter; | 587 GList *iter; |
588 for (iter = accountdialogs; iter; iter = iter->next) | 588 for (iter = accountdialogs; iter; iter = iter->next) |
589 { | 589 { |
590 AccountEditDialog *dlg = iter->data; | 590 AccountEditDialog *dlg = iter->data; |
592 { | 592 { |
593 gnt_widget_destroy(dlg->window); | 593 gnt_widget_destroy(dlg->window); |
594 break; | 594 break; |
595 } | 595 } |
596 } | 596 } |
597 gaim_request_close_with_handle(account); /* Close any other opened delete window */ | 597 purple_request_close_with_handle(account); /* Close any other opened delete window */ |
598 gaim_accounts_delete(account); | 598 purple_accounts_delete(account); |
599 } | 599 } |
600 | 600 |
601 static void | 601 static void |
602 delete_account_cb(GntWidget *widget, GntTree *tree) | 602 delete_account_cb(GntWidget *widget, GntTree *tree) |
603 { | 603 { |
604 GaimAccount *account; | 604 PurpleAccount *account; |
605 char *prompt; | 605 char *prompt; |
606 | 606 |
607 account = gnt_tree_get_selection_data(tree); | 607 account = gnt_tree_get_selection_data(tree); |
608 if (!account) | 608 if (!account) |
609 return; | 609 return; |
610 | 610 |
611 prompt = g_strdup_printf(_("Are you sure you want to delete %s?"), | 611 prompt = g_strdup_printf(_("Are you sure you want to delete %s?"), |
612 gaim_account_get_username(account)); | 612 purple_account_get_username(account)); |
613 | 613 |
614 gaim_request_action(account, _("Delete Account"), prompt, NULL, 0, account, 2, | 614 purple_request_action(account, _("Delete Account"), prompt, NULL, 0, account, 2, |
615 _("Delete"), really_delete_account, _("Cancel"), NULL); | 615 _("Delete"), really_delete_account, _("Cancel"), NULL); |
616 g_free(prompt); | 616 g_free(prompt); |
617 } | 617 } |
618 | 618 |
619 static void | 619 static void |
620 account_toggled(GntWidget *widget, void *key, gpointer null) | 620 account_toggled(GntWidget *widget, void *key, gpointer null) |
621 { | 621 { |
622 GaimAccount *account = key; | 622 PurpleAccount *account = key; |
623 | 623 |
624 gaim_account_set_enabled(account, GAIM_GNT_UI, gnt_tree_get_choice(GNT_TREE(widget), key)); | 624 purple_account_set_enabled(account, FINCH_UI, gnt_tree_get_choice(GNT_TREE(widget), key)); |
625 } | 625 } |
626 | 626 |
627 static void | 627 static void |
628 reset_accounts_win(GntWidget *widget, gpointer null) | 628 reset_accounts_win(GntWidget *widget, gpointer null) |
629 { | 629 { |
652 gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); | 652 gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); |
653 | 653 |
654 accounts.tree = gnt_tree_new_with_columns(2); | 654 accounts.tree = gnt_tree_new_with_columns(2); |
655 GNT_WIDGET_SET_FLAGS(accounts.tree, GNT_WIDGET_NO_BORDER); | 655 GNT_WIDGET_SET_FLAGS(accounts.tree, GNT_WIDGET_NO_BORDER); |
656 | 656 |
657 for (iter = gaim_accounts_get_all(); iter; iter = iter->next) | 657 for (iter = purple_accounts_get_all(); iter; iter = iter->next) |
658 { | 658 { |
659 GaimAccount *account = iter->data; | 659 PurpleAccount *account = iter->data; |
660 account_add(account); | 660 account_add(account); |
661 } | 661 } |
662 | 662 |
663 g_signal_connect(G_OBJECT(accounts.tree), "toggled", G_CALLBACK(account_toggled), NULL); | 663 g_signal_connect(G_OBJECT(accounts.tree), "toggled", G_CALLBACK(account_toggled), NULL); |
664 | 664 |
696 | 696 |
697 return &handle; | 697 return &handle; |
698 } | 698 } |
699 | 699 |
700 static void | 700 static void |
701 account_added_callback(GaimAccount *account) | 701 account_added_callback(PurpleAccount *account) |
702 { | 702 { |
703 if (accounts.window == NULL) | 703 if (accounts.window == NULL) |
704 return; | 704 return; |
705 account_add(account); | 705 account_add(account); |
706 gnt_widget_draw(accounts.tree); | 706 gnt_widget_draw(accounts.tree); |
707 } | 707 } |
708 | 708 |
709 static void | 709 static void |
710 account_removed_callback(GaimAccount *account) | 710 account_removed_callback(PurpleAccount *account) |
711 { | 711 { |
712 if (accounts.window == NULL) | 712 if (accounts.window == NULL) |
713 return; | 713 return; |
714 | 714 |
715 gnt_tree_remove(GNT_TREE(accounts.tree), account); | 715 gnt_tree_remove(GNT_TREE(accounts.tree), account); |
717 | 717 |
718 void finch_accounts_init() | 718 void finch_accounts_init() |
719 { | 719 { |
720 GList *iter; | 720 GList *iter; |
721 | 721 |
722 gaim_signal_connect(gaim_accounts_get_handle(), "account-added", | 722 purple_signal_connect(purple_accounts_get_handle(), "account-added", |
723 finch_accounts_get_handle(), GAIM_CALLBACK(account_added_callback), | 723 finch_accounts_get_handle(), PURPLE_CALLBACK(account_added_callback), |
724 NULL); | 724 NULL); |
725 gaim_signal_connect(gaim_accounts_get_handle(), "account-removed", | 725 purple_signal_connect(purple_accounts_get_handle(), "account-removed", |
726 finch_accounts_get_handle(), GAIM_CALLBACK(account_removed_callback), | 726 finch_accounts_get_handle(), PURPLE_CALLBACK(account_removed_callback), |
727 NULL); | 727 NULL); |
728 | 728 |
729 for (iter = gaim_accounts_get_all(); iter; iter = iter->next) { | 729 for (iter = purple_accounts_get_all(); iter; iter = iter->next) { |
730 if (gaim_account_get_enabled(iter->data, GAIM_GNT_UI)) | 730 if (purple_account_get_enabled(iter->data, FINCH_UI)) |
731 break; | 731 break; |
732 } | 732 } |
733 if (!iter) | 733 if (!iter) |
734 finch_accounts_show_all(); | 734 finch_accounts_show_all(); |
735 } | 735 } |
741 } | 741 } |
742 | 742 |
743 /* The following uiops stuff are copied from gtkaccount.c */ | 743 /* The following uiops stuff are copied from gtkaccount.c */ |
744 typedef struct | 744 typedef struct |
745 { | 745 { |
746 GaimAccount *account; | 746 PurpleAccount *account; |
747 char *username; | 747 char *username; |
748 char *alias; | 748 char *alias; |
749 } AddUserData; | 749 } AddUserData; |
750 | 750 |
751 static char * | 751 static char * |
752 make_info(GaimAccount *account, GaimConnection *gc, const char *remote_user, | 752 make_info(PurpleAccount *account, PurpleConnection *gc, const char *remote_user, |
753 const char *id, const char *alias, const char *msg) | 753 const char *id, const char *alias, const char *msg) |
754 { | 754 { |
755 if (msg != NULL && *msg == '\0') | 755 if (msg != NULL && *msg == '\0') |
756 msg = NULL; | 756 msg = NULL; |
757 | 757 |
760 (alias != NULL ? " (" : ""), | 760 (alias != NULL ? " (" : ""), |
761 (alias != NULL ? alias : ""), | 761 (alias != NULL ? alias : ""), |
762 (alias != NULL ? ")" : ""), | 762 (alias != NULL ? ")" : ""), |
763 (id != NULL | 763 (id != NULL |
764 ? id | 764 ? id |
765 : (gaim_connection_get_display_name(gc) != NULL | 765 : (purple_connection_get_display_name(gc) != NULL |
766 ? gaim_connection_get_display_name(gc) | 766 ? purple_connection_get_display_name(gc) |
767 : gaim_account_get_username(account))), | 767 : purple_account_get_username(account))), |
768 (msg != NULL ? ": " : "."), | 768 (msg != NULL ? ": " : "."), |
769 (msg != NULL ? msg : "")); | 769 (msg != NULL ? msg : "")); |
770 } | 770 } |
771 | 771 |
772 static void | 772 static void |
773 notify_added(GaimAccount *account, const char *remote_user, | 773 notify_added(PurpleAccount *account, const char *remote_user, |
774 const char *id, const char *alias, | 774 const char *id, const char *alias, |
775 const char *msg) | 775 const char *msg) |
776 { | 776 { |
777 char *buffer; | 777 char *buffer; |
778 GaimConnection *gc; | 778 PurpleConnection *gc; |
779 | 779 |
780 gc = gaim_account_get_connection(account); | 780 gc = purple_account_get_connection(account); |
781 | 781 |
782 buffer = make_info(account, gc, remote_user, id, alias, msg); | 782 buffer = make_info(account, gc, remote_user, id, alias, msg); |
783 | 783 |
784 gaim_notify_info(NULL, NULL, buffer, NULL); | 784 purple_notify_info(NULL, NULL, buffer, NULL); |
785 | 785 |
786 g_free(buffer); | 786 g_free(buffer); |
787 } | 787 } |
788 | 788 |
789 static void | 789 static void |
798 } | 798 } |
799 | 799 |
800 static void | 800 static void |
801 add_user_cb(AddUserData *data) | 801 add_user_cb(AddUserData *data) |
802 { | 802 { |
803 GaimConnection *gc = gaim_account_get_connection(data->account); | 803 PurpleConnection *gc = purple_account_get_connection(data->account); |
804 | 804 |
805 if (g_list_find(gaim_connections_get_all(), gc)) | 805 if (g_list_find(purple_connections_get_all(), gc)) |
806 { | 806 { |
807 gaim_blist_request_add_buddy(data->account, data->username, | 807 purple_blist_request_add_buddy(data->account, data->username, |
808 NULL, data->alias); | 808 NULL, data->alias); |
809 } | 809 } |
810 | 810 |
811 free_add_user_data(data); | 811 free_add_user_data(data); |
812 } | 812 } |
813 | 813 |
814 static void | 814 static void |
815 request_add(GaimAccount *account, const char *remote_user, | 815 request_add(PurpleAccount *account, const char *remote_user, |
816 const char *id, const char *alias, | 816 const char *id, const char *alias, |
817 const char *msg) | 817 const char *msg) |
818 { | 818 { |
819 char *buffer; | 819 char *buffer; |
820 GaimConnection *gc; | 820 PurpleConnection *gc; |
821 AddUserData *data; | 821 AddUserData *data; |
822 | 822 |
823 gc = gaim_account_get_connection(account); | 823 gc = purple_account_get_connection(account); |
824 | 824 |
825 data = g_new0(AddUserData, 1); | 825 data = g_new0(AddUserData, 1); |
826 data->account = account; | 826 data->account = account; |
827 data->username = g_strdup(remote_user); | 827 data->username = g_strdup(remote_user); |
828 data->alias = (alias != NULL ? g_strdup(alias) : NULL); | 828 data->alias = (alias != NULL ? g_strdup(alias) : NULL); |
829 | 829 |
830 buffer = make_info(account, gc, remote_user, id, alias, msg); | 830 buffer = make_info(account, gc, remote_user, id, alias, msg); |
831 gaim_request_action(NULL, NULL, _("Add buddy to your list?"), | 831 purple_request_action(NULL, NULL, _("Add buddy to your list?"), |
832 buffer, GAIM_DEFAULT_ACTION_NONE, data, 2, | 832 buffer, PURPLE_DEFAULT_ACTION_NONE, data, 2, |
833 _("Add"), G_CALLBACK(add_user_cb), | 833 _("Add"), G_CALLBACK(add_user_cb), |
834 _("Cancel"), G_CALLBACK(free_add_user_data)); | 834 _("Cancel"), G_CALLBACK(free_add_user_data)); |
835 g_free(buffer); | 835 g_free(buffer); |
836 } | 836 } |
837 | 837 |
838 /* Copied from gtkaccount.c */ | 838 /* Copied from gtkaccount.c */ |
839 typedef struct { | 839 typedef struct { |
840 GaimAccountRequestAuthorizationCb auth_cb; | 840 PurpleAccountRequestAuthorizationCb auth_cb; |
841 GaimAccountRequestAuthorizationCb deny_cb; | 841 PurpleAccountRequestAuthorizationCb deny_cb; |
842 void *data; | 842 void *data; |
843 char *username; | 843 char *username; |
844 char *alias; | 844 char *alias; |
845 GaimAccount *account; | 845 PurpleAccount *account; |
846 } auth_and_add; | 846 } auth_and_add; |
847 | 847 |
848 static void | 848 static void |
849 authorize_and_add_cb(auth_and_add *aa) | 849 authorize_and_add_cb(auth_and_add *aa) |
850 { | 850 { |
851 aa->auth_cb(aa->data); | 851 aa->auth_cb(aa->data); |
852 gaim_blist_request_add_buddy(aa->account, aa->username, | 852 purple_blist_request_add_buddy(aa->account, aa->username, |
853 NULL, aa->alias); | 853 NULL, aa->alias); |
854 | 854 |
855 g_free(aa->username); | 855 g_free(aa->username); |
856 g_free(aa->alias); | 856 g_free(aa->alias); |
857 g_free(aa); | 857 g_free(aa); |
866 g_free(aa->alias); | 866 g_free(aa->alias); |
867 g_free(aa); | 867 g_free(aa); |
868 } | 868 } |
869 | 869 |
870 static void * | 870 static void * |
871 finch_request_authorize(GaimAccount *account, const char *remote_user, | 871 finch_request_authorize(PurpleAccount *account, const char *remote_user, |
872 const char *id, const char *alias, const char *message, gboolean on_list, | 872 const char *id, const char *alias, const char *message, gboolean on_list, |
873 GCallback auth_cb, GCallback deny_cb, void *user_data) | 873 GCallback auth_cb, GCallback deny_cb, void *user_data) |
874 { | 874 { |
875 char *buffer; | 875 char *buffer; |
876 GaimConnection *gc; | 876 PurpleConnection *gc; |
877 void *uihandle; | 877 void *uihandle; |
878 | 878 |
879 gc = gaim_account_get_connection(account); | 879 gc = purple_account_get_connection(account); |
880 if (message != NULL && *message == '\0') | 880 if (message != NULL && *message == '\0') |
881 message = NULL; | 881 message = NULL; |
882 | 882 |
883 buffer = g_strdup_printf(_("%s%s%s%s wants to add %s to his or her buddy list%s%s"), | 883 buffer = g_strdup_printf(_("%s%s%s%s wants to add %s to his or her buddy list%s%s"), |
884 remote_user, | 884 remote_user, |
885 (alias != NULL ? " (" : ""), | 885 (alias != NULL ? " (" : ""), |
886 (alias != NULL ? alias : ""), | 886 (alias != NULL ? alias : ""), |
887 (alias != NULL ? ")" : ""), | 887 (alias != NULL ? ")" : ""), |
888 (id != NULL | 888 (id != NULL |
889 ? id | 889 ? id |
890 : (gaim_connection_get_display_name(gc) != NULL | 890 : (purple_connection_get_display_name(gc) != NULL |
891 ? gaim_connection_get_display_name(gc) | 891 ? purple_connection_get_display_name(gc) |
892 : gaim_account_get_username(account))), | 892 : purple_account_get_username(account))), |
893 (message != NULL ? ": " : "."), | 893 (message != NULL ? ": " : "."), |
894 (message != NULL ? message : "")); | 894 (message != NULL ? message : "")); |
895 if (!on_list) { | 895 if (!on_list) { |
896 auth_and_add *aa = g_new(auth_and_add, 1); | 896 auth_and_add *aa = g_new(auth_and_add, 1); |
897 aa->auth_cb = (GaimAccountRequestAuthorizationCb)auth_cb; | 897 aa->auth_cb = (PurpleAccountRequestAuthorizationCb)auth_cb; |
898 aa->deny_cb = (GaimAccountRequestAuthorizationCb)deny_cb; | 898 aa->deny_cb = (PurpleAccountRequestAuthorizationCb)deny_cb; |
899 aa->data = user_data; | 899 aa->data = user_data; |
900 aa->username = g_strdup(remote_user); | 900 aa->username = g_strdup(remote_user); |
901 aa->alias = g_strdup(alias); | 901 aa->alias = g_strdup(alias); |
902 aa->account = account; | 902 aa->account = account; |
903 uihandle = gaim_request_action(NULL, _("Authorize buddy?"), buffer, NULL, | 903 uihandle = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, |
904 GAIM_DEFAULT_ACTION_NONE, aa, 2, | 904 PURPLE_DEFAULT_ACTION_NONE, aa, 2, |
905 _("Authorize"), authorize_and_add_cb, | 905 _("Authorize"), authorize_and_add_cb, |
906 _("Deny"), deny_no_add_cb); | 906 _("Deny"), deny_no_add_cb); |
907 } else { | 907 } else { |
908 uihandle = gaim_request_action(NULL, _("Authorize buddy?"), buffer, NULL, | 908 uihandle = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, |
909 GAIM_DEFAULT_ACTION_NONE, user_data, 2, | 909 PURPLE_DEFAULT_ACTION_NONE, user_data, 2, |
910 _("Authorize"), auth_cb, | 910 _("Authorize"), auth_cb, |
911 _("Deny"), deny_cb); | 911 _("Deny"), deny_cb); |
912 } | 912 } |
913 g_free(buffer); | 913 g_free(buffer); |
914 return uihandle; | 914 return uihandle; |
915 } | 915 } |
916 | 916 |
917 static void | 917 static void |
918 finch_request_close(void *uihandle) | 918 finch_request_close(void *uihandle) |
919 { | 919 { |
920 gaim_request_close(GAIM_REQUEST_ACTION, uihandle); | 920 purple_request_close(PURPLE_REQUEST_ACTION, uihandle); |
921 } | 921 } |
922 | 922 |
923 static GaimAccountUiOps ui_ops = | 923 static PurpleAccountUiOps ui_ops = |
924 { | 924 { |
925 .notify_added = notify_added, | 925 .notify_added = notify_added, |
926 .status_changed = NULL, | 926 .status_changed = NULL, |
927 .request_add = request_add, | 927 .request_add = request_add, |
928 .request_authorize = finch_request_authorize, | 928 .request_authorize = finch_request_authorize, |
929 .close_account_request = finch_request_close | 929 .close_account_request = finch_request_close |
930 }; | 930 }; |
931 | 931 |
932 GaimAccountUiOps *finch_accounts_get_ui_ops() | 932 PurpleAccountUiOps *finch_accounts_get_ui_ops() |
933 { | 933 { |
934 return &ui_ops; | 934 return &ui_ops; |
935 } | 935 } |
936 | 936 |