comparison src/protocols/oscar/info.c @ 2919:22aefb8de0cb

[gaim-migrate @ 2932] jeez, i'm just undoing everything i did today, aren't i committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 22 Dec 2001 08:11:11 +0000
parents 93e2c99ccf50
children 4ed6fb39870b
comparison
equal deleted inserted replaced
2918:4df759d607f3 2919:22aefb8de0cb
19 struct aim_priv_inforeq privdata; 19 struct aim_priv_inforeq privdata;
20 aim_frame_t *fr; 20 aim_frame_t *fr;
21 aim_snacid_t snacid; 21 aim_snacid_t snacid;
22 22
23 if (!sess || !conn || !sn) 23 if (!sess || !conn || !sn)
24 return -EINVAL;
25
26 if ((infotype != AIM_GETINFO_GENERALINFO) && (infotype != AIM_GETINFO_AWAYMESSAGE))
24 return -EINVAL; 27 return -EINVAL;
25 28
26 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn)))) 29 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn))))
27 return -ENOMEM; 30 return -ENOMEM;
28 31
596 } 599 }
597 600
598 inforeq = (struct aim_priv_inforeq *)origsnac->data; 601 inforeq = (struct aim_priv_inforeq *)origsnac->data;
599 602
600 if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) && 603 if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) &&
601 (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) && 604 (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE)) {
602 (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) {
603 faimdprintf(sess, 0, "parse_userinfo_middle: unknown infotype in request! (0x%04x)\n", inforeq->infotype); 605 faimdprintf(sess, 0, "parse_userinfo_middle: unknown infotype in request! (0x%04x)\n", inforeq->infotype);
604 return 0; 606 return 0;
605 } 607 }
606 608
607 aim_extractuserinfo(sess, bs, &userinfo); 609 aim_extractuserinfo(sess, bs, &userinfo);
610 612
611 /* 613 /*
612 * Depending on what informational text was requested, different 614 * Depending on what informational text was requested, different
613 * TLVs will appear here. 615 * TLVs will appear here.
614 * 616 *
615 * Profile will be 1 and 2, away message will be 3 and 4, caps 617 * Profile will be 1 and 2, away message will be 3 and 4.
616 * will be 5. 618 */
617 */ 619 if (aim_gettlv(tlvlist, 0x0001, 1)) {
618 if (inforeq->infotype == AIM_GETINFO_GENERALINFO) {
619 text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1); 620 text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1);
620 text = aim_gettlv_str(tlvlist, 0x0002, 1); 621 text = aim_gettlv_str(tlvlist, 0x0002, 1);
621 } else if (inforeq->infotype == AIM_GETINFO_AWAYMESSAGE) { 622 } else if (aim_gettlv(tlvlist, 0x0003, 1)) {
622 text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1); 623 text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1);
623 text = aim_gettlv_str(tlvlist, 0x0004, 1); 624 text = aim_gettlv_str(tlvlist, 0x0004, 1);
624 } else if (inforeq->infotype == AIM_GETINFO_CAPABILITIES) {
625 aim_tlv_t *ct;
626
627 if ((ct = aim_gettlv(tlvlist, 0x0005, 1))) {
628 aim_bstream_t cbs;
629
630 aim_bstream_init(&cbs, ct->value, ct->length);
631
632 userinfo.capabilities = aim_getcap(sess, &cbs, ct->length);
633 userinfo.capspresent = 1;
634 }
635 } 625 }
636 626
637 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 627 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
638 ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text); 628 ret = userfunc(sess, rx, &userinfo, text_encoding, text, inforeq->infotype);
639 629
640 free(text_encoding); 630 free(text_encoding);
641 free(text); 631 free(text);
642 632
643 aim_freetlvchain(&tlvlist); 633 aim_freetlvchain(&tlvlist);