Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/tlv.c @ 30831:be056399ae5f
Fixes #12044. We send a dummy packet with DC version = 8 to make
Miranda and QIP think we come from a respectable family and deserve
being sent channel 2 messages (which we now treat as plain text).
Also, we now send HTML_MSGS capability to convince Trillian
to not strip HTML before sending us messages.
author | ivan.komarov@soc.pidgin.im |
---|---|
date | Thu, 05 Aug 2010 21:19:47 +0000 |
parents | bbb27d65681f |
children | 9b55bc3e2640 |
comparison
equal
deleted
inserted
replaced
30830:1f3ef11a9690 | 30831:be056399ae5f |
---|---|
369 int aim_tlvlist_add_str(GSList **list, const guint16 type, const char *value) | 369 int aim_tlvlist_add_str(GSList **list, const guint16 type, const char *value) |
370 { | 370 { |
371 return aim_tlvlist_add_raw(list, type, strlen(value), (guint8 *)value); | 371 return aim_tlvlist_add_raw(list, type, strlen(value), (guint8 *)value); |
372 } | 372 } |
373 | 373 |
374 static int | |
375 count_caps(guint64 caps) | |
376 { | |
377 int set_bits = 0; | |
378 while (caps) { | |
379 set_bits += caps & 1; | |
380 caps >>= 1; | |
381 } | |
382 return set_bits; | |
383 } | |
384 | |
374 /** | 385 /** |
375 * Adds a block of capability blocks to a TLV chain. The bitfield | 386 * Adds a block of capability blocks to a TLV chain. The bitfield |
376 * passed in should be a bitwise %OR of any of the %AIM_CAPS constants: | 387 * passed in should be a bitwise %OR of any of the %AIM_CAPS constants: |
377 * | 388 * |
378 * %OSCAR_CAPABILITY_BUDDYICON Supports Buddy Icons | 389 * %OSCAR_CAPABILITY_BUDDYICON Supports Buddy Icons |
387 * @param caps Bitfield of capability flags to send | 398 * @param caps Bitfield of capability flags to send |
388 * @return The size of the value added. | 399 * @return The size of the value added. |
389 */ | 400 */ |
390 int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint64 caps, const char *mood) | 401 int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint64 caps, const char *mood) |
391 { | 402 { |
392 guint8 buf[256]; /* TODO: Don't use a fixed length buffer */ | |
393 ByteStream bs; | 403 ByteStream bs; |
404 guint32 bs_size; | |
394 guint8 *data; | 405 guint8 *data; |
395 | 406 |
396 if (caps == 0) | 407 if (caps == 0) |
397 return 0; /* nothing there anyway */ | 408 return 0; /* nothing there anyway */ |
398 | 409 |
399 byte_stream_init(&bs, buf, sizeof(buf)); | 410 data = icq_get_custom_icon_data(mood); |
400 | 411 bs_size = 16*(count_caps(caps) + (data != NULL ? 1 : 0)); |
412 | |
413 byte_stream_new(&bs, bs_size); | |
401 byte_stream_putcaps(&bs, caps); | 414 byte_stream_putcaps(&bs, caps); |
402 | 415 |
403 /* adding of custom icon GUID */ | 416 /* adding of custom icon GUID */ |
404 data = icq_get_custom_icon_data(mood); | |
405 if (data != NULL) | 417 if (data != NULL) |
406 byte_stream_putraw(&bs, data, 16); | 418 byte_stream_putraw(&bs, data, 16); |
407 | 419 |
408 return aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), buf); | 420 return aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), bs.data); |
409 } | 421 } |
410 | 422 |
411 /** | 423 /** |
412 * Adds the given chatroom info to a TLV chain. | 424 * Adds the given chatroom info to a TLV chain. |
413 * | 425 * |