Changes in libfaim/chat.c [cf02dd6:7869e48]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfaim/chat.c
rcf02dd6 r7869e48 5 5 6 6 #define FAIM_INTERNAL 7 #include <aim.h> 7 #include <aim.h> 8 8 9 9 #include <string.h> … … 93 93 94 94 buflen = 2 + 1 + strlen(roomname) + 2; 95 95 96 96 if (!(buf = malloc(buflen))) 97 97 return 0; … … 112 112 113 113 /* 114 * Join a room of name roomname. This is the first step to joining an 115 * already created room. It's basically a Service Request for 116 * family 0x000e, with a little added on to specify the exchange and room 114 * Join a room of name roomname. This is the first step to joining an 115 * already created room. It's basically a Service Request for 116 * family 0x000e, with a little added on to specify the exchange and room 117 117 * name. 118 118 */ … … 123 123 aim_tlvlist_t *tl = NULL; 124 124 struct chatsnacinfo csi; 125 125 126 126 if (!sess || !conn || !roomname || !strlen(roomname)) 127 127 return -EINVAL; … … 149 149 aim_tx_enqueue(sess, fr); 150 150 151 return 0; 151 return 0; 152 152 } 153 153 … … 194 194 int hdrlen; 195 195 aim_bstream_t hdrbs; 196 196 197 197 if (!sess || !conn || !sn || !msg || !roomname) 198 198 return -EINVAL; … … 239 239 * Sigh. AOL was rather inconsistent right here. So we have 240 240 * to play some minor tricks. Right inside the type 5 is some 241 * raw data, followed by a series of TLVs. 241 * raw data, followed by a series of TLVs. 242 242 * 243 243 */ … … 245 245 hdr = malloc(hdrlen); 246 246 aim_bstream_init(&hdrbs, hdr, hdrlen); 247 247 248 248 aimbs_put16(&hdrbs, 0x0000); /* Unknown! */ 249 249 aimbs_putraw(&hdrbs, ckstr, sizeof(ckstr)); /* I think... */ … … 255 255 aim_addtlvtochain_chatroom(&itl, 0x2711, exchange, roomname, instance); 256 256 aim_tlvlist_write(&hdrbs, &itl); 257 257 258 258 aim_tlvlist_add_raw(&otl, 0x0005, aim_bstream_curpos(&hdrbs), hdr); 259 259 … … 263 263 aim_tlvlist_free(&itl); 264 264 aim_tlvlist_free(&otl); 265 265 266 266 aim_tx_enqueue(sess, fr); 267 267 … … 307 307 /* 308 308 * Everything else are TLVs. 309 */ 309 */ 310 310 tlvlist = aim_tlvlist_read(bs); 311 311 … … 325 325 * Type 0x0073: Occupant list. 326 326 */ 327 if (aim_tlv_gettlv(tlvlist, 0x0073, 1)) { 327 if (aim_tlv_gettlv(tlvlist, 0x0073, 1)) { 328 328 int curoccupant = 0; 329 329 aim_tlv_t *tmptlv; … … 341 341 } 342 342 343 /* 343 /* 344 344 * Type 0x00c9: Flags. (AIM_CHATROOM_FLAG) 345 345 */ … … 347 347 flags = aim_tlv_get16(tlvlist, 0x00c9, 1); 348 348 349 /* 349 /* 350 350 * Type 0x00ca: Creation time (4 bytes) 351 351 */ … … 353 353 creationtime = aim_tlv_get32(tlvlist, 0x00ca, 1); 354 354 355 /* 355 /* 356 356 * Type 0x00d1: Maximum Message Length 357 357 */ … … 359 359 maxmsglen = aim_tlv_get16(tlvlist, 0x00d1, 1); 360 360 361 /* 361 /* 362 362 * Type 0x00d2: Unknown. (2 bytes) 363 363 */ … … 365 365 unknown_d2 = aim_tlv_get16(tlvlist, 0x00d2, 1); 366 366 367 /* 367 /* 368 368 * Type 0x00d3: Room Description 369 369 */ … … 377 377 ; 378 378 379 /* 379 /* 380 380 * Type 0x00d5: Unknown. (1 byte) 381 381 */ … … 389 389 if (aim_tlv_gettlv(tlvlist, 0x000d6, 1)) 390 390 ; 391 391 392 392 /* 393 393 * Type 0x00d7: Language 1 ("en") … … 401 401 if (aim_tlv_gettlv(tlvlist, 0x000d8, 1)) 402 402 ; 403 403 404 404 /* 405 405 * Type 0x00d9: Language 2 ("en") … … 475 475 * and displays the message as normal.) 476 476 * 477 * XXX convert this to use tlvchains 477 * XXX convert this to use tlvchains 478 478 */ 479 479 faim_export int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, fu16_t flags, const char *msg, int msglen) 480 { 480 { 481 481 int i; 482 482 aim_frame_t *fr; … … 539 539 * 540 540 * This could include other information... We just 541 * put in a message TLV however. 542 * 541 * put in a message TLV however. 542 * 543 543 */ 544 544 aim_tlvlist_add_frozentlvlist(&otl, 0x0005, &itl); 545 545 546 546 aim_tlvlist_write(&fr->data, &otl); 547 547 548 548 aim_tlvlist_free(&itl); 549 549 aim_tlvlist_free(&otl); 550 550 551 551 aim_tx_enqueue(sess, fr); 552 552 … … 557 557 * Subtype 0x0006 558 558 * 559 * We could probably include this in the normal ICBM parsing 559 * We could probably include this in the normal ICBM parsing 560 560 * code as channel 0x0003, however, since only the start 561 561 * would be the same, we might as well do it here. … … 577 577 * message string 578 578 * possibly others 579 * 579 * 580 580 */ 581 581 static int incomingmsg(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 582 582 { 583 583 aim_userinfo_t userinfo; 584 aim_rxcallback_t userfunc; 584 aim_rxcallback_t userfunc; 585 585 int ret = 0; 586 586 fu8_t *cookie; … … 619 619 620 620 /* 621 * Start parsing TLVs right away. 621 * Start parsing TLVs right away. 622 622 */ 623 623 otl = aim_tlvlist_read(bs); … … 637 637 638 638 /* 639 * Type 0x0001: If present, it means it was a message to the 639 * Type 0x0001: If present, it means it was a message to the 640 640 * room (as opposed to a whisper). 641 641 */ … … 655 655 itl = aim_tlvlist_read(&tbs); 656 656 657 /* 657 /* 658 658 * Type 0x0001: Message. 659 */ 659 */ 660 660 if (aim_tlv_gettlv(itl, 0x0001, 1)) 661 661 msg = aim_tlv_getstr(itl, 0x0001, 1); 662 662 663 aim_tlvlist_free(&itl); 663 aim_tlvlist_free(&itl); 664 664 } 665 665
Note: See TracChangeset
for help on using the changeset viewer.