changeset 978:563c409e26a1

[gaim-migrate @ 988] change passwd dialog works again committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 11 Oct 2000 20:16:04 +0000
parents e5eac6b236f1
children ae6d13c11570
files src/dialogs.c src/gaim.h src/rvous.c src/server.c src/toc.c
diffstat 5 files changed, 111 insertions(+), 86 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Wed Oct 11 18:02:20 2000 +0000
+++ b/src/dialogs.c	Wed Oct 11 20:16:04 2000 +0000
@@ -178,6 +178,7 @@
 	GtkWidget *original;
 	GtkWidget *new1;
 	GtkWidget *new2;
+	struct gaim_connection *gc;
 };
 
 /*------------------------------------------------------------------------*/
@@ -1370,12 +1371,57 @@
 		return;
 	}
 
-	serv_change_passwd(orig, new1);
+	serv_change_passwd(b->gc, orig, new1);
 	
 	destroy_dialog(NULL, b->window);
 	g_free(b);
 }
 
+static void pwd_choose(GtkObject *obj, struct passwddlg *pwd)
+{
+	pwd->gc = (struct gaim_connection *)gtk_object_get_user_data(obj);
+}
+
+static void passwd_multi_menu(GtkWidget *box, struct passwddlg *pwd)
+{
+	GtkWidget *hbox;
+	GtkWidget *label;
+	GtkWidget *optmenu;
+	GtkWidget *menu;
+	GtkWidget *opt;
+	GSList *c = connections;
+	struct gaim_connection *g;
+
+	hbox = gtk_hbox_new(FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+
+	label = gtk_label_new(_("Change password for:"));
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+	gtk_widget_show(label);
+
+	optmenu = gtk_option_menu_new();
+	gtk_box_pack_end(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5);
+	gtk_widget_show(optmenu);
+
+	menu = gtk_menu_new();
+
+	while (c) {
+		g = (struct gaim_connection *)c->data;
+		opt = gtk_menu_item_new_with_label(g->username);
+		gtk_object_set_user_data(GTK_OBJECT(opt), g);
+		gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(pwd_choose), pwd);
+		gtk_menu_append(GTK_MENU(menu), opt);
+		gtk_widget_show(opt);
+		c = c->next;
+	}
+
+	gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
+	gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0);
+
+	pwd->gc = (struct gaim_connection *)connections->data;
+}
+
 void show_change_passwd()
 {
 	GtkWidget *hbox;
@@ -1387,104 +1433,90 @@
 	struct passwddlg *b = g_new0(struct passwddlg, 1);
 
 	b->window = gtk_window_new(GTK_WINDOW_DIALOG);
-	gtk_widget_set_usize(b->window, 325, 195);
+	gtk_widget_set_usize(b->window, 325, -1);
 	gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, FALSE, TRUE);
 	gtk_window_set_wmclass(GTK_WINDOW(b->window), "change_passwd", "Gaim");
-	gtk_widget_show(b->window);
-
+	gtk_container_border_width(GTK_CONTAINER(b->window), 5);
+	gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Password Change"));
+        gtk_signal_connect(GTK_OBJECT(b->window), "destroy",
+                           GTK_SIGNAL_FUNC(destroy_dialog), b->window);
+	gtk_widget_realize(b->window);
+	aol_icon(b->window->window);
 	dialogwindows = g_list_prepend(dialogwindows, b->window);
 
+	fbox = gtk_vbox_new(FALSE, 5);
+	gtk_container_add(GTK_CONTAINER(b->window), fbox);
+	gtk_widget_show(fbox);
+
 	frame = gtk_frame_new(_("Change Password"));
-	fbox = gtk_vbox_new(FALSE, 5);
-
-	/* Build OK Button */
-
-	b->ok = picture_button(b->window, _("OK"), ok_xpm);
-	b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm);
-
-	/* Create our vbox */
+	gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 5);
+	gtk_widget_show(frame);
+
 	vbox = gtk_vbox_new(FALSE, 5);
-
-	
+	gtk_container_add(GTK_CONTAINER(frame), vbox);
+	gtk_widget_show(vbox);
+
+	passwd_multi_menu(vbox, b);
+
 	/* First Line */
 	hbox = gtk_hbox_new(FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+
 	label = gtk_label_new(_("Original Password"));
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
 	gtk_widget_show(label);
 
 	b->original = gtk_entry_new();
 	gtk_entry_set_visibility(GTK_ENTRY(b->original), FALSE);
+	gtk_box_pack_end(GTK_BOX(hbox), b->original, FALSE, FALSE, 5);
 	gtk_widget_show(b->original);
 
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-	gtk_box_pack_end(GTK_BOX(hbox), b->original, FALSE, FALSE, 5);
-
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
-
-	gtk_widget_show(hbox);
-
 	/* Next Line */	
 	hbox = gtk_hbox_new(FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+
         label = gtk_label_new(_("New Password"));
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
         gtk_widget_show(label);
+
         b->new1 = gtk_entry_new();
 	gtk_entry_set_visibility(GTK_ENTRY(b->new1), FALSE);
+	gtk_box_pack_end(GTK_BOX(hbox), b->new1, FALSE, FALSE, 5);
         gtk_widget_show(b->new1);
 
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-	gtk_box_pack_end(GTK_BOX(hbox), b->new1, FALSE, FALSE, 5);
-
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
-	gtk_widget_show(hbox);
-
 	/* Next Line */
 	hbox = gtk_hbox_new(FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+	
 	label = gtk_label_new(_("New Password (again)"));
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
         gtk_widget_show(label);
+
         b->new2 = gtk_entry_new();
 	gtk_entry_set_visibility(GTK_ENTRY(b->new2), FALSE);
+	gtk_box_pack_end(GTK_BOX(hbox), b->new2, FALSE, FALSE, 5);
         gtk_widget_show(b->new2);
 
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-	gtk_box_pack_end(GTK_BOX(hbox), b->new2, FALSE, FALSE, 5);
-
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
-
-	gtk_widget_show(hbox);
-	
 	/* Now do our row of buttons */	
 	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(fbox), hbox, FALSE, FALSE, 5);
 	gtk_widget_show(hbox);
 
-	/* Pack our entries into a frame */
-	gtk_container_add(GTK_CONTAINER(frame), vbox);
-
-	/* Add our frame to our frame box */
-	gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 5);
-
-	/* And add our row of buttons */
-	gtk_box_pack_start(GTK_BOX(fbox), hbox, FALSE, FALSE, 5);
-
-
-	gtk_widget_show(vbox);
-	gtk_widget_show(frame);
-	gtk_widget_show(fbox);
-	
-	gtk_container_add(GTK_CONTAINER(b->window), fbox);
-
-	gtk_container_border_width(GTK_CONTAINER(b->window), 5);
-	gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Password Change"));
-	
-        gtk_signal_connect(GTK_OBJECT(b->window), "destroy",
-                           GTK_SIGNAL_FUNC(destroy_dialog), b->window);
+	b->ok = picture_button(b->window, _("OK"), ok_xpm);
+	gtk_box_pack_start(GTK_BOX(hbox), b->ok, FALSE, FALSE, 5);
+        gtk_signal_connect(GTK_OBJECT(b->ok), "clicked",
+                           GTK_SIGNAL_FUNC(do_change_password), b);
+
+	b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm);
+	gtk_box_pack_start(GTK_BOX(hbox), b->cancel, FALSE, FALSE, 5);
         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);
-
-
+
+
+	gtk_widget_show(b->window);
 }
 
 static void info_choose(GtkWidget *opt, struct set_info_dlg *b)
--- a/src/gaim.h	Wed Oct 11 18:02:20 2000 +0000
+++ b/src/gaim.h	Wed Oct 11 20:16:04 2000 +0000
@@ -382,6 +382,7 @@
         FILE *f;
         int fd;
 	char UID[2048];
+	struct gaim_connection *gc;
 };
 
 struct sflap_hdr {
@@ -634,7 +635,7 @@
 extern void serv_set_idle(struct gaim_connection *, int);
 extern void serv_set_info(struct gaim_connection *, char *);
 extern void serv_set_away(char *);
-extern void serv_change_passwd(char *, char *);
+extern void serv_change_passwd(struct gaim_connection *, char *, char *);
 extern void serv_add_buddy(char *);
 extern void serv_add_buddies(GList *);
 extern void serv_remove_buddy(char *);
@@ -663,8 +664,8 @@
 extern void serv_got_joined_chat(struct gaim_connection *, int, char *);
 extern void serv_got_chat_left(struct gaim_connection *, int);
 extern void serv_got_chat_in(struct gaim_connection *, int, char *, int, char *);
-extern void serv_rvous_accept(char *, char *, char *);
-extern void serv_rvous_cancel(char *, char *, char *);
+extern void serv_rvous_accept(struct gaim_connection *, char *, char *, char *);
+extern void serv_rvous_cancel(struct gaim_connection *, char *, char *, char *);
 
 /* Functions in conversation.c */
 extern void write_html_with_smileys(GtkWidget *, GtkWidget *, char *);
--- a/src/rvous.c	Wed Oct 11 18:02:20 2000 +0000
+++ b/src/rvous.c	Wed Oct 11 20:16:04 2000 +0000
@@ -62,9 +62,7 @@
 
 static void warn_callback(GtkWidget *widget, struct file_transfer *ft)
 {
-	/* FIXME
-        show_warn_dialog(ft->user);
-	*/
+        show_warn_dialog(ft->gc, ft->user);
 }
 
 static void info_callback(GtkWidget *widget, struct file_transfer *ft)
@@ -78,7 +76,7 @@
 		return;
 	}
 	
-	serv_rvous_cancel(ft->user, ft->cookie, ft->UID);
+	serv_rvous_cancel(ft->gc, ft->user, ft->cookie, ft->UID);
 
 	free_ft(ft);
 }
@@ -230,7 +228,7 @@
 	
 	gtk_widget_destroy(ft->window);
 	ft->window = NULL;
-	serv_rvous_accept(ft->user, ft->cookie, ft->UID);
+	serv_rvous_accept(ft->gc, ft->user, ft->cookie, ft->UID);
 
 	
 	ft->fd = connect_address(inet_addr(ft->ip), ft->port);
@@ -328,7 +326,7 @@
 
 	if (!cont) {
 		char *tmp = frombase64(ft->cookie);
-		serv_rvous_cancel(ft->user, tmp, ft->UID);
+		serv_rvous_cancel(ft->gc, ft->user, tmp, ft->UID);
 		close(ft->fd);
 		free_ft(ft);
 		return;
@@ -462,7 +460,7 @@
 
 	if (!cont) {
 		char *tmp = frombase64(ft->cookie);
-		serv_rvous_cancel(ft->user, tmp, ft->UID);
+		serv_rvous_cancel(ft->gc, ft->user, tmp, ft->UID);
 		close(ft->fd);
 		free_ft(ft);
 		return;
@@ -503,7 +501,7 @@
 
 	gtk_widget_destroy(ft->window);
 	ft->window = NULL;
-	serv_rvous_accept(ft->user, ft->cookie, ft->UID);
+	serv_rvous_accept(ft->gc, ft->user, ft->cookie, ft->UID);
 
 
 
--- a/src/server.c	Wed Oct 11 18:02:20 2000 +0000
+++ b/src/server.c	Wed Oct 11 20:16:04 2000 +0000
@@ -282,19 +282,15 @@
 	}
 }
 
-void serv_change_passwd(char *orig, char *new) {
-	/* FIXME: passwords are the kinds of things you don't want randomly changed;
-	 * this whole thing is commented out :-P
-	struct gaim_connection *g = connections->data;
+void serv_change_passwd(struct gaim_connection *g, char *orig, char *new) {
 	if (g->protocol == PROTO_TOC) {
 		char *buf = g_malloc(BUF_LONG); 
 		g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new);
 		sflap_send(g, buf, strlen(buf), TYPE_DATA);
 		g_free(buf);
 	} else if (g->protocol == PROTO_OSCAR) {
-		Oscar change_passwd FIXME
+		/* Oscar change_passwd FIXME */
 	}
-	*/
 }
 
 void serv_add_buddy(char *name)
@@ -1080,21 +1076,17 @@
         chat_write(b, who, w, message);
 }
 
-void serv_rvous_accept(char *name, char *cookie, char *uid)
+void serv_rvous_accept(struct gaim_connection *g, char *name, char *cookie, char *uid)
 {
 	/* Oscar doesn't matter here because this won't ever be called for it */
-	/* FIXME */
-	struct gaim_connection *g = connections->data;
 	char buf[MSG_LEN];
 	g_snprintf(buf, MSG_LEN, "toc_rvous_accept %s %s %s", normalize(name),
 			cookie, uid);
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-void serv_rvous_cancel(char *name, char *cookie, char *uid)
+void serv_rvous_cancel(struct gaim_connection *g, char *name, char *cookie, char *uid)
 {
-	/* FIXME */
-	struct gaim_connection *g = connections->data;
 	char buf[MSG_LEN];
 	g_snprintf(buf, MSG_LEN, "toc_rvous_cancel %s %s %s", normalize(name),
 			cookie, uid);
--- a/src/toc.c	Wed Oct 11 18:02:20 2000 +0000
+++ b/src/toc.c	Wed Oct 11 20:16:04 2000 +0000
@@ -39,7 +39,7 @@
 #include "gaim.h"
 #include "gnome_applet_mgr.h"
 
-#define REVISION "gaim:$Revision: 986 $"
+#define REVISION "gaim:$Revision: 988 $"
 
 
 static unsigned int peer_ver=0;
@@ -617,6 +617,7 @@
 	                ft->user = g_strdup(user);
 	                ft->size = totalsize;
 			sprintf(ft->UID, "%s", FILE_SEND_UID);
+			ft->gc = gc;
                 
 	                g_free(tmp);
 
@@ -645,6 +646,7 @@
 				ft->message = NULL;
 			ft->user = g_strdup(user);
 			sprintf(ft->UID, "%s", FILE_GET_UID);
+			ft->gc = gc;
 
 			g_free(tmp);