Mercurial > pidgin
comparison src/multi.c @ 1030:38452403563b
[gaim-migrate @ 1040]
updating the buddy list to work better with multiple connections. there are still a bunch of things fucked up with this but i wanted more people to start working on it than just me, especially since i won't be here this weekend.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 27 Oct 2000 07:53:32 +0000 |
parents | d496fe2614a6 |
children | 713b0e14e0a9 |
comparison
equal
deleted
inserted
replaced
1029:740c6f933fe0 | 1030:38452403563b |
---|---|
54 g_snprintf(gc->username, sizeof(gc->username), "%s", username); | 54 g_snprintf(gc->username, sizeof(gc->username), "%s", username); |
55 g_snprintf(gc->password, sizeof(gc->password), "%s", password); | 55 g_snprintf(gc->password, sizeof(gc->password), "%s", password); |
56 gc->keepalive = -1; | 56 gc->keepalive = -1; |
57 gc->inpa = -1; | 57 gc->inpa = -1; |
58 gc->buddy_chats = NULL; | 58 gc->buddy_chats = NULL; |
59 gc->groups = NULL; | |
60 gc->permit = NULL; | |
61 gc->deny = NULL; | |
59 | 62 |
60 connections = g_slist_append(connections, gc); | 63 connections = g_slist_append(connections, gc); |
61 | 64 |
62 return gc; | 65 return gc; |
63 } | 66 } |
204 gtk_clist_set_text(GTK_CLIST(list), i, 2, (u->options & OPT_USR_AUTO) ? "True" : "False"); | 207 gtk_clist_set_text(GTK_CLIST(list), i, 2, (u->options & OPT_USR_AUTO) ? "True" : "False"); |
205 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); | 208 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); |
206 } else { | 209 } else { |
207 char *titles[4]; | 210 char *titles[4]; |
208 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); | 211 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); |
209 if (find_user(txt)) { | 212 if (find_user(txt, tmpusr.protocol)) { |
210 /* PRPL: also need to check protocol. remember TOC and Oscar are both AIM */ | |
211 gtk_widget_destroy(newmod); | 213 gtk_widget_destroy(newmod); |
212 return; | 214 return; |
213 } | 215 } |
214 u = g_new0(struct aim_user, 1); | 216 u = g_new0(struct aim_user, 1); |
215 g_snprintf(u->username, sizeof(u->username), "%s", txt); | 217 g_snprintf(u->username, sizeof(u->username), "%s", txt); |
404 } | 406 } |
405 | 407 |
406 static void mod_acct(GtkWidget *w, gpointer d) | 408 static void mod_acct(GtkWidget *w, gpointer d) |
407 { | 409 { |
408 int row = -1; | 410 int row = -1; |
409 char *name; | |
410 struct aim_user *u; | 411 struct aim_user *u; |
411 if (GTK_CLIST(list)->selection) | 412 if (GTK_CLIST(list)->selection) |
412 row = (int)GTK_CLIST(list)->selection->data; | 413 row = (int)GTK_CLIST(list)->selection->data; |
413 if (row != -1) { | 414 if (row != -1) { |
414 gtk_clist_get_text(GTK_CLIST(list), row, 0, &name); | 415 u = g_list_nth_data(aim_users, row); |
415 u = find_user(name); | |
416 if (u) | 416 if (u) |
417 show_acct_mod(u); | 417 show_acct_mod(u); |
418 } | 418 } |
419 } | 419 } |
420 | 420 |
500 } | 500 } |
501 | 501 |
502 static void acct_signin(GtkWidget *w, gpointer d) | 502 static void acct_signin(GtkWidget *w, gpointer d) |
503 { | 503 { |
504 int row = -1; | 504 int row = -1; |
505 char *name; | |
506 struct aim_user *u; | 505 struct aim_user *u; |
507 struct gaim_connection *gc; | |
508 if (GTK_CLIST(list)->selection) | 506 if (GTK_CLIST(list)->selection) |
509 row = (int)GTK_CLIST(list)->selection->data; | 507 row = (int)GTK_CLIST(list)->selection->data; |
510 if (row != -1) { | 508 if (row != -1) { |
511 gtk_clist_get_text(GTK_CLIST(list), row, 0, &name); | 509 u = g_list_nth_data(aim_users, row); |
512 u = find_user(name); | 510 if (!u->gc) { |
513 gc = find_gaim_conn_by_name(name); | |
514 if (!gc) { | |
515 if (!u->password[0]) { | 511 if (!u->password[0]) { |
516 do_pass_dlg(u); | 512 do_pass_dlg(u); |
517 } else { | 513 } else { |
518 #ifdef USE_APPLET | 514 #ifdef USE_APPLET |
519 set_user_state(signing_on); | 515 set_user_state(signing_on); |
520 #endif /* USE_APPLET */ | 516 #endif /* USE_APPLET */ |
521 serv_login(u); | 517 serv_login(u); |
522 } | 518 } |
523 } else { | 519 } else { |
524 signoff(gc); | 520 signoff(u->gc); |
525 } | 521 } |
526 } | 522 } |
527 } | 523 } |
528 | 524 |
529 static void del_acct(GtkWidget *w, gpointer d) | 525 static void del_acct(GtkWidget *w, gpointer d) |
530 { | 526 { |
531 int row = -1; | 527 int row = -1; |
532 char *name; | |
533 struct aim_user *u; | 528 struct aim_user *u; |
534 if (GTK_CLIST(list)->selection) | 529 if (GTK_CLIST(list)->selection) |
535 row = (int)GTK_CLIST(list)->selection->data; | 530 row = (int)GTK_CLIST(list)->selection->data; |
536 if (row != -1) { | 531 if (row != -1) { |
537 gtk_clist_get_text(GTK_CLIST(list), row, 0, &name); | 532 u = g_list_nth_data(aim_users, row); |
538 u = find_user(name); | |
539 if (u) { | 533 if (u) { |
540 aim_users = g_list_remove(aim_users, u); | 534 aim_users = g_list_remove(aim_users, u); |
541 save_prefs(); | 535 save_prefs(); |
542 } | 536 } |
543 gtk_clist_remove(GTK_CLIST(list), row); | 537 gtk_clist_remove(GTK_CLIST(list), row); |
601 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); | 595 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); |
602 | 596 |
603 gtk_widget_show(acctedit); | 597 gtk_widget_show(acctedit); |
604 } | 598 } |
605 | 599 |
606 void account_online(struct gaim_connection *gc) | 600 void account_online(struct aim_user *u, struct gaim_connection *gc) |
607 { | 601 { |
608 struct aim_user *u; | |
609 int i; | 602 int i; |
603 | |
604 gc->user = u; | |
605 u->gc = gc; | |
610 | 606 |
611 /* first we hide the login progress meter */ | 607 /* first we hide the login progress meter */ |
612 if (gc->meter) | 608 if (gc->meter) |
613 gtk_widget_destroy(gc->meter); | 609 gtk_widget_destroy(gc->meter); |
614 gc->meter = NULL; | 610 gc->meter = NULL; |
638 | 634 |
639 plugin_event(event_signon, gc, 0, 0, 0); | 635 plugin_event(event_signon, gc, 0, 0, 0); |
640 | 636 |
641 /* everything for the account editor */ | 637 /* everything for the account editor */ |
642 if (!acctedit) return; | 638 if (!acctedit) return; |
643 u = find_user(gc->username); | 639 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); |
644 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); | |
645 gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes"); | 640 gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes"); |
646 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol)); | 641 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol)); |
647 | 642 |
648 return; | 643 return; |
649 } | 644 } |
650 | 645 |
651 void account_offline(struct gaim_connection *gc) | 646 void account_offline(struct gaim_connection *gc) |
652 { | 647 { |
653 struct aim_user *u; | |
654 int i; | 648 int i; |
649 gc->user->gc = NULL; /* wasn't that awkward? */ | |
655 if (!acctedit) return; | 650 if (!acctedit) return; |
656 u = find_user(gc->username); | 651 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); |
657 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); | |
658 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); | 652 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); |
659 redo_convo_menus(); | 653 redo_convo_menus(); |
660 } | 654 } |
661 | 655 |
662 void auto_login() | 656 void auto_login() |