Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/family_icbm.c @ 15823:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 5fe8042783c1 |
children | 1927f4ead3ca be098f796b32 |
comparison
equal
deleted
inserted
replaced
15822:84b0f9b23ede | 15823:32c366eeeb99 |
---|---|
1 /* | 1 /* |
2 * Gaim's oscar protocol plugin | 2 * Purple's oscar protocol plugin |
3 * This file is the legal property of its developers. | 3 * This file is the legal property of its developers. |
4 * Please see the AUTHORS file distributed alongside this file. | 4 * Please see the AUTHORS file distributed alongside this file. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
1239 | 1239 |
1240 /* Channel ID */ | 1240 /* Channel ID */ |
1241 channel = byte_stream_get16(bs); | 1241 channel = byte_stream_get16(bs); |
1242 | 1242 |
1243 if (channel != 0x01) { | 1243 if (channel != 0x01) { |
1244 gaim_debug_misc("oscar", "icbm: ICBM recieved on unsupported channel. Ignoring. (chan = %04x)\n", channel); | 1244 purple_debug_misc("oscar", "icbm: ICBM recieved on unsupported channel. Ignoring. (chan = %04x)\n", channel); |
1245 return 0; | 1245 return 0; |
1246 } | 1246 } |
1247 | 1247 |
1248 snlen = byte_stream_get8(bs); | 1248 snlen = byte_stream_get8(bs); |
1249 sn = byte_stream_getstr(bs, snlen); | 1249 sn = byte_stream_getstr(bs, snlen); |
1459 | 1459 |
1460 /* Message string length, including character set info. */ | 1460 /* Message string length, including character set info. */ |
1461 msglen = byte_stream_get16(&mbs); | 1461 msglen = byte_stream_get16(&mbs); |
1462 if (msglen > byte_stream_empty(&mbs)) | 1462 if (msglen > byte_stream_empty(&mbs)) |
1463 { | 1463 { |
1464 gaim_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.", userinfo->sn); | 1464 purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.", userinfo->sn); |
1465 break; | 1465 break; |
1466 } | 1466 } |
1467 | 1467 |
1468 /* Character set info */ | 1468 /* Character set info */ |
1469 flag1 = byte_stream_get16(&mbs); | 1469 flag1 = byte_stream_get16(&mbs); |
1567 type = byte_stream_get16(bs); | 1567 type = byte_stream_get16(bs); |
1568 length = byte_stream_get16(bs); | 1568 length = byte_stream_get16(bs); |
1569 | 1569 |
1570 if (length > byte_stream_empty(bs)) | 1570 if (length > byte_stream_empty(bs)) |
1571 { | 1571 { |
1572 gaim_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); | 1572 purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); |
1573 break; | 1573 break; |
1574 } | 1574 } |
1575 | 1575 |
1576 endpos = byte_stream_curpos(bs) + length; | 1576 endpos = byte_stream_curpos(bs) + length; |
1577 | 1577 |
1590 byte_stream_get8(bs); /* 01 */ | 1590 byte_stream_get8(bs); /* 01 */ |
1591 | 1591 |
1592 args.featureslen = byte_stream_get16(bs); | 1592 args.featureslen = byte_stream_get16(bs); |
1593 if (args.featureslen > byte_stream_empty(bs)) | 1593 if (args.featureslen > byte_stream_empty(bs)) |
1594 { | 1594 { |
1595 gaim_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); | 1595 purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); |
1596 break; | 1596 break; |
1597 } | 1597 } |
1598 if (args.featureslen == 0) | 1598 if (args.featureslen == 0) |
1599 { | 1599 { |
1600 args.features = NULL; | 1600 args.features = NULL; |
1654 | 1654 |
1655 } else if (type == 0x0017) { | 1655 } else if (type == 0x0017) { |
1656 | 1656 |
1657 if (length > byte_stream_empty(bs)) | 1657 if (length > byte_stream_empty(bs)) |
1658 { | 1658 { |
1659 gaim_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); | 1659 purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); |
1660 break; | 1660 break; |
1661 } | 1661 } |
1662 free(args.extdata); | 1662 free(args.extdata); |
1663 args.extdatalen = length; | 1663 args.extdatalen = length; |
1664 if (args.extdatalen == 0) | 1664 if (args.extdatalen == 0) |
1665 args.extdata = NULL; | 1665 args.extdata = NULL; |
1666 else | 1666 else |
1667 args.extdata = byte_stream_getraw(bs, args.extdatalen); | 1667 args.extdata = byte_stream_getraw(bs, args.extdatalen); |
1668 | 1668 |
1669 } else { | 1669 } else { |
1670 gaim_debug_misc("oscar", "incomingim_ch1: unknown TLV 0x%04x (len %d)\n", type, length); | 1670 purple_debug_misc("oscar", "incomingim_ch1: unknown TLV 0x%04x (len %d)\n", type, length); |
1671 } | 1671 } |
1672 | 1672 |
1673 /* | 1673 /* |
1674 * This is here to protect ourselves from ourselves. That | 1674 * This is here to protect ourselves from ourselves. That |
1675 * is, if something above doesn't completely parse its value | 1675 * is, if something above doesn't completely parse its value |
1729 char *bn; | 1729 char *bn; |
1730 | 1730 |
1731 bnlen = byte_stream_get16(servdata); | 1731 bnlen = byte_stream_get16(servdata); |
1732 bn = byte_stream_getstr(servdata, bnlen); | 1732 bn = byte_stream_getstr(servdata, bnlen); |
1733 | 1733 |
1734 gaim_debug_misc("oscar", "got a buddy list from %s: group %s, buddy %s\n", userinfo->sn, gn, bn); | 1734 purple_debug_misc("oscar", "got a buddy list from %s: group %s, buddy %s\n", userinfo->sn, gn, bn); |
1735 | 1735 |
1736 free(bn); | 1736 free(bn); |
1737 } | 1737 } |
1738 | 1738 |
1739 free(gn); | 1739 free(gn); |
1914 * Next comes the cookie. Should match the ICBM cookie. | 1914 * Next comes the cookie. Should match the ICBM cookie. |
1915 */ | 1915 */ |
1916 cookie2 = byte_stream_getraw(&bbs, 8); | 1916 cookie2 = byte_stream_getraw(&bbs, 8); |
1917 if (memcmp(cookie, cookie2, 8) != 0) | 1917 if (memcmp(cookie, cookie2, 8) != 0) |
1918 { | 1918 { |
1919 gaim_debug_warning("oscar", | 1919 purple_debug_warning("oscar", |
1920 "Cookies don't match in rendezvous ICBM, bailing out.\n"); | 1920 "Cookies don't match in rendezvous ICBM, bailing out.\n"); |
1921 free(cookie2); | 1921 free(cookie2); |
1922 return 1; | 1922 return 1; |
1923 } | 1923 } |
1924 memcpy(args.cookie, cookie2, 8); | 1924 memcpy(args.cookie, cookie2, 8); |
2204 tlvlist = aim_tlvlist_read(bs); | 2204 tlvlist = aim_tlvlist_read(bs); |
2205 ret = incomingim_ch4(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie); | 2205 ret = incomingim_ch4(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie); |
2206 aim_tlvlist_free(&tlvlist); | 2206 aim_tlvlist_free(&tlvlist); |
2207 | 2207 |
2208 } else { | 2208 } else { |
2209 gaim_debug_misc("oscar", "icbm: ICBM received on an unsupported channel. Ignoring. (chan = %04x)\n", channel); | 2209 purple_debug_misc("oscar", "icbm: ICBM received on an unsupported channel. Ignoring. (chan = %04x)\n", channel); |
2210 } | 2210 } |
2211 | 2211 |
2212 aim_info_free(&userinfo); | 2212 aim_info_free(&userinfo); |
2213 free(cookie); | 2213 free(cookie); |
2214 | 2214 |
2426 | 2426 |
2427 /* | 2427 /* |
2428 * Subtype 0x0014 - Send a mini typing notification (mtn) packet. | 2428 * Subtype 0x0014 - Send a mini typing notification (mtn) packet. |
2429 * | 2429 * |
2430 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, | 2430 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, |
2431 * and Gaim 0.60 and newer. | 2431 * and Purple 0.60 and newer. |
2432 * | 2432 * |
2433 */ | 2433 */ |
2434 int aim_im_sendmtn(OscarData *od, guint16 type1, const char *sn, guint16 type2) | 2434 int aim_im_sendmtn(OscarData *od, guint16 type1, const char *sn, guint16 type2) |
2435 { | 2435 { |
2436 FlapConnection *conn; | 2436 FlapConnection *conn; |
2480 | 2480 |
2481 /* | 2481 /* |
2482 * Subtype 0x0014 - Receive a mini typing notification (mtn) packet. | 2482 * Subtype 0x0014 - Receive a mini typing notification (mtn) packet. |
2483 * | 2483 * |
2484 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, | 2484 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, |
2485 * and Gaim 0.60 and newer. | 2485 * and Purple 0.60 and newer. |
2486 * | 2486 * |
2487 */ | 2487 */ |
2488 static int mtn_receive(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) | 2488 static int mtn_receive(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
2489 { | 2489 { |
2490 int ret = 0; | 2490 int ret = 0; |