Mercurial > pidgin
comparison src/multi.c @ 1355:04874e92af24
[gaim-migrate @ 1365]
better handling of new user for probably use in reg dialog.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Fri, 22 Dec 2000 03:55:47 +0000 |
| parents | 07f0bb41bbe1 |
| children | d606da211acb |
comparison
equal
deleted
inserted
replaced
| 1354:6b0a7cea1dd1 | 1355:04874e92af24 |
|---|---|
| 225 | 225 |
| 226 static void ok_mod(GtkWidget *w, struct aim_user *u) | 226 static void ok_mod(GtkWidget *w, struct aim_user *u) |
| 227 { | 227 { |
| 228 char *txt; | 228 char *txt; |
| 229 int i; | 229 int i; |
| 230 | |
| 230 if (u) { | 231 if (u) { |
| 231 u->options = u->tmp_options; | 232 u->options = u->tmp_options; |
| 232 u->protocol = u->tmp_protocol; | 233 u->protocol = u->tmp_protocol; |
| 233 txt = gtk_entry_get_text(GTK_ENTRY(u->pass)); | 234 txt = gtk_entry_get_text(GTK_ENTRY(u->pass)); |
| 234 if (u->options & OPT_USR_REM_PASS) | 235 if (u->options & OPT_USR_REM_PASS) |
| 239 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); | 240 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); |
| 240 gtk_clist_set_text(GTK_CLIST(list), i, 2, | 241 gtk_clist_set_text(GTK_CLIST(list), i, 2, |
| 241 (u->options & OPT_USR_AUTO) ? "True" : "False"); | 242 (u->options & OPT_USR_AUTO) ? "True" : "False"); |
| 242 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); | 243 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); |
| 243 } else { | 244 } else { |
| 244 char *titles[4]; | |
| 245 int i; | |
| 246 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); | 245 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); |
| 247 u = g_new0(struct aim_user, 1); | 246 u = new_user(txt, tmpusr.protocol, tmpusr.options); |
| 248 g_snprintf(u->username, sizeof(u->username), "%s", txt); | 247 |
| 249 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.pass)); | 248 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.pass)); |
| 250 g_snprintf(u->password, sizeof(u->password), "%s", txt); | 249 g_snprintf(u->password, sizeof(u->password), "%s", txt); |
| 251 u->options = tmpusr.options; | 250 |
| 252 u->protocol = tmpusr.protocol; | |
| 253 gtk_widget_destroy(newmod); | |
| 254 titles[0] = u->username; | |
| 255 titles[1] = u->gc ? "Yes" : "No"; | |
| 256 titles[2] = (u->options & OPT_USR_AUTO) ? "True" : "False"; | |
| 257 titles[3] = proto_name(u->protocol); | |
| 258 i = gtk_clist_append(GTK_CLIST(list), titles); | |
| 259 gtk_clist_set_row_data(GTK_CLIST(list), i, u); | |
| 260 aim_users = g_list_append(aim_users, u); | |
| 261 for (i = 0; i < 6; i++) | 251 for (i = 0; i < 6; i++) |
| 262 g_snprintf(u->proto_opt[i], sizeof(u->proto_opt[i]), "%s", tmpusr.proto_opt[i]); | 252 g_snprintf(u->proto_opt[i], sizeof(u->proto_opt[i]), "%s", tmpusr.proto_opt[i]); |
| 253 | |
| 254 gtk_widget_destroy(newmod); | |
| 263 } | 255 } |
| 264 save_prefs(); | 256 save_prefs(); |
| 265 } | 257 } |
| 266 | 258 |
| 267 static void cancel_mod(GtkWidget *w, struct aim_user *u) | 259 static void cancel_mod(GtkWidget *w, struct aim_user *u) |
| 839 do_error_dialog(buf, _("Signon Error")); | 831 do_error_dialog(buf, _("Signon Error")); |
| 840 if (gc->meter) | 832 if (gc->meter) |
| 841 gtk_widget_destroy(gc->meter); | 833 gtk_widget_destroy(gc->meter); |
| 842 gc->meter = NULL; | 834 gc->meter = NULL; |
| 843 } | 835 } |
| 836 | |
| 837 struct aim_user *new_user(char *name, int proto, int opts) | |
| 838 { | |
| 839 char *titles[4]; | |
| 840 int i; | |
| 841 | |
| 842 struct aim_user *u = g_new0(struct aim_user, 1); | |
| 843 g_snprintf(u->username, sizeof(u->username), "%s", name); | |
| 844 u->protocol = proto; | |
| 845 u->options = opts; | |
| 846 aim_users = g_list_append(aim_users, u); | |
| 847 | |
| 848 if (list) { | |
| 849 titles[0] = u->username; | |
| 850 titles[1] = u->gc ? "Yes" : "No"; | |
| 851 titles[2] = (u->options & OPT_USR_AUTO) ? "True" : "False"; | |
| 852 titles[3] = proto_name(u->protocol); | |
| 853 i = gtk_clist_append(GTK_CLIST(list), titles); | |
| 854 gtk_clist_set_row_data(GTK_CLIST(list), i, u); | |
| 855 } | |
| 856 | |
| 857 return u; | |
| 858 } |
