comparison src/protocols/irc/irc.c @ 3633:c084394b86de

[gaim-migrate @ 3756] Lets not do file send just yet its buggy, I need to redo it committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Fri, 11 Oct 2002 03:46:38 +0000
parents 9682c0e022c6
children 7cb6cf20ed7d
comparison
equal deleted inserted replaced
3632:ea32c83c86c2 3633:c084394b86de
490 } 490 }
491 } 491 }
492 492
493 493
494 void irc_read_dcc_ack (gpointer data, gint source, GaimInputCondition condition) { 494 void irc_read_dcc_ack (gpointer data, gint source, GaimInputCondition condition) {
495 struct irc_file_transfer *ift = data; 495 /* Read ACK Here */
496 struct irc_data *id = (struct irc_data *)ift->gc->proto_data; 496
497 int len;
498 guint32 ack;
499
500 printf("I got here.\n");
501 len = recv(source, (char *)&ack, 4, MSG_PEEK);
502 printf("Len is: %d\n", len);
503 printf("Ack is: %d\n", ack);
504 recv(source, (char *)&ack, 4, 0);
505 } 497 }
506 498
507 void dcc_send_callback (gpointer data, gint source, GaimInputCondition condition) { 499 void dcc_send_callback (gpointer data, gint source, GaimInputCondition condition) {
508 struct irc_file_transfer *ift = data; 500 struct irc_file_transfer *ift = data;
509 struct irc_data *id = (struct irc_data *)ift->gc->proto_data; 501 struct irc_data *id = (struct irc_data *)ift->gc->proto_data;
515 addr.sin_addr.s_addr = INADDR_ANY; 507 addr.sin_addr.s_addr = INADDR_ANY;
516 508
517 ift->fd = accept(ift->fd, (struct sockaddr *)&addr, &len); 509 ift->fd = accept(ift->fd, (struct sockaddr *)&addr, &len);
518 if (!ift->fd) { 510 if (!ift->fd) {
519 /* FIXME: Handle this gracefully XXX */ 511 /* FIXME: Handle this gracefully XXX */
520 printf("Something bad happened here, bubba!"); 512 printf("Something bad happened here, bubba!\n");
521 return; 513 return;
522 } 514 }
523 515
524 // ift->awatcher = gaim_input_add(ift->fd, GAIM_INPUT_READ, irc_read_dcc_ack, ift); 516 /* ift->awatcher = gaim_input_add(ift->fd, GAIM_INPUT_READ, irc_read_dcc_ack, ift); */
525 517
526 if (transfer_out_do(ift->xfer, ift->fd, 0)) { 518 if (transfer_out_do(ift->xfer, ift->fd, 0)) {
527 gaim_input_remove(ift->watcher); 519 gaim_input_remove(ift->watcher);
528 ift->watcher = 0; 520 ift->watcher = 0;
529 } 521 }
2147 getsockname (ift->fd, (struct sockaddr *) &addr, &len); 2139 getsockname (ift->fd, (struct sockaddr *) &addr, &len);
2148 2140
2149 ift->port = ntohs(addr.sin_port); 2141 ift->port = ntohs(addr.sin_port);
2150 2142
2151 ift->watcher = gaim_input_add (ift->fd, GAIM_INPUT_READ, dcc_send_callback, ift); 2143 ift->watcher = gaim_input_add (ift->fd, GAIM_INPUT_READ, dcc_send_callback, ift);
2144 printf("watcher is %d\n", ift->watcher);
2152 2145
2153 snprintf(buf, sizeof(buf), "\001DCC SEND %s %s %d %d\001\n", name, ift->ip, ift->port, totsize); 2146 snprintf(buf, sizeof(buf), "\001DCC SEND %s %s %d %d\001\n", name, ift->ip, ift->port, totsize);
2154 printf("Trying: %s\n", buf); 2147 printf("Trying: %s\n", buf);
2155 irc_send_im (gc, ift->sn, buf, -1, 0); 2148 irc_send_im (gc, ift->sn, buf, -1, 0);
2156 } 2149 }
2224 pbm = g_new0(struct proto_buddy_menu, 1); 2217 pbm = g_new0(struct proto_buddy_menu, 1);
2225 pbm->label = _("DCC Chat"); 2218 pbm->label = _("DCC Chat");
2226 pbm->callback = irc_start_chat; 2219 pbm->callback = irc_start_chat;
2227 pbm->gc = gc; 2220 pbm->gc = gc;
2228 m = g_list_append(m, pbm); 2221 m = g_list_append(m, pbm);
2229 2222 /*
2230 pbm = g_new0(struct proto_buddy_menu, 1); 2223 pbm = g_new0(struct proto_buddy_menu, 1);
2231 pbm->label = _("DCC Send"); 2224 pbm->label = _("DCC Send");
2232 pbm->callback = irc_ask_send_file; 2225 pbm->callback = irc_ask_send_file;
2233 pbm->gc = gc; 2226 pbm->gc = gc;
2234 m = g_list_append(m, pbm); 2227 m = g_list_append(m, pbm);
2235 2228 */
2236 return m; 2229 return m;
2237 } 2230 }
2238 2231
2239 static struct prpl *my_protocol = NULL; 2232 static struct prpl *my_protocol = NULL;
2240 2233