comparison src/multi.c @ 2442:895e2469cb3a

[gaim-migrate @ 2455] aim_user is split. mod_user probably only needs to be in multi.c but eh. moved struct conversation to ui.h. still need to create struct buddy_chat for the prpls to use. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 06 Oct 2001 04:05:53 +0000
parents 5cbe86a444d9
children 13ce96daf30f
comparison
equal deleted inserted replaced
2441:2c2c1f717616 2442:895e2469cb3a
42 42
43 GSList *connections; 43 GSList *connections;
44 44
45 static GtkWidget *acctedit = NULL; 45 static GtkWidget *acctedit = NULL;
46 static GtkWidget *list = NULL; /* the clist of names in the accteditor */ 46 static GtkWidget *list = NULL; /* the clist of names in the accteditor */
47 static GtkWidget *newmod = NULL; /* the dialog for creating a new account */ 47
48 static GtkWidget *newmain = NULL; /* the notebook that holds options */ 48 static GSList *mod_users = NULL;
49 static struct aim_user tmpusr = { "", "", "", OPT_USR_REM_PASS, DEFAULT_PROTO, 49
50 {"", "", "", "", "", "", ""}, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 50 static struct mod_user *find_mod_user(struct aim_user *a)
51 OPT_USR_REM_PASS, DEFAULT_PROTO, NULL, NULL, NULL, "", NULL, NULL, NULL, NULL, NULL 51 {
52 }; 52 GSList *m = mod_users;
53 53 while (m) {
54 static void generate_prpl_options(struct aim_user *, GtkWidget *); 54 struct mod_user *u = m->data;
55 if (u->user == a)
56 return u;
57 m = m->next;
58 }
59 return NULL;
60 }
61
62 static void generate_prpl_options(struct mod_user *, GtkWidget *);
55 63
56 struct mod_usr_opt { 64 struct mod_usr_opt {
57 struct aim_user *user; 65 struct mod_user *user;
58 int opt; 66 int opt;
59 }; 67 };
60 68
61 struct gaim_connection *new_gaim_conn(struct aim_user *user) 69 struct gaim_connection *new_gaim_conn(struct aim_user *user)
62 { 70 {
179 187
180 gtk_widget_show(win); 188 gtk_widget_show(win);
181 return win; 189 return win;
182 } 190 }
183 191
184 static void delmod(GtkWidget *w, struct aim_user *u) 192 static void delmod(GtkWidget *w, struct mod_user *u)
185 { 193 {
186 gtk_widget_destroy(w); 194 mod_users = g_slist_remove(mod_users, u);
187 if (u) { 195 g_free(u);
188 u->mod = NULL;
189 } else {
190 newmod = NULL;
191 }
192 } 196 }
193 197
194 static void mod_opt(GtkWidget *b, struct mod_usr_opt *m) 198 static void mod_opt(GtkWidget *b, struct mod_usr_opt *m)
195 { 199 {
196 if (m->user) { 200 m->user->options = m->user->options ^ m->opt;
197 m->user->tmp_options = m->user->tmp_options ^ m->opt;
198 } else {
199 tmpusr.options = tmpusr.options ^ m->opt;
200 }
201 } 201 }
202 202
203 static void free_muo(GtkWidget *b, struct mod_usr_opt *m) 203 static void free_muo(GtkWidget *b, struct mod_usr_opt *m)
204 { 204 {
205 g_free(m); 205 g_free(m);
206 } 206 }
207 207
208 static GtkWidget *acct_button(const char *text, struct aim_user *u, int option, GtkWidget *box) 208 static GtkWidget *acct_button(const char *text, struct mod_user *u, int option, GtkWidget *box)
209 { 209 {
210 GtkWidget *button; 210 GtkWidget *button;
211 struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1); 211 struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1);
212 button = gtk_check_button_new_with_label(text); 212 button = gtk_check_button_new_with_label(text);
213 if (u) { 213 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->options & option));
214 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->options & option));
215 } else {
216 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (tmpusr.options & option));
217 }
218 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); 214 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
219 muo->user = u; 215 muo->user = u;
220 muo->opt = option; 216 muo->opt = option;
221 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo); 217 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo);
222 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); 218 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo);
223 gtk_widget_show(button); 219 gtk_widget_show(button);
224 return button; 220 return button;
225 } 221 }
226 222
227 static void ok_mod(GtkWidget *w, struct aim_user *u) 223 static void ok_mod(GtkWidget *w, struct mod_user *u)
228 { 224 {
229 GList *tmp; 225 GList *tmp;
230 const char *txt; 226 const char *txt;
231 int i; 227 int i;
232 228 struct aim_user *a;
233 if (u) { 229
234 u->options = u->tmp_options; 230 if (!u->user) {
235 u->protocol = u->tmp_protocol; 231 txt = gtk_entry_get_text(GTK_ENTRY(u->name));
236 txt = gtk_entry_get_text(GTK_ENTRY(u->pass)); 232 u->user = new_user(txt, u->protocol, u->options);
237 if (u->options & OPT_USR_REM_PASS) 233 }
238 g_snprintf(u->password, sizeof(u->password), "%s", txt); 234 a = u->user;
239 else 235
240 u->password[0] = '\0'; 236 a->options = u->options;
241 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); 237 a->protocol = u->protocol;
242 gtk_clist_set_text(GTK_CLIST(list), i, 2, 238 txt = gtk_entry_get_text(GTK_ENTRY(u->pass));
243 (u->options & OPT_USR_AUTO) ? "True" : "False"); 239 if (a->options & OPT_USR_REM_PASS)
244 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); 240 g_snprintf(a->password, sizeof(a->password), "%s", txt);
245 241 else
246 tmp = u->opt_entries; 242 a->password[0] = '\0';
247 while (tmp) { 243
248 GtkEntry *entry = tmp->data; 244 i = gtk_clist_find_row_from_data(GTK_CLIST(list), a);
249 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); 245 gtk_clist_set_text(GTK_CLIST(list), i, 2,
250 g_snprintf(u->proto_opt[pos], sizeof(u->proto_opt[pos]), "%s", 246 (a->options & OPT_USR_AUTO) ? "True" : "False");
247 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(a->protocol));
248
249 tmp = u->opt_entries;
250 while (tmp) {
251 GtkEntry *entry = tmp->data;
252 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry));
253 g_snprintf(a->proto_opt[pos], sizeof(a->proto_opt[pos]), "%s",
251 gtk_entry_get_text(entry)); 254 gtk_entry_get_text(entry));
252 tmp = tmp->next; 255 tmp = tmp->next;
253 } 256 }
254 if (u->opt_entries) 257 if (u->opt_entries)
255 g_list_free(u->opt_entries); 258 g_list_free(u->opt_entries);
256 u->opt_entries = NULL; 259 u->opt_entries = NULL;
257 260
258 g_snprintf(u->iconfile, sizeof(u->iconfile), "%s", u->tmp_iconfile); 261 g_snprintf(a->iconfile, sizeof(a->iconfile), "%s", u->iconfile);
259 if (u->icondlg) 262 if (u->icondlg)
260 gtk_widget_destroy(u->icondlg); 263 gtk_widget_destroy(u->icondlg);
261 u->icondlg = NULL; 264 u->icondlg = NULL;
262 265
263 gtk_widget_destroy(u->mod); 266 gtk_widget_destroy(u->mod);
264 } else { 267
265 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name));
266 u = new_user(txt, tmpusr.protocol, tmpusr.options);
267
268 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.pass));
269 g_snprintf(u->password, sizeof(u->password), "%s", txt);
270
271 tmp = tmpusr.opt_entries;
272 while (tmp) {
273 GtkEntry *entry = tmp->data;
274 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry));
275 g_snprintf(u->proto_opt[pos], sizeof(u->proto_opt[pos]), "%s",
276 gtk_entry_get_text(entry));
277 tmp = tmp->next;
278 }
279 if (tmpusr.opt_entries)
280 g_list_free(tmpusr.opt_entries);
281 tmpusr.opt_entries = NULL;
282
283 g_snprintf(u->iconfile, sizeof(u->iconfile), "%s", tmpusr.tmp_iconfile);
284 if (tmpusr.icondlg)
285 gtk_widget_destroy(tmpusr.icondlg);
286 tmpusr.icondlg = NULL;
287
288 gtk_widget_destroy(newmod);
289 }
290 save_prefs(); 268 save_prefs();
291 } 269 }
292 270
293 static void cancel_mod(GtkWidget *w, struct aim_user *u) 271 static void cancel_mod(GtkWidget *w, struct mod_user *u)
294 { 272 {
295 if (u) { 273 if (u->opt_entries)
296 if (u->opt_entries) 274 g_list_free(u->opt_entries);
297 g_list_free(u->opt_entries); 275 u->opt_entries = NULL;
298 u->opt_entries = NULL; 276 if (u->icondlg)
299 gtk_widget_destroy(u->mod); 277 gtk_widget_destroy(u->icondlg);
300 if (u->icondlg) 278 u->icondlg = NULL;
301 gtk_widget_destroy(u->icondlg); 279 gtk_widget_destroy(u->mod);
302 u->icondlg = NULL;
303 } else {
304 if (tmpusr.opt_entries)
305 g_list_free(tmpusr.opt_entries);
306 tmpusr.opt_entries = NULL;
307 gtk_widget_destroy(newmod);
308 if (tmpusr.icondlg)
309 gtk_widget_destroy(tmpusr.icondlg);
310 tmpusr.icondlg = NULL;
311 }
312 } 280 }
313 281
314 static void set_prot(GtkWidget *opt, int proto) 282 static void set_prot(GtkWidget *opt, int proto)
315 { 283 {
316 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); 284 struct mod_user *u = gtk_object_get_user_data(GTK_OBJECT(opt));
317 struct prpl *p, *q; 285 struct prpl *p, *q;
318 q = find_prpl(proto); 286 q = find_prpl(proto);
319 if (u && (u->tmp_protocol != proto)) { 287 if (u->protocol != proto) {
320 int i; 288 int i;
321 for (i = 0; i < 7; i++) 289 for (i = 0; i < 7; i++)
322 u->proto_opt[i][0] = '\0'; 290 u->proto_opt[i][0] = '\0';
323 p = find_prpl(u->tmp_protocol); 291 p = find_prpl(u->protocol);
292
324 if (!(p->options & OPT_PROTO_NO_PASSWORD) && (q->options & OPT_PROTO_NO_PASSWORD)) { 293 if (!(p->options & OPT_PROTO_NO_PASSWORD) && (q->options & OPT_PROTO_NO_PASSWORD)) {
325 gtk_widget_hide(u->pwdbox); 294 gtk_widget_hide(u->pwdbox);
326 gtk_widget_hide(u->rempass); 295 gtk_widget_hide(u->rempass);
327 } else if ((p->options & OPT_PROTO_NO_PASSWORD) && !(q->options & OPT_PROTO_NO_PASSWORD)) { 296 } else if ((p->options & OPT_PROTO_NO_PASSWORD) && !(q->options & OPT_PROTO_NO_PASSWORD)) {
328 gtk_widget_show(u->pwdbox); 297 gtk_widget_show(u->pwdbox);
331 if (!(p->options & OPT_PROTO_MAIL_CHECK) && (q->options & OPT_PROTO_MAIL_CHECK)) { 300 if (!(p->options & OPT_PROTO_MAIL_CHECK) && (q->options & OPT_PROTO_MAIL_CHECK)) {
332 gtk_widget_show(u->checkmail); 301 gtk_widget_show(u->checkmail);
333 } else if ((p->options & OPT_PROTO_MAIL_CHECK) && !(q->options & OPT_PROTO_MAIL_CHECK)) { 302 } else if ((p->options & OPT_PROTO_MAIL_CHECK) && !(q->options & OPT_PROTO_MAIL_CHECK)) {
334 gtk_widget_hide(u->checkmail); 303 gtk_widget_hide(u->checkmail);
335 } 304 }
305
336 if (!(p->options & OPT_PROTO_BUDDY_ICON) && (q->options & OPT_PROTO_BUDDY_ICON)) { 306 if (!(p->options & OPT_PROTO_BUDDY_ICON) && (q->options & OPT_PROTO_BUDDY_ICON)) {
337 gtk_widget_show(u->iconsel); 307 gtk_widget_show(u->iconsel);
338 } else if ((p->options & OPT_PROTO_BUDDY_ICON) && !(q->options & OPT_PROTO_BUDDY_ICON)) { 308 } else if ((p->options & OPT_PROTO_BUDDY_ICON) && !(q->options & OPT_PROTO_BUDDY_ICON)) {
339 gtk_widget_hide(u->iconsel); 309 gtk_widget_hide(u->iconsel);
340 } 310 }
341 u->tmp_protocol = proto; 311
312 u->protocol = proto;
342 generate_prpl_options(u, u->main); 313 generate_prpl_options(u, u->main);
343 } else if (!u && (tmpusr.tmp_protocol != proto)) { 314 }
344 int i; 315 }
345 for (i = 0; i < 7; i++) 316
346 tmpusr.proto_opt[i][0] = '\0'; 317 static GtkWidget *make_protocol_menu(GtkWidget *box, struct mod_user *u)
347 p = find_prpl(tmpusr.tmp_protocol);
348 if (!(p->options & OPT_PROTO_NO_PASSWORD) && (q->options & OPT_PROTO_NO_PASSWORD)) {
349 gtk_widget_hide(tmpusr.pwdbox);
350 gtk_widget_hide(tmpusr.rempass);
351 } else if ((p->options & OPT_PROTO_NO_PASSWORD) && !(q->options & OPT_PROTO_NO_PASSWORD)) {
352 gtk_widget_show(tmpusr.pwdbox);
353 gtk_widget_show(tmpusr.rempass);
354 }
355 if (!(p->options & OPT_PROTO_MAIL_CHECK) && (q->options & OPT_PROTO_MAIL_CHECK)) {
356 gtk_widget_show(tmpusr.checkmail);
357 } else if ((p->options & OPT_PROTO_MAIL_CHECK) && !(q->options & OPT_PROTO_MAIL_CHECK)) {
358 gtk_widget_hide(tmpusr.checkmail);
359 }
360 if (!(p->options & OPT_PROTO_BUDDY_ICON) && (q->options & OPT_PROTO_BUDDY_ICON)) {
361 gtk_widget_show(tmpusr.iconsel);
362 } else if ((p->options & OPT_PROTO_BUDDY_ICON) && !(q->options & OPT_PROTO_BUDDY_ICON)) {
363 gtk_widget_hide(tmpusr.iconsel);
364 }
365 tmpusr.tmp_protocol = tmpusr.protocol = proto;
366 generate_prpl_options(NULL, newmain);
367 }
368 }
369
370 static GtkWidget *make_protocol_menu(GtkWidget *box, struct aim_user *u)
371 { 318 {
372 GtkWidget *optmenu; 319 GtkWidget *optmenu;
373 GtkWidget *menu; 320 GtkWidget *menu;
374 GtkWidget *opt; 321 GtkWidget *opt;
375 GSList *p = protocols; 322 GSList *p = protocols;
383 330
384 menu = gtk_menu_new(); 331 menu = gtk_menu_new();
385 332
386 while (p) { 333 while (p) {
387 e = (struct prpl *)p->data; 334 e = (struct prpl *)p->data;
388 if (u) { 335 if (e->protocol == u->protocol)
389 if (e->protocol == u->tmp_protocol) 336 found = TRUE;
390 found = TRUE; 337 if (!found)
391 if (!found) 338 count++;
392 count++;
393 } else {
394 if (e->protocol == tmpusr.tmp_protocol)
395 found = TRUE;
396 if (!found)
397 count++;
398 }
399 if (e->name) 339 if (e->name)
400 opt = gtk_menu_item_new_with_label((*e->name)()); 340 opt = gtk_menu_item_new_with_label((*e->name)());
401 else 341 else
402 opt = gtk_menu_item_new_with_label("Unknown"); 342 opt = gtk_menu_item_new_with_label("Unknown");
403 gtk_object_set_user_data(GTK_OBJECT(opt), u); 343 gtk_object_set_user_data(GTK_OBJECT(opt), u);
412 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), count); 352 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), count);
413 353
414 return optmenu; 354 return optmenu;
415 } 355 }
416 356
417 static void des_icon_sel(GtkWidget *w, struct aim_user *u) 357 static void des_icon_sel(GtkWidget *w, struct mod_user *u)
418 { 358 {
419 w = u->icondlg; 359 w = u->icondlg;
420 if (u->icondlg) 360 if (u->icondlg)
421 u->icondlg = NULL; 361 u->icondlg = NULL;
422 if (w) 362 if (w)
423 gtk_widget_destroy(w); 363 gtk_widget_destroy(w);
424 } 364 }
425 365
426 static void set_icon(GtkWidget *w, struct aim_user *u) 366 static void set_icon(GtkWidget *w, struct mod_user *u)
427 { 367 {
428 GtkWidget *sel = u ? u->icondlg : tmpusr.icondlg; 368 GtkWidget *sel = u->icondlg;
429 char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sel)); 369 char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sel));
430 370
431 if (file_is_dir(file, sel)) 371 if (file_is_dir(file, sel))
432 return; 372 return;
433 373
434 if (u) { 374 gtk_entry_set_text(GTK_ENTRY(u->iconentry), file);
435 gtk_entry_set_text(GTK_ENTRY(u->iconentry), file); 375 g_snprintf(u->iconfile, sizeof(u->iconfile), "%s", file);
436 g_snprintf(u->tmp_iconfile, sizeof(u->tmp_iconfile), "%s", file); 376 u->icondlg = NULL;
437 u->icondlg = NULL;
438 } else {
439 gtk_entry_set_text(GTK_ENTRY(tmpusr.iconentry), file);
440 g_snprintf(tmpusr.tmp_iconfile, sizeof(tmpusr.tmp_iconfile), "%s", file);
441 tmpusr.icondlg = NULL;
442 }
443 377
444 gtk_widget_destroy(sel); 378 gtk_widget_destroy(sel);
445 } 379 }
446 380
447 static void sel_icon_dlg(GtkWidget *w, struct aim_user *u) 381 static void sel_icon_dlg(GtkWidget *w, struct mod_user *u)
448 { 382 {
449 GtkWidget *dlg; 383 GtkWidget *dlg;
450 char buf[256]; 384 char buf[256];
451 385
452 if ((u && u->icondlg) || (!u && tmpusr.icondlg)) { 386 if (u->icondlg) {
453 if (u) 387 gtk_widget_show(u->icondlg);
454 gtk_widget_show(u->icondlg);
455 else
456 gtk_widget_show(tmpusr.icondlg);
457 return; 388 return;
458 } 389 }
459 390
460 dlg = gtk_file_selection_new(_("Gaim - Load Buddy Icon")); 391 dlg = gtk_file_selection_new(_("Gaim - Load Buddy Icon"));
461 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(dlg)); 392 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(dlg));
462 g_snprintf(buf, sizeof(buf), "%s/", g_get_home_dir()); 393 if (u->iconfile) {
463 gtk_file_selection_set_filename(GTK_FILE_SELECTION(dlg), buf); 394 char *tmp = g_dirname(u->iconfile);
395 gtk_file_selection_set_filename(GTK_FILE_SELECTION(dlg), tmp);
396 g_free(tmp);
397 } else {
398 g_snprintf(buf, sizeof(buf), "%s/", g_get_home_dir());
399 gtk_file_selection_set_filename(GTK_FILE_SELECTION(dlg), buf);
400 }
464 401
465 gtk_signal_connect(GTK_OBJECT(dlg), "destroy", GTK_SIGNAL_FUNC(des_icon_sel), u); 402 gtk_signal_connect(GTK_OBJECT(dlg), "destroy", GTK_SIGNAL_FUNC(des_icon_sel), u);
466 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(dlg)->cancel_button), "clicked", 403 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(dlg)->cancel_button), "clicked",
467 GTK_SIGNAL_FUNC(des_icon_sel), u); 404 GTK_SIGNAL_FUNC(des_icon_sel), u);
468 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(dlg)->ok_button), "clicked", 405 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(dlg)->ok_button), "clicked",
469 GTK_SIGNAL_FUNC(set_icon), u); 406 GTK_SIGNAL_FUNC(set_icon), u);
470 407
471 if (u) 408 u->icondlg = dlg;
472 u->icondlg = dlg;
473 else
474 tmpusr.icondlg = dlg;
475 409
476 gtk_widget_show(dlg); 410 gtk_widget_show(dlg);
477 } 411 }
478 412
479 static void reset_icon(GtkWidget *w, struct aim_user *u) 413 static void reset_icon(GtkWidget *w, struct mod_user *u)
480 { 414 {
481 if (u) { 415 u->iconfile[0] = 0;
482 u->tmp_iconfile[0] = 0; 416 gtk_entry_set_text(GTK_ENTRY(u->iconentry), "");
483 gtk_entry_set_text(GTK_ENTRY(u->iconentry), ""); 417 }
484 } else { 418
485 tmpusr.tmp_iconfile[0] = 0; 419 static GtkWidget *build_icon_selection(struct mod_user *u, GtkWidget *box)
486 gtk_entry_set_text(GTK_ENTRY(tmpusr.iconentry), "");
487 }
488 }
489
490 static GtkWidget *build_icon_selection(struct aim_user *u, GtkWidget *box)
491 { 420 {
492 GtkWidget *hbox; 421 GtkWidget *hbox;
493 GtkWidget *label; 422 GtkWidget *label;
494 GtkWidget *name; 423 GtkWidget *name;
495 GtkWidget *browse; 424 GtkWidget *browse;
496 GtkWidget *reset; 425 GtkWidget *reset;
497 426
498 if (u) 427 g_snprintf(u->iconfile, sizeof(u->iconfile), "%s", u->user->iconfile);
499 g_snprintf(u->tmp_iconfile, sizeof(u->tmp_iconfile), "%s", u->iconfile);
500 else
501 g_snprintf(tmpusr.tmp_iconfile, sizeof(tmpusr.tmp_iconfile), "%s", tmpusr.iconfile);
502 428
503 hbox = gtk_hbox_new(FALSE, 0); 429 hbox = gtk_hbox_new(FALSE, 0);
504 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); 430 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5);
505 gtk_widget_show(hbox); 431 gtk_widget_show(hbox);
506 432
507 label = gtk_label_new(_("Buddy Icon File:")); 433 label = gtk_label_new(_("Buddy Icon File:"));
508 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); 434 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
509 gtk_widget_show(label); 435 gtk_widget_show(label);
510 436
511 name = gtk_entry_new(); 437 name = gtk_entry_new();
512 if (u) 438 gtk_entry_set_text(GTK_ENTRY(name), u->iconfile);
513 gtk_entry_set_text(GTK_ENTRY(name), u->iconfile);
514 else
515 gtk_entry_set_text(GTK_ENTRY(name), tmpusr.iconfile);
516 gtk_entry_set_editable(GTK_ENTRY(name), FALSE); 439 gtk_entry_set_editable(GTK_ENTRY(name), FALSE);
517 gtk_box_pack_start(GTK_BOX(hbox), name, TRUE, TRUE, 5); 440 gtk_box_pack_start(GTK_BOX(hbox), name, TRUE, TRUE, 5);
518 gtk_widget_show(name); 441 gtk_widget_show(name);
519 if (u) 442 u->iconentry = name;
520 u->iconentry = name;
521 else
522 tmpusr.iconentry = name;
523 443
524 browse = gtk_button_new_with_label(_("Browse")); 444 browse = gtk_button_new_with_label(_("Browse"));
525 gtk_signal_connect(GTK_OBJECT(browse), "clicked", GTK_SIGNAL_FUNC(sel_icon_dlg), u); 445 gtk_signal_connect(GTK_OBJECT(browse), "clicked", GTK_SIGNAL_FUNC(sel_icon_dlg), u);
526 gtk_box_pack_start(GTK_BOX(hbox), browse, FALSE, FALSE, 0); 446 gtk_box_pack_start(GTK_BOX(hbox), browse, FALSE, FALSE, 0);
527 gtk_widget_show(browse); 447 gtk_widget_show(browse);
532 gtk_widget_show(reset); 452 gtk_widget_show(reset);
533 453
534 return hbox; 454 return hbox;
535 } 455 }
536 456
537 static void generate_general_options(struct aim_user *u, GtkWidget *book) 457 static void generate_general_options(struct mod_user *u, GtkWidget *book)
538 { 458 {
539 GtkWidget *vbox; 459 GtkWidget *vbox;
540 GtkWidget *hbox; 460 GtkWidget *hbox;
541 GtkWidget *pwdbox; 461 GtkWidget *pwdbox;
542 GtkWidget *label; 462 GtkWidget *label;
585 505
586 iconsel = build_icon_selection(u, vbox); 506 iconsel = build_icon_selection(u, vbox);
587 507
588 gtk_widget_show_all(vbox); 508 gtk_widget_show_all(vbox);
589 509
590 if (u) { 510 u->name = name;
591 u->name = name; 511 u->pwdbox = pwdbox;
592 u->pwdbox = pwdbox; 512 u->pass = pass;
593 u->pass = pass; 513 u->rempass = rempass;
594 u->rempass = rempass; 514 u->checkmail = checkmail;
595 u->checkmail = checkmail; 515 u->iconsel = iconsel;
596 u->iconsel = iconsel; 516 gtk_entry_set_text(GTK_ENTRY(name), u->user->username);
597 gtk_entry_set_text(GTK_ENTRY(name), u->username); 517 gtk_entry_set_text(GTK_ENTRY(pass), u->user->password);
598 gtk_entry_set_text(GTK_ENTRY(pass), u->password); 518 gtk_entry_set_editable(GTK_ENTRY(name), FALSE);
599 gtk_entry_set_editable(GTK_ENTRY(name), FALSE); 519 }
600 } else { 520
601 tmpusr.name = name; 521 static void generate_prpl_options(struct mod_user *u, GtkWidget *book)
602 tmpusr.pwdbox = pwdbox; 522 {
603 tmpusr.pass = pass; 523 struct prpl *p = find_prpl(u->protocol);
604 tmpusr.rempass = rempass; 524
605 tmpusr.checkmail = checkmail; 525 GList *op, *tmp;
606 tmpusr.iconsel = iconsel; 526
607 } 527 GtkWidget *vbox;
608 } 528 GtkWidget *hbox;
609 529 GtkWidget *label;
610 static void generate_prpl_options(struct aim_user *u, GtkWidget *book) 530 GtkWidget *entry;
611 { 531
612 struct prpl *p; 532 char buf[256];
613
614 if (u)
615 p = find_prpl(u->tmp_protocol);
616 else
617 p = find_prpl(tmpusr.protocol);
618 533
619 /* page 0 is general, keep it. page 1 is options for our 534 /* page 0 is general, keep it. page 1 is options for our
620 * particular protocol, so clear it out and make a new one. */ 535 * particular protocol, so clear it out and make a new one. */
621 536
622 gtk_notebook_remove_page(GTK_NOTEBOOK(book), 1); 537 gtk_notebook_remove_page(GTK_NOTEBOOK(book), 1);
623 538
624 if (!p) 539 if (!p)
625 return; 540 return;
626 541
627 if (u && u->opt_entries) { 542 if (u->opt_entries) {
628 g_list_free(u->opt_entries); 543 g_list_free(u->opt_entries);
629 u->opt_entries = NULL; 544 u->opt_entries = NULL;
630 } else if (!u && tmpusr.opt_entries) { 545 }
631 g_list_free(tmpusr.opt_entries); 546
632 tmpusr.opt_entries = NULL; 547 if (!p->user_opts)
633 } 548 return;
634 549
635 if (p->user_opts) { 550 tmp = op = (*p->user_opts)();
636 GList *op = (*p->user_opts)(); 551
637 GList *tmp = op; 552 vbox = gtk_vbox_new(FALSE, 5);
638 553 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
639 GtkWidget *vbox; 554 g_snprintf(buf, sizeof(buf), "%s Options", (*p->name)());
640 GtkWidget *hbox; 555 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new(buf));
641 GtkWidget *label; 556 gtk_widget_show(vbox);
642 GtkWidget *entry; 557
643 558 while (op) {
644 char buf[256]; 559 struct proto_user_opt *puo = op->data;
645 560
646 vbox = gtk_vbox_new(FALSE, 5); 561 hbox = gtk_hbox_new(FALSE, 5);
647 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); 562 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
648 g_snprintf(buf, sizeof(buf), "%s Options", (*p->name)()); 563 gtk_widget_show(hbox);
649 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new(buf)); 564
650 gtk_widget_show(vbox); 565 label = gtk_label_new(puo->label);
651 566 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
652 while (op) { 567 gtk_widget_show(label);
653 struct proto_user_opt *puo = op->data; 568
654 569 entry = gtk_entry_new();
655 hbox = gtk_hbox_new(FALSE, 5); 570 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
656 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); 571 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)puo->pos);
657 gtk_widget_show(hbox); 572 if (u->proto_opt[puo->pos][0]) {
658 573 debug_printf("setting text %s\n", u->proto_opt[puo->pos]);
659 label = gtk_label_new(puo->label); 574 gtk_entry_set_text(GTK_ENTRY(entry), u->proto_opt[puo->pos]);
660 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); 575 } else {
661 gtk_widget_show(label); 576 gtk_entry_set_text(GTK_ENTRY(entry), puo->def);
662
663 entry = gtk_entry_new();
664 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
665 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)puo->pos);
666 if (u && u->proto_opt[puo->pos][0]) {
667 debug_printf("setting text %s\n", u->proto_opt[puo->pos]);
668 gtk_entry_set_text(GTK_ENTRY(entry), u->proto_opt[puo->pos]);
669 } else {
670 gtk_entry_set_text(GTK_ENTRY(entry), puo->def);
671 }
672 gtk_widget_show(entry);
673
674 if (u)
675 u->opt_entries = g_list_append(u->opt_entries, entry);
676 else
677 tmpusr.opt_entries = g_list_append(tmpusr.opt_entries, entry);
678
679 g_free(puo);
680 op = op->next;
681 } 577 }
682 g_list_free(tmp); 578 gtk_widget_show(entry);
683 } 579
684 } 580 u->opt_entries = g_list_append(u->opt_entries, entry);
685 581
686 static void show_acct_mod(struct aim_user *u) 582 g_free(puo);
583 op = op->next;
584 }
585 g_list_free(tmp);
586 }
587
588 static void show_acct_mod(struct aim_user *a)
687 { 589 {
688 /* here we can have all the aim_user options, including ones not shown in the main acctedit 590 /* here we can have all the aim_user options, including ones not shown in the main acctedit
689 * window. this can keep the size of the acctedit window small and readable, and make this 591 * window. this can keep the size of the acctedit window small and readable, and make this
690 * one the powerful editor. this is where things like name/password are edited, but can 592 * one the powerful editor. this is where things like name/password are edited, but can
691 * also have toggles (and even more complex options) like whether to autologin or whether 593 * also have toggles (and even more complex options) like whether to autologin or whether
697 GtkWidget *hbox; 599 GtkWidget *hbox;
698 GtkWidget *button; 600 GtkWidget *button;
699 601
700 struct prpl *p; 602 struct prpl *p;
701 603
702 if (!u && newmod) { 604 struct mod_user *u = find_mod_user(a);
703 gtk_widget_show(newmod); 605
704 return; 606 if (!u) {
705 } 607 u = g_new0(struct mod_user, 1);
706 if (u && u->mod) { 608 u->user = a;
609 mod_users = g_slist_append(mod_users, u);
610
611 if (a) {
612 u->options = a->options;
613 if (find_prpl(a->protocol))
614 u->protocol = a->protocol;
615 else if (protocols)
616 u->protocol = ((struct prpl *)protocols->data)->protocol;
617 else
618 u->protocol = -1;
619 g_snprintf(u->iconfile, sizeof(u->iconfile), "%s", a->iconfile);
620 } else {
621 u->options = OPT_USR_REM_PASS;
622 if (find_prpl(DEFAULT_PROTO))
623 u->protocol = DEFAULT_PROTO;
624 else if (protocols)
625 u->protocol = ((struct prpl *)protocols->data)->protocol;
626 else
627 u->protocol = -1;
628 }
629 } else {
707 gtk_widget_show(u->mod); 630 gtk_widget_show(u->mod);
708 return; 631 return;
709 } 632 }
710 633
711 mod = gtk_window_new(GTK_WINDOW_TOPLEVEL); 634 mod = gtk_window_new(GTK_WINDOW_TOPLEVEL);
723 646
724 book = gtk_notebook_new(); 647 book = gtk_notebook_new();
725 gtk_box_pack_start(GTK_BOX(box), book, FALSE, FALSE, 0); 648 gtk_box_pack_start(GTK_BOX(box), book, FALSE, FALSE, 0);
726 gtk_widget_show(book); 649 gtk_widget_show(book);
727 650
728 if (u) {
729 if (find_prpl(u->protocol))
730 u->tmp_protocol = u->protocol;
731 else if (protocols)
732 u->tmp_protocol = ((struct prpl *)protocols->data)->protocol;
733 else
734 u->tmp_protocol = -1;
735 } else {
736 if (find_prpl(tmpusr.protocol))
737 tmpusr.tmp_protocol = tmpusr.protocol;
738 else if (protocols)
739 tmpusr.tmp_protocol = ((struct prpl *)protocols->data)->protocol;
740 else
741 tmpusr.tmp_protocol = -1;
742 }
743 generate_general_options(u, book); 651 generate_general_options(u, book);
744 generate_prpl_options(u, book); 652 generate_prpl_options(u, book);
745 653
746 hbox = gtk_hbox_new(FALSE, 5); 654 hbox = gtk_hbox_new(FALSE, 5);
747 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); 655 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
755 button = picture_button(mod, _("OK"), ok_xpm); 663 button = picture_button(mod, _("OK"), ok_xpm);
756 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); 664 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
757 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u); 665 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u);
758 gtk_widget_show(button); 666 gtk_widget_show(button);
759 667
760 if (u) { 668 u->mod = mod;
761 u->mod = mod; 669 u->main = book; /* sorry, i think i broke the joke :) */
762 u->main = book; /* sorry, i think i broke the joke :) */ 670
763 u->tmp_options = u->options; 671 p = find_prpl(u->protocol);
764 } else { 672 if (p && (p->options & OPT_PROTO_NO_PASSWORD)) {
765 newmod = mod; 673 gtk_widget_hide(u->pwdbox);
766 newmain = book; 674 gtk_widget_hide(u->rempass);
767 } 675 }
768 676 if (p && (!(p->options & OPT_PROTO_MAIL_CHECK)))
769 if (u) { 677 gtk_widget_hide(u->checkmail);
770 p = find_prpl(u->tmp_protocol); 678 if (p && (!(p->options & OPT_PROTO_BUDDY_ICON)))
771 if (p && (p->options & OPT_PROTO_NO_PASSWORD)) { 679 gtk_widget_hide(u->iconsel);
772 gtk_widget_hide(u->pwdbox);
773 gtk_widget_hide(u->rempass);
774 }
775 if (p && (!(p->options & OPT_PROTO_MAIL_CHECK)))
776 gtk_widget_hide(u->checkmail);
777 if (p && (!(p->options & OPT_PROTO_BUDDY_ICON)))
778 gtk_widget_hide(u->iconsel);
779 } else {
780 p = find_prpl(tmpusr.tmp_protocol);
781 if (p && (p->options & OPT_PROTO_NO_PASSWORD)) {
782 gtk_widget_hide(tmpusr.pwdbox);
783 gtk_widget_hide(tmpusr.rempass);
784 }
785 if (p && (!(p->options & OPT_PROTO_MAIL_CHECK)))
786 gtk_widget_hide(tmpusr.checkmail);
787 if (p && (!(p->options & OPT_PROTO_BUDDY_ICON)))
788 gtk_widget_hide(tmpusr.iconsel);
789 }
790 680
791 gtk_widget_show(mod); 681 gtk_widget_show(mod);
792 } 682 }
793 683
794 static void add_acct(GtkWidget *w, gpointer d) 684 static void add_acct(GtkWidget *w, gpointer d)
810 } 700 }
811 l = l->next; 701 l = l->next;
812 } 702 }
813 } 703 }
814 704
815 static void pass_des(GtkWidget *w, struct aim_user *u) 705 struct pass_prompt {
816 { 706 struct aim_user *u;
817 gtk_widget_destroy(w); 707 GtkWidget *win;
818 u->passprmt = NULL; 708 GtkWidget *entry;
819 } 709 };
820 710 static GSList *passes = NULL;
821 static void pass_cancel(GtkWidget *w, struct aim_user *u) 711
822 { 712 static struct pass_prompt *find_pass_prompt(struct aim_user *u)
823 gtk_widget_destroy(u->passprmt); 713 {
824 u->passprmt = NULL; 714 GSList *p = passes;
825 } 715 while (p) {
826 716 struct pass_prompt *r = p->data;
827 static void pass_signon(GtkWidget *w, struct aim_user *u) 717 if (r->u == u)
828 { 718 return r;
829 const char *txt = gtk_entry_get_text(GTK_ENTRY(u->passentry)); 719 p = p->next;
830 g_snprintf(u->password, sizeof(u->password), "%s", txt); 720 }
721 return NULL;
722 }
723
724 static void pass_des(GtkWidget *w, struct pass_prompt *p)
725 {
726 passes = g_slist_remove(passes, p);
727 g_free(p);
728 }
729
730 static void pass_cancel(GtkWidget *w, struct pass_prompt *p)
731 {
732 gtk_widget_destroy(p->win);
733 }
734
735 static void pass_signon(GtkWidget *w, struct pass_prompt *p)
736 {
737 const char *txt = gtk_entry_get_text(GTK_ENTRY(p->entry));
738 g_snprintf(p->u->password, sizeof(p->u->password), "%s", txt);
831 #ifdef USE_APPLET 739 #ifdef USE_APPLET
832 set_user_state(signing_on); 740 set_user_state(signing_on);
833 #endif 741 #endif
834 gtk_widget_destroy(u->passprmt); 742 serv_login(p->u);
835 u->passprmt = NULL; 743 gtk_widget_destroy(p->win);
836 serv_login(u);
837 } 744 }
838 745
839 static void do_pass_dlg(struct aim_user *u) 746 static void do_pass_dlg(struct aim_user *u)
840 { 747 {
841 /* we can safely assume that u is not NULL */ 748 /* we can safely assume that u is not NULL */
843 GtkWidget *vbox; 750 GtkWidget *vbox;
844 GtkWidget *hbox; 751 GtkWidget *hbox;
845 char buf[96]; 752 char buf[96];
846 GtkWidget *label; 753 GtkWidget *label;
847 GtkWidget *button; 754 GtkWidget *button;
848 755 struct pass_prompt *p = find_pass_prompt(u);
849 if (u->passprmt) { 756
850 gtk_widget_show(u->passprmt); 757 if (p) {
758 gtk_widget_show(p->win);
851 return; 759 return;
852 } 760 }
853 u->passprmt = gtk_window_new(GTK_WINDOW_DIALOG); 761
854 gtk_window_set_wmclass(GTK_WINDOW(u->passprmt), "password", "Gaim"); 762 p = g_new0(struct pass_prompt, 1);
855 gtk_container_border_width(GTK_CONTAINER(u->passprmt), 5); 763 p->u = u;
856 gtk_signal_connect(GTK_OBJECT(u->passprmt), "destroy", GTK_SIGNAL_FUNC(pass_des), u); 764 passes = g_slist_append(passes, p);
857 gtk_widget_realize(u->passprmt); 765
858 aol_icon(u->passprmt->window); 766 p->win = gtk_window_new(GTK_WINDOW_DIALOG);
767 gtk_window_set_wmclass(GTK_WINDOW(p->win), "password", "Gaim");
768 gtk_container_border_width(GTK_CONTAINER(p->win), 5);
769 gtk_signal_connect(GTK_OBJECT(p->win), "destroy", GTK_SIGNAL_FUNC(pass_des), p);
770 gtk_widget_realize(p->win);
771 aol_icon(p->win->window);
859 772
860 frame = gtk_frame_new(_("Enter Password")); 773 frame = gtk_frame_new(_("Enter Password"));
861 gtk_container_add(GTK_CONTAINER(u->passprmt), frame); 774 gtk_container_add(GTK_CONTAINER(p->win), frame);
862 gtk_widget_show(frame); 775 gtk_widget_show(frame);
863 776
864 vbox = gtk_vbox_new(FALSE, 5); 777 vbox = gtk_vbox_new(FALSE, 5);
865 gtk_container_add(GTK_CONTAINER(frame), vbox); 778 gtk_container_add(GTK_CONTAINER(frame), vbox);
866 gtk_widget_show(vbox); 779 gtk_widget_show(vbox);
872 g_snprintf(buf, sizeof(buf), "Password for %s:", u->username); 785 g_snprintf(buf, sizeof(buf), "Password for %s:", u->username);
873 label = gtk_label_new(buf); 786 label = gtk_label_new(buf);
874 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); 787 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
875 gtk_widget_show(label); 788 gtk_widget_show(label);
876 789
877 u->passentry = gtk_entry_new(); 790 p->entry = gtk_entry_new();
878 gtk_entry_set_visibility(GTK_ENTRY(u->passentry), FALSE); 791 gtk_entry_set_visibility(GTK_ENTRY(p->entry), FALSE);
879 gtk_box_pack_start(GTK_BOX(hbox), u->passentry, FALSE, FALSE, 5); 792 gtk_box_pack_start(GTK_BOX(hbox), p->entry, FALSE, FALSE, 5);
880 gtk_signal_connect(GTK_OBJECT(u->passentry), "activate", GTK_SIGNAL_FUNC(pass_signon), u); 793 gtk_signal_connect(GTK_OBJECT(p->entry), "activate", GTK_SIGNAL_FUNC(pass_signon), p);
881 gtk_widget_grab_focus(u->passentry); 794 gtk_widget_grab_focus(p->entry);
882 gtk_widget_show(u->passentry); 795 gtk_widget_show(p->entry);
883 796
884 hbox = gtk_hbox_new(FALSE, 5); 797 hbox = gtk_hbox_new(FALSE, 5);
885 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); 798 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
886 gtk_widget_show(hbox); 799 gtk_widget_show(hbox);
887 800
888 button = picture_button(u->passprmt, _("Cancel"), cancel_xpm); 801 button = picture_button(p->win, _("Cancel"), cancel_xpm);
889 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pass_cancel), u); 802 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pass_cancel), p);
890 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); 803 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5);
891 804
892 button = picture_button(u->passprmt, _("Signon"), ok_xpm); 805 button = picture_button(p->win, _("Signon"), ok_xpm);
893 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pass_signon), u); 806 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pass_signon), p);
894 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); 807 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5);
895 808
896 gtk_widget_show(u->passprmt); 809 gtk_widget_show(p->win);
897 } 810 }
898 811
899 static void acct_signin(GtkWidget *w, gpointer d) 812 static void acct_signin(GtkWidget *w, gpointer d)
900 { 813 {
901 GList *l = GTK_CLIST(list)->selection; 814 GList *l = GTK_CLIST(list)->selection;
1230 gtk_progress_bar_update(GTK_PROGRESS_BAR(meter->progress), howfar / LOGIN_STEPS); 1143 gtk_progress_bar_update(GTK_PROGRESS_BAR(meter->progress), howfar / LOGIN_STEPS);
1231 gtk_statusbar_pop(GTK_STATUSBAR(meter->status), 1); 1144 gtk_statusbar_pop(GTK_STATUSBAR(meter->status), 1);
1232 gtk_statusbar_push(GTK_STATUSBAR(meter->status), 1, message); 1145 gtk_statusbar_push(GTK_STATUSBAR(meter->status), 1, message);
1233 } 1146 }
1234 1147
1235 static void set_kick_null(GtkObject *obj, struct aim_user *u) 1148 struct kick_dlg {
1236 { 1149 struct aim_user *user;
1237 u->kick_dlg = NULL; 1150 GtkWidget *dlg;
1151 };
1152 static GSList *kicks = NULL;
1153
1154 static struct kick_dlg *find_kick_dlg(struct aim_user *u)
1155 {
1156 GSList *k = kicks;
1157 while (k) {
1158 struct kick_dlg *d = k->data;
1159 if (d->user == u)
1160 return d;
1161 k = k->next;
1162 }
1163 return NULL;
1164 }
1165
1166 static void set_kick_null(GtkObject *obj, struct kick_dlg *k)
1167 {
1168 kicks = g_slist_remove(kicks, k);
1169 g_free(k);
1238 } 1170 }
1239 1171
1240 void hide_login_progress(struct gaim_connection *gc, char *why) 1172 void hide_login_progress(struct gaim_connection *gc, char *why)
1241 { 1173 {
1242 char buf[2048]; 1174 char buf[2048];
1175 struct kick_dlg *k = find_kick_dlg(gc->user);
1243 struct signon_meter *meter = find_signon_meter(gc); 1176 struct signon_meter *meter = find_signon_meter(gc);
1244 sprintf(buf, _("%s\n%s was unable to sign on: %s"), full_date(), gc->username, why); 1177 sprintf(buf, _("%s\n%s was unable to sign on: %s"), full_date(), gc->username, why);
1245 if (gc->user->kick_dlg) 1178 if (k)
1246 gtk_widget_destroy(gc->user->kick_dlg); 1179 gtk_widget_destroy(k->dlg);
1247 gc->user->kick_dlg = do_error_dialog(buf, _("Signon Error")); 1180 k = g_new0(struct kick_dlg, 1);
1248 gtk_signal_connect(GTK_OBJECT(gc->user->kick_dlg), "destroy", 1181 k->user = gc->user;
1249 GTK_SIGNAL_FUNC(set_kick_null), gc->user); 1182 k->dlg = do_error_dialog(buf, _("Signon Error"));
1183 gtk_signal_connect(GTK_OBJECT(k->dlg), "destroy", GTK_SIGNAL_FUNC(set_kick_null), k);
1250 if (meter) { 1184 if (meter) {
1251 gtk_widget_destroy(meter->window); 1185 gtk_widget_destroy(meter->window);
1252 meters = g_slist_remove(meters, meter); 1186 meters = g_slist_remove(meters, meter);
1253 g_free(meter); 1187 g_free(meter);
1254 } 1188 }