comparison src/multi.c @ 2397:520257562955

[gaim-migrate @ 2410] changing aim_users to GSList. this works better for me since in gaim-core i had them as a GSList. besides, it saves memory. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 30 Sep 2001 19:58:48 +0000
parents 78fab38249a2
children 6e3dc0b3b9b1
comparison
equal deleted inserted replaced
2396:78fab38249a2 2397:520257562955
137 } 137 }
138 138
139 void regenerate_user_list() 139 void regenerate_user_list()
140 { 140 {
141 char *titles[4]; 141 char *titles[4];
142 GList *u = aim_users; 142 GSList *u = aim_users;
143 struct aim_user *a; 143 struct aim_user *a;
144 int i; 144 int i;
145 145
146 if (!acctedit) 146 if (!acctedit)
147 return; 147 return;
643 int row = -1; 643 int row = -1;
644 struct aim_user *u; 644 struct aim_user *u;
645 while (l) { 645 while (l) {
646 row = (int)l->data; 646 row = (int)l->data;
647 if (row != -1) { 647 if (row != -1) {
648 u = g_list_nth_data(aim_users, row); 648 u = g_slist_nth_data(aim_users, row);
649 if (u) 649 if (u)
650 show_acct_mod(u); 650 show_acct_mod(u);
651 } 651 }
652 l = l->next; 652 l = l->next;
653 } 653 }
742 GList *l = GTK_CLIST(list)->selection; 742 GList *l = GTK_CLIST(list)->selection;
743 int row = -1; 743 int row = -1;
744 struct aim_user *u; 744 struct aim_user *u;
745 while (l) { 745 while (l) {
746 row = (int)l->data; 746 row = (int)l->data;
747 u = g_list_nth_data(aim_users, row); 747 u = g_slist_nth_data(aim_users, row);
748 if (!u->gc) { 748 if (!u->gc) {
749 struct prpl *p = find_prpl(u->protocol); 749 struct prpl *p = find_prpl(u->protocol);
750 if (p && !(p->options & OPT_PROTO_NO_PASSWORD) && !u->password[0]) { 750 if (p && !(p->options & OPT_PROTO_NO_PASSWORD) && !u->password[0]) {
751 do_pass_dlg(u); 751 do_pass_dlg(u);
752 } else { 752 } else {
768 { 768 {
769 if (u->gc) { 769 if (u->gc) {
770 u->gc->wants_to_die = TRUE; 770 u->gc->wants_to_die = TRUE;
771 signoff(u->gc); 771 signoff(u->gc);
772 } 772 }
773 gtk_clist_remove(GTK_CLIST(list), g_list_index(aim_users, u)); 773 gtk_clist_remove(GTK_CLIST(list), g_slist_index(aim_users, u));
774 aim_users = g_list_remove(aim_users, u); 774 aim_users = g_slist_remove(aim_users, u);
775 save_prefs(); 775 save_prefs();
776 } 776 }
777 777
778 static void del_acct(GtkWidget *w, gpointer d) 778 static void del_acct(GtkWidget *w, gpointer d)
779 { 779 {
781 char buf[8192]; 781 char buf[8192];
782 int row = -1; 782 int row = -1;
783 struct aim_user *u; 783 struct aim_user *u;
784 while (l) { 784 while (l) {
785 row = (int)l->data; 785 row = (int)l->data;
786 u = g_list_nth_data(aim_users, row); 786 u = g_slist_nth_data(aim_users, row);
787 if (!u) 787 if (!u)
788 return; 788 return;
789 789
790 g_snprintf(buf, sizeof(buf), _("Are you sure you want to delete %s?"), u->username); 790 g_snprintf(buf, sizeof(buf), _("Are you sure you want to delete %s?"), u->username);
791 do_ask_dialog(buf, u, do_del_acct, NULL); 791 do_ask_dialog(buf, u, do_del_acct, NULL);
793 } 793 }
794 } 794 }
795 795
796 static void sel_auto(gpointer w, gpointer d) 796 static void sel_auto(gpointer w, gpointer d)
797 { 797 {
798 GList *l = aim_users; 798 GSList *l = aim_users;
799 struct aim_user *u; 799 struct aim_user *u;
800 int i = 0; /* faster than doing g_list_index each time */ 800 int i = 0; /* faster than doing g_list_index each time */
801 while (l) { 801 while (l) {
802 u = l->data; 802 u = l->data;
803 l = l->next; 803 l = l->next;
963 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); 963 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No");
964 } 964 }
965 965
966 void auto_login() 966 void auto_login()
967 { 967 {
968 GList *u = aim_users; 968 GSList *u = aim_users;
969 struct aim_user *a = NULL; 969 struct aim_user *a = NULL;
970 970
971 while (u) { 971 while (u) {
972 a = (struct aim_user *)u->data; 972 a = (struct aim_user *)u->data;
973 if ((a->options & OPT_USR_AUTO) && (a->options & OPT_USR_REM_PASS)) { 973 if ((a->options & OPT_USR_AUTO) && (a->options & OPT_USR_REM_PASS)) {
1121 struct aim_user *u = g_new0(struct aim_user, 1); 1121 struct aim_user *u = g_new0(struct aim_user, 1);
1122 g_snprintf(u->username, sizeof(u->username), "%s", name); 1122 g_snprintf(u->username, sizeof(u->username), "%s", name);
1123 g_snprintf(u->user_info, sizeof(u->user_info), "%s", DEFAULT_INFO); 1123 g_snprintf(u->user_info, sizeof(u->user_info), "%s", DEFAULT_INFO);
1124 u->protocol = proto; 1124 u->protocol = proto;
1125 u->options = opts; 1125 u->options = opts;
1126 aim_users = g_list_append(aim_users, u); 1126 aim_users = g_slist_append(aim_users, u);
1127 1127
1128 if (list) { 1128 if (list) {
1129 titles[0] = u->username; 1129 titles[0] = u->username;
1130 titles[1] = u->gc ? "Yes" : "No"; 1130 titles[1] = u->gc ? "Yes" : "No";
1131 titles[2] = (u->options & OPT_USR_AUTO) ? "True" : "False"; 1131 titles[2] = (u->options & OPT_USR_AUTO) ? "True" : "False";