Changeset e374dee for libfaim/chat.c
- Timestamp:
- Oct 10, 2003, 5:12:30 PM (21 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- fe6f1d3
- Parents:
- f4d0975
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfaim/chat.c
r862371b re374dee 6 6 #define FAIM_INTERNAL 7 7 #include <aim.h> 8 9 #include <string.h> 8 10 9 11 /* Stored in the ->priv of chat connections */ … … 205 207 aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); 206 208 207 208 209 /* 209 210 * Cookie 210 211 */ 211 for (i = 0; i < sizeof(ckstr); i++)212 aimutil_put8(ckstr, (fu8_t) rand());212 for (i = 0; i < 8; i++) 213 ckstr[i] = (fu8_t)rand(); 213 214 214 215 /* XXX should be uncached by an unwritten 'invite accept' handler */ … … 225 226 free(priv); 226 227 227 for (i = 0; i < sizeof(ckstr); i++) 228 aimbs_put8(&fr->data, ckstr[i]); 229 230 231 /* 232 * Channel (2) 233 */ 234 aimbs_put16(&fr->data, 0x0002); 235 236 /* 237 * Dest sn 238 */ 239 aimbs_put8(&fr->data, strlen(sn)); 240 aimbs_putraw(&fr->data, sn, strlen(sn)); 228 /* ICBM Header */ 229 aimbs_putraw(&fr->data, ckstr, 8); /* Cookie */ 230 aimbs_put16(&fr->data, 0x0002); /* Channel */ 231 aimbs_put8(&fr->data, strlen(sn)); /* Screename length */ 232 aimbs_putraw(&fr->data, sn, strlen(sn)); /* Screenname */ 241 233 242 234 /* … … 346 338 347 339 while (curoccupant < usercount) 348 aim_ extractuserinfo(sess, &occbs, &userinfo[curoccupant++]);340 aim_info_extract(sess, &occbs, &userinfo[curoccupant++]); 349 341 } 350 342 … … 424 416 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { 425 417 ret = userfunc(sess, 426 rx, 418 rx, 427 419 &roominfo, 428 420 roomname, 429 421 usercount, 430 userinfo, 422 userinfo, 431 423 roomdesc, 432 424 flags, … … 439 431 440 432 free(roominfo.name); 433 434 while (usercount > 0) 435 aim_info_free(&userinfo[--usercount]); 436 441 437 free(userinfo); 442 438 free(roomname); … … 457 453 curcount++; 458 454 userinfo = realloc(userinfo, curcount * sizeof(aim_userinfo_t)); 459 aim_ extractuserinfo(sess, bs, &userinfo[curcount-1]);455 aim_info_extract(sess, bs, &userinfo[curcount-1]); 460 456 } 461 457 … … 463 459 ret = userfunc(sess, rx, curcount, userinfo); 464 460 461 aim_info_free(userinfo); 465 462 free(userinfo); 466 463 … … 498 495 aim_putsnac(&fr->data, 0x000e, 0x0005, 0x0000, snacid); 499 496 500 501 /* 502 * Generate a random message cookie. 497 /* 498 * Cookie 503 499 * 504 500 * XXX mkcookie should generate the cookie and cache it in one 505 501 * operation to preserve uniqueness. 506 * 507 */ 508 for (i = 0; i < sizeof(ckstr); i++) 509 aimutil_put8(ckstr+i, (fu8_t) rand()); 502 */ 503 for (i = 0; i < 8; i++) 504 ckstr[i] = (fu8_t)rand(); 510 505 511 506 cookie = aim_mkcookie(ckstr, AIM_COOKIETYPE_CHAT, NULL); … … 514 509 aim_cachecookie(sess, cookie); 515 510 516 for (i = 0; i < sizeof(ckstr); i++) 517 aimbs_put8(&fr->data, ckstr[i]); 518 519 520 /* 521 * Channel ID. 522 */ 523 aimbs_put16(&fr->data, 0x0003); 524 511 /* ICBM Header */ 512 aimbs_putraw(&fr->data, ckstr, 8); /* Cookie */ 513 aimbs_put16(&fr->data, 0x0003); /* Channel */ 525 514 526 515 /* … … 544 533 * SubTLV: Type 1: Message 545 534 */ 546 aim_addtlvtochain_raw(&itl, 0x0001, strlen(msg), msg);535 aim_addtlvtochain_raw(&itl, 0x0001, msglen, msg); 547 536 548 537 /* … … 644 633 645 634 aim_bstream_init(&tbs, userinfotlv->value, userinfotlv->length); 646 aim_ extractuserinfo(sess, &tbs, &userinfo);635 aim_info_extract(sess, &tbs, &userinfo); 647 636 } 648 637 … … 678 667 ret = userfunc(sess, rx, &userinfo, msg); 679 668 669 aim_info_free(&userinfo); 680 670 free(cookie); 681 671 free(msg); … … 703 693 mod->family = 0x000e; 704 694 mod->version = 0x0001; 705 mod->toolid = 0x00 04; /* XXX this doesn't look right */706 mod->toolversion = 0x0 001; /* nor does this */695 mod->toolid = 0x0010; 696 mod->toolversion = 0x0629; 707 697 mod->flags = 0; 708 698 strncpy(mod->name, "chat", sizeof(mod->name));
Note: See TracChangeset
for help on using the changeset viewer.