comparison src/protocols/oscar/im.c @ 8982:a4fd6666bb83

[gaim-migrate @ 9757] Some Direct IM fixes. 1. Let's send our correct ip. We were usually sending localhost, so the other side would try to connect to localhost and immediately fail and so say, hey! I can't connect to you! Connect to me instead! 2. Add some gaim_conversation_writes to keep the user more informed as to what's going on. This changes the libfaim API. libfaim users take note. I removed the util get local ip function, and made the function that used to use it take an ip as an argument instead, so that oscar.c could just call gaim's function, which works better. I also made it possible to specify a cookie to use, because I think I'll need that later. Probably. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Thu, 20 May 2004 00:14:14 +0000
parents 8e69a730885c
children 41b97d72e647
comparison
equal deleted inserted replaced
8981:e40f9afd420e 8982:a4fd6666bb83
678 678
679 /** 679 /**
680 * Subtype 0x0006 - Send an "I want to directly connect to you" message 680 * Subtype 0x0006 - Send an "I want to directly connect to you" message
681 * 681 *
682 */ 682 */
683 faim_export int aim_im_sendch2_odcrequest(aim_session_t *sess, fu8_t *cookie, const char *sn, const fu8_t *ip, fu16_t port) 683 faim_export int aim_im_sendch2_odcrequest(aim_session_t *sess, fu8_t *cookie, bool usecookie, const char *sn, const fu8_t *ip, fu16_t port)
684 { 684 {
685 aim_conn_t *conn; 685 aim_conn_t *conn;
686 aim_frame_t *fr; 686 aim_frame_t *fr;
687 aim_snacid_t snacid; 687 aim_snacid_t snacid;
688 fu8_t ck[8]; 688 fu8_t ck[8];
707 * TOC-compatible. 707 * TOC-compatible.
708 * 708 *
709 * XXX - have I mentioned these should be generated in msgcookie.c? 709 * XXX - have I mentioned these should be generated in msgcookie.c?
710 * 710 *
711 */ 711 */
712 for (i = 0; i < 7; i++) 712
713 ck[i] = 0x30 + ((fu8_t) rand() % 10); 713 if (cookie && usecookie) /* allow user-specified cookie */
714 memcpy(ck, cookie, 8);
715 else
716 for (i = 0; i < 7; i++)
717 ck[i] = 0x30 + ((fu8_t) rand() % 10);
714 ck[7] = '\0'; 718 ck[7] = '\0';
715 719
716 if (cookie) 720 if (cookie && !usecookie)
717 memcpy(cookie, ck, 8); 721 memcpy(cookie, ck, 8);
718 722
719 /* ICBM header */ 723 /* ICBM header */
720 aim_im_puticbm(&fr->data, ck, 0x0002, sn); 724 aim_im_puticbm(&fr->data, ck, 0x0002, sn);
721 725