changeset 3511:7e1c6c16dd41

[gaim-migrate @ 3583] a notify.so fix from deryni. Also, I added some code so that when IRC tells you your nick is already in use, it will ask you to enter a new one rather than just wait to get kicked off. Of course, I didn't test it all, and because I suck, it doesn't work. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 15 Sep 2002 03:40:48 +0000
parents e23909729192
children 1ea341091de8
files plugins/notify.c src/protocols/irc/irc.c
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/notify.c	Sat Sep 14 23:27:28 2002 +0000
+++ b/plugins/notify.c	Sun Sep 15 03:40:48 2002 +0000
@@ -49,7 +49,7 @@
 /* predefine some functions, less warnings */
 void options(GtkWidget *widget, gpointer data);
 void un_star(GtkWidget *widget, gpointer data);
-void un_star_window(GtkWidget *widget, gpointer data);
+int un_star_window(GtkWidget *widget, gpointer data);
 void string_remove(GtkWidget *widget);
 void count_remove(GtkWidget *widget);
 void quote_remove(GtkWidget *widget);
@@ -177,10 +177,11 @@
 	return;
 }
 
-void un_star_window(GtkWidget *widget, gpointer data) {
+int un_star_window(GtkWidget *widget, gpointer data) {
 	GtkWidget *parent = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
 	gtk_object_set_user_data(GTK_OBJECT(parent), gtk_object_get_user_data(GTK_OBJECT(widget)));
 	un_star(parent, data);
+	return 0;
 }
 
 /* This function returns the number in [ ]'s or 0 */
--- a/src/protocols/irc/irc.c	Sat Sep 14 23:27:28 2002 +0000
+++ b/src/protocols/irc/irc.c	Sun Sep 15 03:40:48 2002 +0000
@@ -813,6 +813,14 @@
 	id->liststr = g_string_append(id->liststr, word_eol[4]);
 }
 
+static void irc_change_nick(void *a, char *b) {
+	struct gaim_connection *gc = a;
+	struct irc_data *id = gc->proto_data;
+	char buf[IRC_BUF_LEN];	
+	g_snprintf(buf, sizeof(buf), "NICK %s\r\n", b);
+	irc_write(id->fd, buf, strlen(buf));
+}
+
 static void process_numeric(struct gaim_connection *gc, char *word[], char *word_eol[])
 {
 	struct irc_data *id = gc->proto_data;
@@ -898,6 +906,8 @@
 	case 431:
 		do_error_dialog(_("No IRC nickname given"), NULL, GAIM_ERROR);
 		break;
+	case 433:
+		do_prompt_dialog(_("That nick is already in use.  Please enter a new nick"), gc->displayname, gc, irc_change_nick, NULL);
 	default:
 		if (n > 400 && n < 502) {
 			char errmsg[IRC_BUF_LEN];