changeset 149:9d684979f507

[gaim-migrate @ 159] You can now change passwords. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Sun, 23 Apr 2000 23:27:29 +0000
parents c09b48f8f7f4
children d4e99c17e399
files ChangeLog src/dialogs.c src/toc.c
diffstat 3 files changed, 82 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Apr 23 00:11:04 2000 +0000
+++ b/ChangeLog	Sun Apr 23 23:27:29 2000 +0000
@@ -12,6 +12,7 @@
 	* FONT sizes now work correctly.
 	* PLUGIN SUPPORT!! (Lots of cool goodies here)
 	* Fixed another leak or two
+	* Added ability to change your screenname password
 
 version 0.9.13 (03/27/2000):
 	* Dialog Box Segfault Fixed (When You Click A Toggle Then Cancel)
--- a/src/dialogs.c	Sun Apr 23 00:11:04 2000 +0000
+++ b/src/dialogs.c	Sun Apr 23 23:27:29 2000 +0000
@@ -1043,45 +1043,102 @@
 	gtk_widget_show(b->window);	
 }
 
+void do_change_password(GtkWidget *widget, struct passwddlg *b)
+{
+	gchar *orig, *new1, *new2;
+	gchar *buf;
+
+	orig = gtk_entry_get_text(GTK_ENTRY(b->original));
+	new1 = gtk_entry_get_text(GTK_ENTRY(b->new1));
+	new2 = gtk_entry_get_text(GTK_ENTRY(b->new2));
+
+	if (strcasecmp(new1, new2)) {
+		do_error_dialog("New Passwords Do Not Match", "Gaim - Change Password Error");
+		return ;
+	}
+
+	if ((strlen(orig) < 1) || (strlen(new1) < 1) || (strlen(new2) < 1)) {
+		do_error_dialog("Fill out all fields completely", "Gaim - Change Password Error");
+		return;
+	}
+
+	buf = g_malloc(BUF_LONG);
+	g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new1);
+	sflap_send(buf, strlen(buf), TYPE_DATA);
+	g_free(buf);
+	
+	destroy_dialog(NULL, b->window);
+	g_free(b);
+}
+
 void show_change_passwd()
 {
 	GtkWidget *hbox;
 	GtkWidget *label;
 	GtkWidget *vbox;
+	GtkWidget *table;
 	struct passwddlg *b = g_new0(struct passwddlg, 1);
 
 	b->window = gtk_window_new(GTK_WINDOW_DIALOG);
 	dialogwindows = g_list_prepend(dialogwindows, b->window);
-	b->cancel = gtk_button_new_with_label("Cancel");
+
 	b->ok = gtk_button_new_with_label("Ok");
-
-	vbox = gtk_vbox_new(FALSE, 10);
-	label = gtk_label_new("Changing Password");
-	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 10);
-	gtk_widget_show(label);
-
-	hbox = gtk_hbox_new(FALSE, 10);
+	b->cancel = gtk_button_new_with_label("Cancel");
+
+	gtk_widget_show(b->ok);
+	gtk_widget_show(b->cancel);
+
+	table = gtk_table_new(3, 2, TRUE);
+	
+
+
 	label = gtk_label_new("Original Password");
 	gtk_widget_show(label);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10);
-
+	gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
 	b->original = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(hbox), b->original, FALSE, FALSE, 10);
-
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 10);
+	gtk_widget_show(b->original);
+	gtk_table_attach_defaults(GTK_TABLE(table), b->original, 1, 2, 0, 1);
+
+        label = gtk_label_new("New Password");
+        gtk_widget_show(label);
+        gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
+        b->new1 = gtk_entry_new();
+        gtk_widget_show(b->new1);
+        gtk_table_attach_defaults(GTK_TABLE(table), b->new1, 1, 2, 1, 2);
+
+        label = gtk_label_new("New Password (again)");
+        gtk_widget_show(label);
+        gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3);
+        b->new2 = gtk_entry_new();
+        gtk_widget_show(b->new2);
+        gtk_table_attach_defaults(GTK_TABLE(table), b->new2, 1, 2, 2, 3);
+
+	gtk_widget_show(table);
+
+	vbox = gtk_vbox_new(TRUE, TRUE);
+	gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 5);
+	
+	hbox = gtk_hbox_new(TRUE, TRUE);
+	gtk_box_pack_start(GTK_BOX(hbox), b->ok, FALSE, FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(hbox), b->cancel, FALSE, FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
 	gtk_widget_show(hbox);
-
-
-        label = gtk_label_new("Got sleepy, Will add the rest later.");
-        gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 10);
-        gtk_widget_show(label);
 	
 	gtk_container_add(GTK_CONTAINER(b->window), vbox);
 	gtk_widget_show(vbox);
-	gtk_widget_show(b->original);
-	aol_icon(b->window->window);
-	gtk_widget_realize(b->window);
+
+	gtk_container_border_width(GTK_CONTAINER(b->window), 10);
+	gtk_window_set_title(GTK_WINDOW(b->window), "Gaim - Password Change");
 	gtk_widget_show(b->window);
+	
+        gtk_signal_connect(GTK_OBJECT(b->window), "destroy",
+                           GTK_SIGNAL_FUNC(destroy_dialog), b->window);
+        gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked",
+                           GTK_SIGNAL_FUNC(destroy_dialog), b->window);
+        gtk_signal_connect(GTK_OBJECT(b->ok), "clicked",
+                           GTK_SIGNAL_FUNC(do_change_password), b);
+
+
 }
 
 void show_set_info()
--- a/src/toc.c	Sun Apr 23 00:11:04 2000 +0000
+++ b/src/toc.c	Sun Apr 23 23:27:29 2000 +0000
@@ -177,7 +177,7 @@
 		   FILETRANS_UID);
 	sflap_send(buf2, -1, TYPE_DATA);
 #endif
-        
+
         serv_finish_login();
 	return 0;
 }
@@ -498,6 +498,8 @@
                 serv_got_joined_chat(id, name);
 
 	} else if (!strcasecmp(c, "DIR_STATUS")) {
+	} else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) {
+		do_error_dialog("Password Change Successeful", "Gaim - Password Change");
 	} else if (!strcasecmp(c, "CHAT_UPDATE_BUDDY")) {
 		int id;
 		char *in;