Mercurial > pidgin
comparison src/protocols/oscar/tlv.c @ 8225:9790cda80d52
[gaim-migrate @ 8948]
Various bits o' chat code cleanup for oscar.
Mostly I just wanted to re-use some code for incoming i18n chat messages.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 11 Feb 2004 04:06:16 +0000 |
parents | 697221d5d0ff |
children | 92cbf9713795 |
comparison
equal
deleted
inserted
replaced
8224:ad524b8c9c71 | 8225:9790cda80d52 |
---|---|
508 | 508 |
509 return aim_tlvlist_add_raw(list, type, aim_bstream_curpos(&bs), buf); | 509 return aim_tlvlist_add_raw(list, type, aim_bstream_curpos(&bs), buf); |
510 } | 510 } |
511 | 511 |
512 /** | 512 /** |
513 * Adds the given chatroom info to a TLV chain. | |
514 * | |
515 * @param list Destination chain. | |
516 * @param type TLV type to add. | |
517 * @param roomname The name of the chat. | |
518 * @param instance The instance. | |
519 * @retun The size of the value added. | |
520 */ | |
521 faim_internal int aim_tlvlist_add_chatroom(aim_tlvlist_t **list, fu16_t type, fu16_t exchange, const char *roomname, fu16_t instance) | |
522 { | |
523 fu8_t *buf; | |
524 int len; | |
525 aim_bstream_t bs; | |
526 | |
527 len = 2 + 1 + strlen(roomname) + 2; | |
528 | |
529 if (!(buf = malloc(len))) | |
530 return 0; | |
531 | |
532 aim_bstream_init(&bs, buf, len); | |
533 | |
534 aimbs_put16(&bs, exchange); | |
535 aimbs_put8(&bs, strlen(roomname)); | |
536 aimbs_putraw(&bs, roomname, strlen(roomname)); | |
537 aimbs_put16(&bs, instance); | |
538 | |
539 len = aim_tlvlist_add_raw(list, type, aim_bstream_curpos(&bs), buf); | |
540 | |
541 free(buf); | |
542 | |
543 return len; | |
544 } | |
545 | |
546 /** | |
513 * Adds a TLV with a zero length to a TLV chain. | 547 * Adds a TLV with a zero length to a TLV chain. |
514 * | 548 * |
515 * @param list Destination chain. | 549 * @param list Destination chain. |
516 * @param type TLV type to add. | 550 * @param type TLV type to add. |
517 * @retun The size of the value added. | 551 * @retun The size of the value added. |