comparison libpurple/protocols/oscar/family_icbm.c @ 28592:493f48f8d17f 2.6.2_jp

merged with im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 07 Sep 2009 20:39:36 +0900
parents 0754698c49f4 8d5380556f12
children 9d17b1c09193
comparison
equal deleted inserted replaced
28533:7336033277da 28592:493f48f8d17f
1503 static int incomingim_ch1_parsemsgs(OscarData *od, aim_userinfo_t *userinfo, guint8 *data, int len, struct aim_incomingim_ch1_args *args) 1503 static int incomingim_ch1_parsemsgs(OscarData *od, aim_userinfo_t *userinfo, guint8 *data, int len, struct aim_incomingim_ch1_args *args)
1504 { 1504 {
1505 /* Should this be ASCII -> UNICODE -> Custom */ 1505 /* Should this be ASCII -> UNICODE -> Custom */
1506 static const guint16 charsetpri[] = { 1506 static const guint16 charsetpri[] = {
1507 AIM_CHARSET_ASCII, /* ASCII first */ 1507 AIM_CHARSET_ASCII, /* ASCII first */
1508 AIM_CHARSET_CUSTOM, /* then ISO-8859-1 */ 1508 AIM_CHARSET_LATIN_1, /* then ISO-8859-1 */
1509 AIM_CHARSET_UNICODE, /* UNICODE as last resort */ 1509 AIM_CHARSET_UNICODE, /* UNICODE as last resort */
1510 }; 1510 };
1511 static const int charsetpricount = 3; 1511 static const int charsetpricount = 3;
1512 int i; 1512 int i;
1513 ByteStream mbs; 1513 ByteStream mbs;
2751 * 2751 *
2752 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, 2752 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer,
2753 * and Purple 0.60 and newer. 2753 * and Purple 0.60 and newer.
2754 * 2754 *
2755 */ 2755 */
2756 int aim_im_sendmtn(OscarData *od, guint16 type1, const char *bn, guint16 type2) 2756 int aim_im_sendmtn(OscarData *od, guint16 channel, const char *bn, guint16 event)
2757 { 2757 {
2758 FlapConnection *conn; 2758 FlapConnection *conn;
2759 ByteStream bs; 2759 ByteStream bs;
2760 aim_snacid_t snacid; 2760 aim_snacid_t snacid;
2761 2761
2767 2767
2768 byte_stream_new(&bs, 11+strlen(bn)+2); 2768 byte_stream_new(&bs, 11+strlen(bn)+2);
2769 2769
2770 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0014, 0x0000, NULL, 0); 2770 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0014, 0x0000, NULL, 0);
2771 2771
2772 /* 2772 /* ICBM cookie */
2773 * 8 days of light 2773 byte_stream_put32(&bs, 0x00000000);
2774 * Er, that is to say, 8 bytes of 0's 2774 byte_stream_put32(&bs, 0x00000000);
2775 */ 2775
2776 byte_stream_put16(&bs, 0x0000); 2776 /*
2777 byte_stream_put16(&bs, 0x0000); 2777 * Channel (should be 0x0001 for mtn)
2778 byte_stream_put16(&bs, 0x0000); 2778 */
2779 byte_stream_put16(&bs, 0x0000); 2779 byte_stream_put16(&bs, channel);
2780
2781 /*
2782 * Type 1 (should be 0x0001 for mtn)
2783 */
2784 byte_stream_put16(&bs, type1);
2785 2780
2786 /* 2781 /*
2787 * Dest buddy name 2782 * Dest buddy name
2788 */ 2783 */
2789 byte_stream_put8(&bs, strlen(bn)); 2784 byte_stream_put8(&bs, strlen(bn));
2790 byte_stream_putstr(&bs, bn); 2785 byte_stream_putstr(&bs, bn);
2791 2786
2792 /* 2787 /*
2793 * Type 2 (should be 0x0000, 0x0001, or 0x0002 for mtn) 2788 * Event (should be 0x0000, 0x0001, or 0x0002 for mtn)
2794 */ 2789 */
2795 byte_stream_put16(&bs, type2); 2790 byte_stream_put16(&bs, event);
2796 2791
2797 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0014, 0x0000, snacid, &bs); 2792 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0014, 0x0000, snacid, &bs);
2798 2793
2799 byte_stream_destroy(&bs); 2794 byte_stream_destroy(&bs);
2800 2795
2812 { 2807 {
2813 int ret = 0; 2808 int ret = 0;
2814 aim_rxcallback_t userfunc; 2809 aim_rxcallback_t userfunc;
2815 char *bn; 2810 char *bn;
2816 guint8 bnlen; 2811 guint8 bnlen;
2817 guint16 type1, type2; 2812 guint16 channel, event;
2818 2813
2819 byte_stream_advance(bs, 8); /* Unknown - All 0's */ 2814 byte_stream_advance(bs, 8); /* ICBM cookie */
2820 type1 = byte_stream_get16(bs); 2815 channel = byte_stream_get16(bs);
2821 bnlen = byte_stream_get8(bs); 2816 bnlen = byte_stream_get8(bs);
2822 bn = byte_stream_getstr(bs, bnlen); 2817 bn = byte_stream_getstr(bs, bnlen);
2823 type2 = byte_stream_get16(bs); 2818 event = byte_stream_get16(bs);
2824 2819
2825 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) 2820 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
2826 ret = userfunc(od, conn, frame, type1, bn, type2); 2821 ret = userfunc(od, conn, frame, channel, bn, event);
2827 2822
2828 g_free(bn); 2823 g_free(bn);
2829 2824
2830 return ret; 2825 return ret;
2831 } 2826 }