diff src/protocols/irc/irc.c @ 3730:a20bf3d247ff

[gaim-migrate @ 3868] Pretty do_ask_dialog. I also "fixed" the "hitting yes calls the 'no' function anyway" behavior. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 17 Oct 2002 21:29:53 +0000
parents 34c95669952f
children 242e52b37a78
line wrap: on
line diff
--- a/src/protocols/irc/irc.c	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/protocols/irc/irc.c	Thu Oct 17 21:29:53 2002 +0000
@@ -443,7 +443,7 @@
 	g_string_free(str, TRUE);
 }
 
-static void dcc_chat_cancel(void *, struct dcc_chat *);
+static void dcc_chat_cancel(struct dcc_chat *);
 
 void
 dcc_chat_in (gpointer data, gint source, GaimInputCondition condition)
@@ -473,7 +473,7 @@
 		convo = new_conversation (chat->nick);
 		write_to_conv (convo, buf, WFLAG_SYSTEM, NULL,
 			       time ((time_t) NULL), -1);
-		dcc_chat_cancel (NULL,chat);
+		dcc_chat_cancel (chat);
 	}
 }
 
@@ -1107,18 +1107,11 @@
 	}
 }
 
-static void dcc_chat_init(gpointer obj, struct dcc_chat *data) {
-	struct dcc_chat * chat = g_new0(struct dcc_chat, 1);
-	
-	memcpy(chat, data, sizeof(struct dcc_chat));  /* we have to make a new one
-						       * because the old one get's freed by
-						       * dcc_chat_cancel. */
-
-	printf("ONE MORE TIME: %s:%d\n", chat->ip_address, chat->port);
-	proxy_connect(chat->ip_address, chat->port, dcc_chat_callback, chat);
+static void dcc_chat_init(struct dcc_chat *data) {
+	proxy_connect(data->ip_address, data->port, dcc_chat_callback, data);
 }
 
-static void dcc_chat_cancel(gpointer obj, struct dcc_chat *data){
+static void dcc_chat_cancel(struct dcc_chat *data){
 	if (find_dcc_chat(data->gc, data->nick)) {
 		dcc_chat_list = g_slist_remove(dcc_chat_list, data); 
 		gaim_input_remove (data->inpa);
@@ -1133,7 +1126,7 @@
 	if (!dchat)
 		return;
 
-	dcc_chat_cancel(NULL, dchat);
+	dcc_chat_cancel(dchat);
 }
 
 static void handle_ctcp(struct gaim_connection *gc, char *to, char *nick,
@@ -1172,9 +1165,8 @@
 		printf("DCC CHAT DEBUG CRAP: %s\n", dccchat->ip_address);
 		dccchat->port=atoi(chat_args[4]);		
 		g_snprintf(dccchat->nick, sizeof(dccchat->nick), nick);	
-		g_snprintf(ask, sizeof(ask), _("%s has requested a DCC chat.  "
-					       "Would you like to establish the direct connection?"), nick);
-		do_ask_dialog(ask, dccchat, dcc_chat_init, dcc_chat_cancel);
+		g_snprintf(ask, sizeof(ask), _("%s would like to establish a DCC chat"), nick);
+		do_ask_dialog(ask, _("This requires a direct connection to be established between the two computers.  Messages sent will not pass through the IRC server"), dccchat, _("Connect"), dcc_chat_init, _("Cancel"), dcc_chat_cancel);
 	}
 
 
@@ -2124,7 +2116,7 @@
 	addr.sin_addr.s_addr = INADDR_ANY;
 	chat->fd = accept (chat->fd, (struct sockaddr *) (&addr), &addrlen);
 	if (!chat->fd) {
-		dcc_chat_cancel (NULL,chat);
+		dcc_chat_cancel (chat);
 		convo = new_conversation (chat->nick);
 		g_snprintf (buf, sizeof buf, _("DCC Chat with %s closed"),
 			    chat->nick);
@@ -2300,7 +2292,7 @@
 	chat->gc = gc;
 	g_snprintf (chat->nick, sizeof (chat->nick), "%s", who);
 	if (chat->fd < 0)  {
-		dcc_chat_cancel (NULL,chat);
+		dcc_chat_cancel (chat);
 		return;
 	}
 	addr.sin_family = AF_INET;