Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/family_icbm.c @ 25490:ddd3c6e238fe
propagate from branch 'im.pidgin.pidgin' (head a128e310ce8622212e6b8b435d45a15c25abb2c3)
to branch 'im.pidgin.pidgin.yaz' (head e4fe0aa1499ea7ac385685f1604614d731478766)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 23 May 2007 12:17:52 +0000 |
parents | 1927f4ead3ca be098f796b32 |
children | a79b96ba2b49 |
comparison
equal
deleted
inserted
replaced
17254:0d9fba04fc85 | 25490:ddd3c6e238fe |
---|---|
49 | 49 |
50 #ifdef _WIN32 | 50 #ifdef _WIN32 |
51 #include "win32dep.h" | 51 #include "win32dep.h" |
52 #endif | 52 #endif |
53 | 53 |
54 /* yaz */ | |
55 #include "debug.h" | |
56 #include "../../util.h" | |
57 | |
54 /** | 58 /** |
55 * Add a standard ICBM header to the given bstream with the given | 59 * Add a standard ICBM header to the given bstream with the given |
56 * information. | 60 * information. |
57 * | 61 * |
58 * @param bs The bstream to write the ICBM header to. | 62 * @param bs The bstream to write the ICBM header to. |
451 IcbmCookie *msgcookie; | 455 IcbmCookie *msgcookie; |
452 struct aim_invite_priv *priv; | 456 struct aim_invite_priv *priv; |
453 guchar cookie[8]; | 457 guchar cookie[8]; |
454 aim_tlvlist_t *otl = NULL, *itl = NULL; | 458 aim_tlvlist_t *otl = NULL, *itl = NULL; |
455 ByteStream hdrbs; | 459 ByteStream hdrbs; |
460 // yaz | |
461 char *ucs = NULL; | |
462 int bytes; | |
456 | 463 |
457 if (!od || !(conn = flap_connection_findbygroup(od, 0x0004))) | 464 if (!od || !(conn = flap_connection_findbygroup(od, 0x0004))) |
458 return -EINVAL; | 465 return -EINVAL; |
459 | 466 |
460 if (!sn || !msg || !roomname) | 467 if (!sn || !msg || !roomname) |
490 * Sigh. AOL was rather inconsistent right here. So we have | 497 * Sigh. AOL was rather inconsistent right here. So we have |
491 * to play some minor tricks. Right inside the type 5 is some | 498 * to play some minor tricks. Right inside the type 5 is some |
492 * raw data, followed by a series of TLVs. | 499 * raw data, followed by a series of TLVs. |
493 * | 500 * |
494 */ | 501 */ |
502 #if 0 | |
495 byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2); | 503 byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2); |
496 | 504 |
497 byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */ | 505 byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */ |
498 byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */ | 506 byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */ |
499 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT); | 507 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT); |
500 | 508 #endif |
509 //yaz | |
510 // convert msg to ascii first. if it succeed, send as plain ascii. | |
511 // if it fails, convert msg into ucs-2be, and send it. | |
512 ucs = g_convert(msg, strlen(msg), "ASCII", "UTF-8", NULL, &bytes, NULL); | |
513 if(ucs){ | |
514 byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2); | |
515 | |
516 byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */ | |
517 byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */ | |
518 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT); | |
519 | |
520 aim_tlvlist_add_16(&itl, 0x000a, 0x0001); | |
521 aim_tlvlist_add_noval(&itl, 0x000f); | |
522 aim_tlvlist_add_raw(&itl, 0x000c, strlen(msg), msg); | |
523 free(ucs); | |
524 } else { | |
525 byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2+4+11); | |
526 | |
527 byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */ | |
528 byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */ | |
529 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT); | |
530 | |
531 aim_tlvlist_add_16(&itl, 0x000a, 0x0001); | |
532 aim_tlvlist_add_raw(&itl, 0x000d, 11, "unicode-2-0"); | |
533 aim_tlvlist_add_noval(&itl, 0x000f); | |
534 //yaz | |
535 ucs = g_convert(msg, strlen(msg), "UCS-2BE", "UTF-8", NULL, &bytes, NULL); | |
536 if(ucs){ | |
537 botch_ucs(ucs, bytes); | |
538 aim_tlvlist_add_raw(&itl, 0x000c, bytes, ucs); | |
539 free(ucs); | |
540 } | |
541 } | |
542 #if 0 | |
501 aim_tlvlist_add_16(&itl, 0x000a, 0x0001); | 543 aim_tlvlist_add_16(&itl, 0x000a, 0x0001); |
502 aim_tlvlist_add_noval(&itl, 0x000f); | 544 aim_tlvlist_add_noval(&itl, 0x000f); |
503 aim_tlvlist_add_str(&itl, 0x000c, msg); | 545 aim_tlvlist_add_str(&itl, 0x000c, msg); |
546 #endif | |
504 aim_tlvlist_add_chatroom(&itl, 0x2711, exchange, roomname, instance); | 547 aim_tlvlist_add_chatroom(&itl, 0x2711, exchange, roomname, instance); |
505 aim_tlvlist_write(&hdrbs, &itl); | 548 aim_tlvlist_write(&hdrbs, &itl); |
506 | 549 |
507 aim_tlvlist_add_raw(&otl, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); | 550 aim_tlvlist_add_raw(&otl, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); |
508 g_free(hdrbs.data); | 551 g_free(hdrbs.data); |