Mercurial > pidgin.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
3729:a8f0c169e529 | 3730:a20bf3d247ff |
---|---|
441 GString *str = decode_html(what); | 441 GString *str = decode_html(what); |
442 serv_got_im(gc, who, str->str, flags, t, -1); | 442 serv_got_im(gc, who, str->str, flags, t, -1); |
443 g_string_free(str, TRUE); | 443 g_string_free(str, TRUE); |
444 } | 444 } |
445 | 445 |
446 static void dcc_chat_cancel(void *, struct dcc_chat *); | 446 static void dcc_chat_cancel(struct dcc_chat *); |
447 | 447 |
448 void | 448 void |
449 dcc_chat_in (gpointer data, gint source, GaimInputCondition condition) | 449 dcc_chat_in (gpointer data, gint source, GaimInputCondition condition) |
450 { | 450 { |
451 struct dcc_chat *chat = data; | 451 struct dcc_chat *chat = data; |
471 g_snprintf (buf, sizeof buf, _("DCC Chat with %s closed"), | 471 g_snprintf (buf, sizeof buf, _("DCC Chat with %s closed"), |
472 chat->nick); | 472 chat->nick); |
473 convo = new_conversation (chat->nick); | 473 convo = new_conversation (chat->nick); |
474 write_to_conv (convo, buf, WFLAG_SYSTEM, NULL, | 474 write_to_conv (convo, buf, WFLAG_SYSTEM, NULL, |
475 time ((time_t) NULL), -1); | 475 time ((time_t) NULL), -1); |
476 dcc_chat_cancel (NULL,chat); | 476 dcc_chat_cancel (chat); |
477 } | 477 } |
478 } | 478 } |
479 | 479 |
480 static void irc_file_transfer_do(struct gaim_connection *gc, struct irc_file_transfer *ift) { | 480 static void irc_file_transfer_do(struct gaim_connection *gc, struct irc_file_transfer *ift) { |
481 /* Ok, we better be receiving some crap here boyeee */ | 481 /* Ok, we better be receiving some crap here boyeee */ |
1105 } | 1105 } |
1106 g_free(tmp); | 1106 g_free(tmp); |
1107 } | 1107 } |
1108 } | 1108 } |
1109 | 1109 |
1110 static void dcc_chat_init(gpointer obj, struct dcc_chat *data) { | 1110 static void dcc_chat_init(struct dcc_chat *data) { |
1111 struct dcc_chat * chat = g_new0(struct dcc_chat, 1); | 1111 proxy_connect(data->ip_address, data->port, dcc_chat_callback, data); |
1112 | 1112 } |
1113 memcpy(chat, data, sizeof(struct dcc_chat)); /* we have to make a new one | 1113 |
1114 * because the old one get's freed by | 1114 static void dcc_chat_cancel(struct dcc_chat *data){ |
1115 * dcc_chat_cancel. */ | |
1116 | |
1117 printf("ONE MORE TIME: %s:%d\n", chat->ip_address, chat->port); | |
1118 proxy_connect(chat->ip_address, chat->port, dcc_chat_callback, chat); | |
1119 } | |
1120 | |
1121 static void dcc_chat_cancel(gpointer obj, struct dcc_chat *data){ | |
1122 if (find_dcc_chat(data->gc, data->nick)) { | 1115 if (find_dcc_chat(data->gc, data->nick)) { |
1123 dcc_chat_list = g_slist_remove(dcc_chat_list, data); | 1116 dcc_chat_list = g_slist_remove(dcc_chat_list, data); |
1124 gaim_input_remove (data->inpa); | 1117 gaim_input_remove (data->inpa); |
1125 close (data->fd); | 1118 close (data->fd); |
1126 } | 1119 } |
1131 { | 1124 { |
1132 struct dcc_chat *dchat = find_dcc_chat(gc, who); | 1125 struct dcc_chat *dchat = find_dcc_chat(gc, who); |
1133 if (!dchat) | 1126 if (!dchat) |
1134 return; | 1127 return; |
1135 | 1128 |
1136 dcc_chat_cancel(NULL, dchat); | 1129 dcc_chat_cancel(dchat); |
1137 } | 1130 } |
1138 | 1131 |
1139 static void handle_ctcp(struct gaim_connection *gc, char *to, char *nick, | 1132 static void handle_ctcp(struct gaim_connection *gc, char *to, char *nick, |
1140 char *msg, char *word[], char *word_eol[]) | 1133 char *msg, char *word[], char *word_eol[]) |
1141 { | 1134 { |
1170 dccchat->gc = gc; | 1163 dccchat->gc = gc; |
1171 g_snprintf(dccchat->ip_address, sizeof(dccchat->ip_address), chat_args[3]); | 1164 g_snprintf(dccchat->ip_address, sizeof(dccchat->ip_address), chat_args[3]); |
1172 printf("DCC CHAT DEBUG CRAP: %s\n", dccchat->ip_address); | 1165 printf("DCC CHAT DEBUG CRAP: %s\n", dccchat->ip_address); |
1173 dccchat->port=atoi(chat_args[4]); | 1166 dccchat->port=atoi(chat_args[4]); |
1174 g_snprintf(dccchat->nick, sizeof(dccchat->nick), nick); | 1167 g_snprintf(dccchat->nick, sizeof(dccchat->nick), nick); |
1175 g_snprintf(ask, sizeof(ask), _("%s has requested a DCC chat. " | 1168 g_snprintf(ask, sizeof(ask), _("%s would like to establish a DCC chat"), nick); |
1176 "Would you like to establish the direct connection?"), nick); | 1169 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); |
1177 do_ask_dialog(ask, dccchat, dcc_chat_init, dcc_chat_cancel); | |
1178 } | 1170 } |
1179 | 1171 |
1180 | 1172 |
1181 if (!g_strncasecmp(msg, "DCC SEND", 8)) { | 1173 if (!g_strncasecmp(msg, "DCC SEND", 8)) { |
1182 struct irc_file_transfer *ift = g_new0(struct irc_file_transfer, 1); | 1174 struct irc_file_transfer *ift = g_new0(struct irc_file_transfer, 1); |
2122 addr.sin_family = AF_INET; | 2114 addr.sin_family = AF_INET; |
2123 addr.sin_port = htons (chat->port); | 2115 addr.sin_port = htons (chat->port); |
2124 addr.sin_addr.s_addr = INADDR_ANY; | 2116 addr.sin_addr.s_addr = INADDR_ANY; |
2125 chat->fd = accept (chat->fd, (struct sockaddr *) (&addr), &addrlen); | 2117 chat->fd = accept (chat->fd, (struct sockaddr *) (&addr), &addrlen); |
2126 if (!chat->fd) { | 2118 if (!chat->fd) { |
2127 dcc_chat_cancel (NULL,chat); | 2119 dcc_chat_cancel (chat); |
2128 convo = new_conversation (chat->nick); | 2120 convo = new_conversation (chat->nick); |
2129 g_snprintf (buf, sizeof buf, _("DCC Chat with %s closed"), | 2121 g_snprintf (buf, sizeof buf, _("DCC Chat with %s closed"), |
2130 chat->nick); | 2122 chat->nick); |
2131 write_to_conv (convo, buf, WFLAG_SYSTEM, NULL, | 2123 write_to_conv (convo, buf, WFLAG_SYSTEM, NULL, |
2132 time ((time_t) NULL), -1); | 2124 time ((time_t) NULL), -1); |
2298 chat = g_new0 (struct dcc_chat, 1); | 2290 chat = g_new0 (struct dcc_chat, 1); |
2299 chat->fd = socket (AF_INET, SOCK_STREAM, 0); | 2291 chat->fd = socket (AF_INET, SOCK_STREAM, 0); |
2300 chat->gc = gc; | 2292 chat->gc = gc; |
2301 g_snprintf (chat->nick, sizeof (chat->nick), "%s", who); | 2293 g_snprintf (chat->nick, sizeof (chat->nick), "%s", who); |
2302 if (chat->fd < 0) { | 2294 if (chat->fd < 0) { |
2303 dcc_chat_cancel (NULL,chat); | 2295 dcc_chat_cancel (chat); |
2304 return; | 2296 return; |
2305 } | 2297 } |
2306 addr.sin_family = AF_INET; | 2298 addr.sin_family = AF_INET; |
2307 addr.sin_port = 0; | 2299 addr.sin_port = 0; |
2308 addr.sin_addr.s_addr = INADDR_ANY; | 2300 addr.sin_addr.s_addr = INADDR_ANY; |