comparison src/protocols/oscar/info.c @ 2920:4ed6fb39870b

[gaim-migrate @ 2933] who the hell cares. committer: Tailor Script <tailor@pidgin.im>
author Adam Fritzler <mid@auk.cx>
date Tue, 01 Jan 2002 09:49:04 +0000
parents 22aefb8de0cb
children 8e924e4aa256
comparison
equal deleted inserted replaced
2919:22aefb8de0cb 2920:4ed6fb39870b
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))
27 return -EINVAL; 24 return -EINVAL;
28 25
29 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn)))) 26 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn))))
30 return -ENOMEM; 27 return -ENOMEM;
31 28
207 204
208 {AIM_CAPS_EMPTY, 205 {AIM_CAPS_EMPTY,
209 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 206 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, 207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
211 208
209 {AIM_CAPS_TRILLIANCRYPT,
210 {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb,
211 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}},
212
212 {AIM_CAPS_LAST} 213 {AIM_CAPS_LAST}
213 }; 214 };
214 215
215 /* 216 /*
216 * This still takes a length parameter even with a bstream because capabilities 217 * This still takes a length parameter even with a bstream because capabilities
236 break; /* should only match once... */ 237 break; /* should only match once... */
237 238
238 } 239 }
239 } 240 }
240 241
241 if (!identified) 242 if (!identified) {
242 faimdprintf(sess, 0, "unknown capability!\n"); 243 faimdprintf(sess, 0, "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
244 cap[0], cap[1], cap[2], cap[3],
245 cap[4], cap[5],
246 cap[6], cap[7],
247 cap[8], cap[9],
248 cap[10], cap[11], cap[12], cap[13],
249 cap[14], cap[15]);
250 }
243 251
244 free(cap); 252 free(cap);
245 } 253 }
246 254
247 return flags; 255 return flags;
599 } 607 }
600 608
601 inforeq = (struct aim_priv_inforeq *)origsnac->data; 609 inforeq = (struct aim_priv_inforeq *)origsnac->data;
602 610
603 if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) && 611 if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) &&
604 (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE)) { 612 (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) &&
613 (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) {
605 faimdprintf(sess, 0, "parse_userinfo_middle: unknown infotype in request! (0x%04x)\n", inforeq->infotype); 614 faimdprintf(sess, 0, "parse_userinfo_middle: unknown infotype in request! (0x%04x)\n", inforeq->infotype);
606 return 0; 615 return 0;
607 } 616 }
608 617
609 aim_extractuserinfo(sess, bs, &userinfo); 618 aim_extractuserinfo(sess, bs, &userinfo);
612 621
613 /* 622 /*
614 * Depending on what informational text was requested, different 623 * Depending on what informational text was requested, different
615 * TLVs will appear here. 624 * TLVs will appear here.
616 * 625 *
617 * Profile will be 1 and 2, away message will be 3 and 4. 626 * Profile will be 1 and 2, away message will be 3 and 4, caps
618 */ 627 * will be 5.
619 if (aim_gettlv(tlvlist, 0x0001, 1)) { 628 */
629 if (inforeq->infotype == AIM_GETINFO_GENERALINFO) {
620 text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1); 630 text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1);
621 text = aim_gettlv_str(tlvlist, 0x0002, 1); 631 text = aim_gettlv_str(tlvlist, 0x0002, 1);
622 } else if (aim_gettlv(tlvlist, 0x0003, 1)) { 632 } else if (inforeq->infotype == AIM_GETINFO_AWAYMESSAGE) {
623 text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1); 633 text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1);
624 text = aim_gettlv_str(tlvlist, 0x0004, 1); 634 text = aim_gettlv_str(tlvlist, 0x0004, 1);
635 } else if (inforeq->infotype == AIM_GETINFO_CAPABILITIES) {
636 aim_tlv_t *ct;
637
638 if ((ct = aim_gettlv(tlvlist, 0x0005, 1))) {
639 aim_bstream_t cbs;
640
641 aim_bstream_init(&cbs, ct->value, ct->length);
642
643 userinfo.capabilities = aim_getcap(sess, &cbs, ct->length);
644 userinfo.capspresent = 1;
645 }
625 } 646 }
626 647
627 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 648 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
628 ret = userfunc(sess, rx, &userinfo, text_encoding, text, inforeq->infotype); 649 ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text);
629 650
630 free(text_encoding); 651 free(text_encoding);
631 free(text); 652 free(text);
632 653
633 aim_freetlvchain(&tlvlist); 654 aim_freetlvchain(&tlvlist);