comparison src/multi.c @ 2372:2927c2c26fe6

[gaim-migrate @ 2385] reformatting. nothing else. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 27 Sep 2001 19:17:11 +0000
parents 94314b9dbda4
children 6f83c22d9e70
comparison
equal deleted inserted replaced
2371:db02399a9ad7 2372:2927c2c26fe6
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 static GtkWidget *newmod = NULL; /* the dialog for creating a new account */
48 static GtkWidget *newmain = NULL; /* the notebook that holds options */ 48 static GtkWidget *newmain = NULL; /* the notebook that holds options */
49 static struct aim_user tmpusr = { "", "", "", OPT_USR_REM_PASS, DEFAULT_PROTO, 49 static struct aim_user tmpusr = { "", "", "", OPT_USR_REM_PASS, DEFAULT_PROTO,
50 { "", "", "", "", "", "", "" }, "", NULL, NULL, NULL, NULL, NULL, 50 {"", "", "", "", "", "", ""}, "", NULL, NULL, NULL, NULL, NULL,
51 NULL, NULL, OPT_USR_REM_PASS, DEFAULT_PROTO, NULL, NULL, NULL }; 51 NULL, NULL, OPT_USR_REM_PASS, DEFAULT_PROTO, NULL, NULL, NULL
52 };
52 53
53 static void generate_prpl_options(struct aim_user *, GtkWidget *); 54 static void generate_prpl_options(struct aim_user *, GtkWidget *);
54 55
55 struct mod_usr_opt { 56 struct mod_usr_opt {
56 struct aim_user *user; 57 struct aim_user *user;
265 tmp = u->opt_entries; 266 tmp = u->opt_entries;
266 while (tmp) { 267 while (tmp) {
267 GtkEntry *entry = tmp->data; 268 GtkEntry *entry = tmp->data;
268 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); 269 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry));
269 g_snprintf(u->proto_opt[pos], sizeof(u->proto_opt[pos]), "%s", 270 g_snprintf(u->proto_opt[pos], sizeof(u->proto_opt[pos]), "%s",
270 gtk_entry_get_text(entry)); 271 gtk_entry_get_text(entry));
271 tmp = tmp->next; 272 tmp = tmp->next;
272 } 273 }
273 if (u->opt_entries) 274 if (u->opt_entries)
274 g_list_free(u->opt_entries); 275 g_list_free(u->opt_entries);
275 u->opt_entries = NULL; 276 u->opt_entries = NULL;
285 tmp = tmpusr.opt_entries; 286 tmp = tmpusr.opt_entries;
286 while (tmp) { 287 while (tmp) {
287 GtkEntry *entry = tmp->data; 288 GtkEntry *entry = tmp->data;
288 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); 289 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry));
289 g_snprintf(u->proto_opt[pos], sizeof(u->proto_opt[pos]), "%s", 290 g_snprintf(u->proto_opt[pos], sizeof(u->proto_opt[pos]), "%s",
290 gtk_entry_get_text(entry)); 291 gtk_entry_get_text(entry));
291 tmp = tmp->next; 292 tmp = tmp->next;
292 } 293 }
293 if (tmpusr.opt_entries) 294 if (tmpusr.opt_entries)
294 g_list_free(tmpusr.opt_entries); 295 g_list_free(tmpusr.opt_entries);
295 tmpusr.opt_entries = NULL; 296 tmpusr.opt_entries = NULL;
322 if (u && (u->tmp_protocol != proto)) { 323 if (u && (u->tmp_protocol != proto)) {
323 int i; 324 int i;
324 for (i = 0; i < 7; i++) 325 for (i = 0; i < 7; i++)
325 u->proto_opt[i][0] = '\0'; 326 u->proto_opt[i][0] = '\0';
326 p = find_prpl(u->tmp_protocol); 327 p = find_prpl(u->tmp_protocol);
327 if (!(p->options & OPT_PROTO_NO_PASSWORD) && 328 if (!(p->options & OPT_PROTO_NO_PASSWORD) && (q->options & OPT_PROTO_NO_PASSWORD)) {
328 (q->options & OPT_PROTO_NO_PASSWORD)) {
329 gtk_widget_hide(u->pwdbox); 329 gtk_widget_hide(u->pwdbox);
330 gtk_widget_hide(u->rempass); 330 gtk_widget_hide(u->rempass);
331 } else if ((p->options & OPT_PROTO_NO_PASSWORD) && 331 } else if ((p->options & OPT_PROTO_NO_PASSWORD) && !(q->options & OPT_PROTO_NO_PASSWORD)) {
332 !(q->options & OPT_PROTO_NO_PASSWORD)) {
333 gtk_widget_show(u->pwdbox); 332 gtk_widget_show(u->pwdbox);
334 gtk_widget_show(u->rempass); 333 gtk_widget_show(u->rempass);
335 } 334 }
336 if (!(p->options & OPT_PROTO_MAIL_CHECK) && 335 if (!(p->options & OPT_PROTO_MAIL_CHECK) && (q->options & OPT_PROTO_MAIL_CHECK)) {
337 (q->options & OPT_PROTO_MAIL_CHECK)) {
338 gtk_widget_show(u->checkmail); 336 gtk_widget_show(u->checkmail);
339 } else if ((p->options & OPT_PROTO_MAIL_CHECK) && 337 } else if ((p->options & OPT_PROTO_MAIL_CHECK) && !(q->options & OPT_PROTO_MAIL_CHECK)) {
340 !(q->options & OPT_PROTO_MAIL_CHECK)) {
341 gtk_widget_hide(u->checkmail); 338 gtk_widget_hide(u->checkmail);
342 } 339 }
343 u->tmp_protocol = proto; 340 u->tmp_protocol = proto;
344 generate_prpl_options(u, u->main); 341 generate_prpl_options(u, u->main);
345 } else if (!u && (tmpusr.tmp_protocol != proto)) { 342 } else if (!u && (tmpusr.tmp_protocol != proto)) {
346 int i; 343 int i;
347 for (i = 0; i < 7; i++) 344 for (i = 0; i < 7; i++)
348 tmpusr.proto_opt[i][0] = '\0'; 345 tmpusr.proto_opt[i][0] = '\0';
349 p = find_prpl(tmpusr.tmp_protocol); 346 p = find_prpl(tmpusr.tmp_protocol);
350 if (!(p->options & OPT_PROTO_NO_PASSWORD) && 347 if (!(p->options & OPT_PROTO_NO_PASSWORD) && (q->options & OPT_PROTO_NO_PASSWORD)) {
351 (q->options & OPT_PROTO_NO_PASSWORD)) {
352 gtk_widget_hide(tmpusr.pwdbox); 348 gtk_widget_hide(tmpusr.pwdbox);
353 gtk_widget_hide(tmpusr.rempass); 349 gtk_widget_hide(tmpusr.rempass);
354 } else if ((p->options & OPT_PROTO_NO_PASSWORD) && 350 } else if ((p->options & OPT_PROTO_NO_PASSWORD) && !(q->options & OPT_PROTO_NO_PASSWORD)) {
355 !(q->options & OPT_PROTO_NO_PASSWORD)) {
356 gtk_widget_show(tmpusr.pwdbox); 351 gtk_widget_show(tmpusr.pwdbox);
357 gtk_widget_show(tmpusr.rempass); 352 gtk_widget_show(tmpusr.rempass);
358 } 353 }
359 if (!(p->options & OPT_PROTO_MAIL_CHECK) && 354 if (!(p->options & OPT_PROTO_MAIL_CHECK) && (q->options & OPT_PROTO_MAIL_CHECK)) {
360 (q->options & OPT_PROTO_MAIL_CHECK)) {
361 gtk_widget_show(tmpusr.checkmail); 355 gtk_widget_show(tmpusr.checkmail);
362 } else if ((p->options & OPT_PROTO_MAIL_CHECK) && 356 } else if ((p->options & OPT_PROTO_MAIL_CHECK) && !(q->options & OPT_PROTO_MAIL_CHECK)) {
363 !(q->options & OPT_PROTO_MAIL_CHECK)) {
364 gtk_widget_hide(tmpusr.checkmail); 357 gtk_widget_hide(tmpusr.checkmail);
365 } 358 }
366 tmpusr.tmp_protocol = tmpusr.protocol = proto; 359 tmpusr.tmp_protocol = tmpusr.protocol = proto;
367 generate_prpl_options(NULL, newmain); 360 generate_prpl_options(NULL, newmain);
368 } 361 }
458 451
459 make_protocol_menu(hbox, u); 452 make_protocol_menu(hbox, u);
460 453
461 rempass = acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox); 454 rempass = acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox);
462 acct_button(_("Auto-Login"), u, OPT_USR_AUTO, vbox); 455 acct_button(_("Auto-Login"), u, OPT_USR_AUTO, vbox);
463 /*acct_button(_("Send KeepAlive packet (6 bytes/second)"), u, OPT_USR_KEEPALV, vbox);*/ 456 /*acct_button(_("Send KeepAlive packet (6 bytes/second)"), u, OPT_USR_KEEPALV, vbox); */
464 checkmail = acct_button(_("New Mail Notifications"), u, OPT_USR_MAIL_CHECK, vbox); 457 checkmail = acct_button(_("New Mail Notifications"), u, OPT_USR_MAIL_CHECK, vbox);
465 458
466 gtk_widget_show_all(vbox); 459 gtk_widget_show_all(vbox);
467 460
468 if (u) { 461 if (u) {
636 newmod = mod; 629 newmod = mod;
637 newmain = book; 630 newmain = book;
638 } 631 }
639 632
640 gtk_widget_show_all(mod); 633 gtk_widget_show_all(mod);
641 634
642 if (u) { 635 if (u) {
643 p = find_prpl(u->tmp_protocol); 636 p = find_prpl(u->tmp_protocol);
644 if (p && (p->options & OPT_PROTO_NO_PASSWORD)) { 637 if (p && (p->options & OPT_PROTO_NO_PASSWORD)) {
645 gtk_widget_hide(u->pwdbox); 638 gtk_widget_hide(u->pwdbox);
646 gtk_widget_hide(u->rempass); 639 gtk_widget_hide(u->rempass);
821 814
822 static void sel_auto(gpointer w, gpointer d) 815 static void sel_auto(gpointer w, gpointer d)
823 { 816 {
824 GList *l = aim_users; 817 GList *l = aim_users;
825 struct aim_user *u; 818 struct aim_user *u;
826 int i = 0; /* faster than doing g_list_index each time */ 819 int i = 0; /* faster than doing g_list_index each time */
827 while (l) { 820 while (l) {
828 u = l->data; 821 u = l->data;
829 l = l->next; 822 l = l->next;
830 if (u->options & OPT_USR_AUTO) 823 if (u->options & OPT_USR_AUTO)
831 gtk_clist_select_row(GTK_CLIST(list), i, -1); 824 gtk_clist_select_row(GTK_CLIST(list), i, -1);
960 opt_away = 0; 953 opt_away = 0;
961 } else if (awaymessage) { 954 } else if (awaymessage) {
962 serv_set_away(gc, GAIM_AWAY_CUSTOM, awaymessage->message); 955 serv_set_away(gc, GAIM_AWAY_CUSTOM, awaymessage->message);
963 } 956 }
964 if (opt_away_arg != NULL) { 957 if (opt_away_arg != NULL) {
965 g_free (opt_away_arg); 958 g_free(opt_away_arg);
966 opt_away_arg = NULL; 959 opt_away_arg = NULL;
967 } 960 }
968 961
969 /* everything for the account editor */ 962 /* everything for the account editor */
970 if (!acctedit) 963 if (!acctedit)