comparison libfaim/aim_im.c @ 960:fa681641643d

[gaim-migrate @ 970] *** MULTIPLE-CONNECTIONS *** committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 10 Oct 2000 00:02:02 +0000
parents e18815f5a4e9
children 920c86b753d7
comparison
equal deleted inserted replaced
959:034d5d1d53eb 960:fa681641643d
503 if (reqclass & AIM_CAPS_BUDDYICON) { 503 if (reqclass & AIM_CAPS_BUDDYICON) {
504 504
505 /* 505 /*
506 * Call client. 506 * Call client.
507 */ 507 */
508 #if 0
508 userfunc = aim_callhandler(command->conn, 0x0004, 0x0007); 509 userfunc = aim_callhandler(command->conn, 0x0004, 0x0007);
509 if (userfunc || (i = 0)) 510 if (userfunc || (i = 0))
510 i = userfunc(sess, 511 i = userfunc(sess,
511 command, 512 command,
512 channel, 513 channel,
513 reqclass, 514 reqclass,
514 &userinfo); 515 &userinfo,
516 ip,
517 cookie);
518 #endif
515 519
516 } else if (reqclass & AIM_CAPS_VOICE) { 520 } else if (reqclass & AIM_CAPS_VOICE) {
517 struct aim_msgcookie_t *cachedcook; 521 struct aim_msgcookie_t *cachedcook;
518 522
519 printf("faim: rend: voice!\n"); 523 printf("faim: rend: voice!\n");
539 } 543 }
540 } else if ((reqclass & AIM_CAPS_IMIMAGE) || (reqclass & AIM_CAPS_BUDDYICON)) { 544 } else if ((reqclass & AIM_CAPS_IMIMAGE) || (reqclass & AIM_CAPS_BUDDYICON)) {
541 char ip[30]; 545 char ip[30];
542 struct aim_directim_priv *priv; 546 struct aim_directim_priv *priv;
543 547
544 memset(ip, 0, sizeof(ip)); 548 memset(ip, 0, 30);
545 549
546 if (aim_gettlv(list2, 0x0003, 1) && aim_gettlv(list2, 0x0005, 1)) { 550 if (aim_gettlv(list2, 0x0003, 1) && aim_gettlv(list2, 0x0005, 1)) {
547 struct aim_tlv_t *iptlv, *porttlv; 551 struct aim_tlv_t *iptlv, *porttlv;
548 552
549 iptlv = aim_gettlv(list2, 0x0003, 1); 553 iptlv = aim_gettlv(list2, 0x0003, 1);
550 porttlv = aim_gettlv(list2, 0x0005, 1); 554 porttlv = aim_gettlv(list2, 0x0005, 1);
551 555
552 snprintf(ip, sizeof(ip)-1, "%d.%d.%d.%d:%d", 556 snprintf(ip, 30, "%d.%d.%d.%d:%d",
553 aimutil_get8(iptlv->value+0), 557 aimutil_get8(iptlv->value+0),
554 aimutil_get8(iptlv->value+1), 558 aimutil_get8(iptlv->value+1),
555 aimutil_get8(iptlv->value+2), 559 aimutil_get8(iptlv->value+2),
556 aimutil_get8(iptlv->value+3), 560 aimutil_get8(iptlv->value+3),
557 4443 /*aimutil_get16(porttlv->value)*/); 561 4443 /*aimutil_get16(porttlv->value)*/);
621 struct aim_tlv_t *miscinfo; 625 struct aim_tlv_t *miscinfo;
622 626
623 if (!(cachedcook = calloc(1, sizeof(struct aim_msgcookie_t)))) 627 if (!(cachedcook = calloc(1, sizeof(struct aim_msgcookie_t))))
624 return 0; 628 return 0;
625 629
626 memset(ip, 0, sizeof(ip)); 630 memset(ip, 0, 30);
627 631
628 if (!(miscinfo = aim_gettlv(list2, 0x2711, 1))) { 632 if (!(miscinfo = aim_gettlv(list2, 0x2711, 1))) {
629 free(cachedcook); 633 free(cachedcook);
630 return 0; 634 return 0;
631 } 635 }
636 if (!(iptlv = aim_gettlv(list2, 0x0003, 1)) || !(porttlv = aim_gettlv(list2, 0x0005, 1))) { 640 if (!(iptlv = aim_gettlv(list2, 0x0003, 1)) || !(porttlv = aim_gettlv(list2, 0x0005, 1))) {
637 free(cachedcook); 641 free(cachedcook);
638 return 0; 642 return 0;
639 } 643 }
640 644
641 snprintf(ip, sizeof(ip)-1, "%d.%d.%d.%d:%d", 645 snprintf(ip, 30, "%d.%d.%d.%d:%d",
642 aimutil_get8(iptlv->value+0), 646 aimutil_get8(iptlv->value+0),
643 aimutil_get8(iptlv->value+1), 647 aimutil_get8(iptlv->value+1),
644 aimutil_get8(iptlv->value+2), 648 aimutil_get8(iptlv->value+2),
645 aimutil_get8(iptlv->value+3), 649 aimutil_get8(iptlv->value+3),
646 aimutil_get16(porttlv->value)); 650 aimutil_get16(porttlv->value));
647 } 651 }
648 652
649 printf("faim: rend: file get request from %s (%s)\n", userinfo.sn, ip); 653 printf("faim: rend: file get request from %s (%s)\n", userinfo.sn, ip);
650 654
651 #if 0 /* XXX finish this */
652 newconn = aim_newconn(sess, AIM_CONN_TYPE_RENDEZVOUS, ip);
653 if (!newconn || (newconn->fd == -1)) {
654 printf("could not connect to %s\n", ip);
655 perror("aim_newconn");
656 aim_conn_kill(sess, &newconn);
657 } else {
658 struct aim_filetransfer_priv *priv;
659 priv = (struct aim_filetransfer_priv *)calloc(1, sizeof(struct aim_filetransfer_priv));
660 memcpy(priv->cookie, cookie, 8);
661 strncpy(priv->sn, userinfo.sn, MAXSNLEN);
662 newconn->priv = priv;
663 printf("faim: connected to peer (fd = %d)\n", newconn->fd);
664 }
665
666 memcpy(cachedcook->cookie, cookie, 8);
667
668 ft = malloc(sizeof(struct aim_filetransfer_priv));
669 ft->state = 1;
670 strncpy(ft->sn, userinfo.sn, sizeof(ft->sn));
671 strncpy(ft->ip, ip, sizeof(ft->ip));
672 #if 0
673 strncpy(ft->fh.name, miscinfo->value+8, sizeof(ft->fh.name));
674 #endif
675 cachedcook->type = AIM_COOKIETYPE_OFTGET;
676 cachedcook->data = ft;
677
678 if (aim_cachecookie(sess, cachedcook) != 0)
679 printf("faim: ERROR caching message cookie\n");
680
681 aim_accepttransfer(sess, command->conn, newconn, ft->sn, cookie, AIM_CAPS_GETFILE);
682
683 free(desc);
684 #endif
685 /* 655 /*
686 * Call client. 656 * Call client.
687 */ 657 */
688 userfunc = aim_callhandler(command->conn, 0x0004, 0x0007); 658 userfunc = aim_callhandler(command->conn, 0x0004, 0x0007);
689 if (userfunc || (i = 0)) 659 if (userfunc || (i = 0))
690 i = userfunc(sess, 660 i = userfunc(sess,
691 command, 661 command,
692 channel, 662 channel,
693 reqclass, 663 reqclass,
694 &userinfo); 664 &userinfo,
665 ip,
666 cookie);
695 667
696 } else if (reqclass & AIM_CAPS_SENDFILE) { 668 } else if (reqclass & AIM_CAPS_SENDFILE) {
697 #if 0 669 #if 0
698 char ip[30]; 670 char ip[30];
699 char *desc = NULL; 671 char *desc = NULL;