Mercurial > pidgin
comparison libfaim/aim_misc.c @ 889:e1da6a6ec42b
[gaim-migrate @ 899]
Oscar works again
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 12 Sep 2000 20:21:36 +0000 |
parents | 88f8f98de02d |
children | fa2feef25e1e |
comparison
equal
deleted
inserted
replaced
888:38ffd1faa31a | 889:e1da6a6ec42b |
---|---|
19 * Should set your current idle time in seconds. Idealy, OSCAR should | 19 * Should set your current idle time in seconds. Idealy, OSCAR should |
20 * do this for us. But, it doesn't. The client must call this to set idle | 20 * do this for us. But, it doesn't. The client must call this to set idle |
21 * time. | 21 * time. |
22 * | 22 * |
23 */ | 23 */ |
24 u_long aim_bos_setidle(struct aim_session_t *sess, | 24 faim_export unsigned long aim_bos_setidle(struct aim_session_t *sess, |
25 struct aim_conn_t *conn, | 25 struct aim_conn_t *conn, |
26 u_long idletime) | 26 u_long idletime) |
27 { | 27 { |
28 return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime); | 28 return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime); |
29 } | 29 } |
30 | 30 |
31 | 31 |
55 * - Block the users below: Send an AIM_VISIBILITYCHANGE_DENYADD with | 55 * - Block the users below: Send an AIM_VISIBILITYCHANGE_DENYADD with |
56 * the list of users to be blocked | 56 * the list of users to be blocked |
57 * | 57 * |
58 * | 58 * |
59 */ | 59 */ |
60 u_long aim_bos_changevisibility(struct aim_session_t *sess, | 60 faim_export unsigned long aim_bos_changevisibility(struct aim_session_t *sess, |
61 struct aim_conn_t *conn, | 61 struct aim_conn_t *conn, |
62 int changetype, char *denylist) | 62 int changetype, |
63 char *denylist) | |
63 { | 64 { |
64 struct command_tx_struct *newpacket; | 65 struct command_tx_struct *newpacket; |
65 int packlen = 0; | 66 int packlen = 0; |
66 u_short subtype; | 67 u_short subtype; |
67 | 68 |
132 * TODO: Clean this up. | 133 * TODO: Clean this up. |
133 * | 134 * |
134 * XXX: I can't stress the TODO enough. | 135 * XXX: I can't stress the TODO enough. |
135 * | 136 * |
136 */ | 137 */ |
137 u_long aim_bos_setbuddylist(struct aim_session_t *sess, | 138 faim_export unsigned long aim_bos_setbuddylist(struct aim_session_t *sess, |
138 struct aim_conn_t *conn, | 139 struct aim_conn_t *conn, |
139 char *buddy_list) | 140 char *buddy_list) |
140 { | 141 { |
141 int i, j; | 142 int i, j; |
142 | 143 |
143 struct command_tx_struct *newpacket; | 144 struct command_tx_struct *newpacket; |
144 | 145 |
204 * | 205 * |
205 * Gives BOS your profile. | 206 * Gives BOS your profile. |
206 * | 207 * |
207 * | 208 * |
208 */ | 209 */ |
209 u_long aim_bos_setprofile(struct aim_session_t *sess, | 210 faim_export unsigned long aim_bos_setprofile(struct aim_session_t *sess, |
210 struct aim_conn_t *conn, | 211 struct aim_conn_t *conn, |
211 char *profile, | 212 char *profile, |
212 char *awaymsg, | 213 char *awaymsg, |
213 unsigned int caps) | 214 unsigned short caps) |
214 { | 215 { |
215 struct command_tx_struct *newpacket; | 216 struct command_tx_struct *newpacket; |
216 int i = 0, tmp, caplen; | 217 int i = 0, tmp, caplen; |
217 | 218 |
218 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 1152+strlen(profile)+1+(awaymsg?strlen(awaymsg):0)))) | 219 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 1152+strlen(profile)+1+(awaymsg?strlen(awaymsg):0)))) |
251 * The group permission mask allows you to keep users of a certain | 252 * The group permission mask allows you to keep users of a certain |
252 * class or classes from talking to you. The mask should be | 253 * class or classes from talking to you. The mask should be |
253 * a bitwise OR of all the user classes you want to see you. | 254 * a bitwise OR of all the user classes you want to see you. |
254 * | 255 * |
255 */ | 256 */ |
256 u_long aim_bos_setgroupperm(struct aim_session_t *sess, | 257 faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *sess, |
257 struct aim_conn_t *conn, | 258 struct aim_conn_t *conn, |
258 u_long mask) | 259 u_long mask) |
259 { | 260 { |
260 return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask); | 261 return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask); |
261 } | 262 } |
262 | 263 |
263 int aim_parse_bosrights(struct aim_session_t *sess, | 264 faim_internal int aim_parse_bosrights(struct aim_session_t *sess, |
264 struct command_rx_struct *command, ...) | 265 struct command_rx_struct *command, ...) |
265 { | 266 { |
266 rxcallback_t userfunc = NULL; | 267 rxcallback_t userfunc = NULL; |
267 int ret=1; | 268 int ret=1; |
268 struct aim_tlvlist_t *tlvlist; | 269 struct aim_tlvlist_t *tlvlist; |
269 struct aim_tlv_t *tlv; | 270 struct aim_tlv_t *tlv; |
305 * Send Client Ready. | 306 * Send Client Ready. |
306 * | 307 * |
307 * TODO: Dynamisize. | 308 * TODO: Dynamisize. |
308 * | 309 * |
309 */ | 310 */ |
310 u_long aim_bos_clientready(struct aim_session_t *sess, | 311 faim_export unsigned long aim_bos_clientready(struct aim_session_t *sess, |
311 struct aim_conn_t *conn) | 312 struct aim_conn_t *conn) |
312 { | 313 { |
313 u_char command_2[] = { | 314 u_char command_2[] = { |
314 /* placeholders for dynamic data */ | 315 /* placeholders for dynamic data */ |
315 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 316 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
316 0xff, 0xff, | 317 0xff, 0xff, |
317 /* real data */ | 318 /* real data */ |
318 0x00, 0x01, | 319 0x00, 0x01, |
319 0x00, 0x03, | 320 0x00, 0x03, |
320 0x00, 0x04, | 321 0x00, 0x04, |
321 0x07, 0xda, | 322 0x06, 0x86, /* the good ones */ |
323 #if 0 | |
324 0x07, 0xda, /* DUPLE OF DEATH! */ | |
325 #endif | |
322 | 326 |
323 0x00, 0x02, | 327 0x00, 0x02, |
324 0x00, 0x01, | 328 0x00, 0x01, |
325 0x00, 0x04, | 329 0x00, 0x04, |
326 0x00, 0x01, | 330 0x00, 0x01, |
378 | 382 |
379 /* | 383 /* |
380 * Request Rate Information. | 384 * Request Rate Information. |
381 * | 385 * |
382 */ | 386 */ |
383 u_long aim_bos_reqrate(struct aim_session_t *sess, | 387 faim_export unsigned long aim_bos_reqrate(struct aim_session_t *sess, |
384 struct aim_conn_t *conn) | 388 struct aim_conn_t *conn) |
385 { | 389 { |
386 return aim_genericreq_n(sess, conn, 0x0001, 0x0006); | 390 return aim_genericreq_n(sess, conn, 0x0001, 0x0006); |
387 } | 391 } |
388 | 392 |
389 /* | 393 /* |
390 * Rate Information Response Acknowledge. | 394 * Rate Information Response Acknowledge. |
391 * | 395 * |
392 */ | 396 */ |
393 u_long aim_bos_ackrateresp(struct aim_session_t *sess, | 397 faim_export unsigned long aim_bos_ackrateresp(struct aim_session_t *sess, |
394 struct aim_conn_t *conn) | 398 struct aim_conn_t *conn) |
395 { | 399 { |
396 struct command_tx_struct *newpacket; | 400 struct command_tx_struct *newpacket; |
397 int packlen = 20, i=0; | 401 int packlen = 20, i=0; |
398 | 402 |
399 if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen))) | 403 if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen))) |
405 i += aimutil_put16(newpacket->data+i, 0x0001); | 409 i += aimutil_put16(newpacket->data+i, 0x0001); |
406 i += aimutil_put16(newpacket->data+i, 0x0002); | 410 i += aimutil_put16(newpacket->data+i, 0x0002); |
407 i += aimutil_put16(newpacket->data+i, 0x0003); | 411 i += aimutil_put16(newpacket->data+i, 0x0003); |
408 i += aimutil_put16(newpacket->data+i, 0x0004); | 412 i += aimutil_put16(newpacket->data+i, 0x0004); |
409 i += aimutil_put16(newpacket->data+i, 0x0005); | 413 i += aimutil_put16(newpacket->data+i, 0x0005); |
410 | 414 |
415 newpacket->commandlen = i; | |
416 newpacket->lock = 0; | |
417 | |
411 aim_tx_enqueue(sess, newpacket); | 418 aim_tx_enqueue(sess, newpacket); |
412 | 419 |
413 return (sess->snac_nextid); | 420 return (sess->snac_nextid); |
414 } | 421 } |
415 | 422 |
420 * | 427 * |
421 * Bit 1: Allows other AIM users to see how long you've been idle. | 428 * Bit 1: Allows other AIM users to see how long you've been idle. |
422 * Bit 2: Allows other AIM users to see how long you've been a member. | 429 * Bit 2: Allows other AIM users to see how long you've been a member. |
423 * | 430 * |
424 */ | 431 */ |
425 u_long aim_bos_setprivacyflags(struct aim_session_t *sess, | 432 faim_export unsigned long aim_bos_setprivacyflags(struct aim_session_t *sess, |
426 struct aim_conn_t *conn, | 433 struct aim_conn_t *conn, |
427 u_long flags) | 434 u_long flags) |
428 { | 435 { |
429 return aim_genericreq_l(sess, conn, 0x0001, 0x0014, &flags); | 436 return aim_genericreq_l(sess, conn, 0x0001, 0x0014, &flags); |
430 } | 437 } |
431 | 438 |
432 /* | 439 /* |
434 * | 441 * |
435 * Requests the current user's information. Can't go generic on this one | 442 * Requests the current user's information. Can't go generic on this one |
436 * because aparently it uses SNAC flags. | 443 * because aparently it uses SNAC flags. |
437 * | 444 * |
438 */ | 445 */ |
439 u_long aim_bos_reqpersonalinfo(struct aim_session_t *sess, | 446 faim_export unsigned long aim_bos_reqpersonalinfo(struct aim_session_t *sess, |
440 struct aim_conn_t *conn) | 447 struct aim_conn_t *conn) |
441 { | 448 { |
442 return aim_genericreq_n(sess, conn, 0x0001, 0x000e); | 449 return aim_genericreq_n(sess, conn, 0x0001, 0x000e); |
443 } | 450 } |
444 | 451 |
445 u_long aim_setversions(struct aim_session_t *sess, | 452 faim_export unsigned long aim_setversions(struct aim_session_t *sess, |
446 struct aim_conn_t *conn) | 453 struct aim_conn_t *conn) |
447 { | 454 { |
448 struct command_tx_struct *newpacket; | 455 struct command_tx_struct *newpacket; |
449 int i; | 456 int i; |
450 | 457 |
451 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10 + (4*12)))) | 458 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10 + (4*12)))) |
495 for (j = 0; j < 0x10; j++) { | 502 for (j = 0; j < 0x10; j++) { |
496 i += aimutil_put16(newpacket->data+i, j); /* family */ | 503 i += aimutil_put16(newpacket->data+i, j); /* family */ |
497 i += aimutil_put16(newpacket->data+i, 0x0003); /* version */ | 504 i += aimutil_put16(newpacket->data+i, 0x0003); /* version */ |
498 } | 505 } |
499 #endif | 506 #endif |
507 | |
508 newpacket->commandlen = i; | |
500 newpacket->lock = 0; | 509 newpacket->lock = 0; |
501 aim_tx_enqueue(sess, newpacket); | 510 aim_tx_enqueue(sess, newpacket); |
502 | 511 |
503 return (sess->snac_nextid++); | 512 return (sess->snac_nextid++); |
504 } | 513 } |
508 * aim_bos_reqservice(serviceid) | 517 * aim_bos_reqservice(serviceid) |
509 * | 518 * |
510 * Service request. | 519 * Service request. |
511 * | 520 * |
512 */ | 521 */ |
513 u_long aim_bos_reqservice(struct aim_session_t *sess, | 522 faim_export unsigned long aim_bos_reqservice(struct aim_session_t *sess, |
514 struct aim_conn_t *conn, | 523 struct aim_conn_t *conn, |
515 u_short serviceid) | 524 u_short serviceid) |
516 { | 525 { |
517 return aim_genericreq_s(sess, conn, 0x0001, 0x0004, &serviceid); | 526 return aim_genericreq_s(sess, conn, 0x0001, 0x0004, &serviceid); |
518 } | 527 } |
522 * | 531 * |
523 * No-op. WinAIM sends these every 4min or so to keep | 532 * No-op. WinAIM sends these every 4min or so to keep |
524 * the connection alive. Its not real necessary. | 533 * the connection alive. Its not real necessary. |
525 * | 534 * |
526 */ | 535 */ |
527 u_long aim_bos_nop(struct aim_session_t *sess, | 536 faim_export unsigned long aim_bos_nop(struct aim_session_t *sess, |
528 struct aim_conn_t *conn) | 537 struct aim_conn_t *conn) |
529 { | 538 { |
530 return aim_genericreq_n(sess, conn, 0x0001, 0x0016); | 539 return aim_genericreq_n(sess, conn, 0x0001, 0x0016); |
531 } | 540 } |
532 | 541 |
533 /* | 542 /* |
534 * aim_bos_reqrights() | 543 * aim_bos_reqrights() |
535 * | 544 * |
536 * Request BOS rights. | 545 * Request BOS rights. |
537 * | 546 * |
538 */ | 547 */ |
539 u_long aim_bos_reqrights(struct aim_session_t *sess, | 548 faim_export unsigned long aim_bos_reqrights(struct aim_session_t *sess, |
540 struct aim_conn_t *conn) | 549 struct aim_conn_t *conn) |
541 { | 550 { |
542 return aim_genericreq_n(sess, conn, 0x0009, 0x0002); | 551 return aim_genericreq_n(sess, conn, 0x0009, 0x0002); |
543 } | 552 } |
544 | 553 |
545 /* | 554 /* |
546 * aim_bos_reqbuddyrights() | 555 * aim_bos_reqbuddyrights() |
547 * | 556 * |
548 * Request Buddy List rights. | 557 * Request Buddy List rights. |
549 * | 558 * |
550 */ | 559 */ |
551 u_long aim_bos_reqbuddyrights(struct aim_session_t *sess, | 560 faim_export unsigned long aim_bos_reqbuddyrights(struct aim_session_t *sess, |
552 struct aim_conn_t *conn) | 561 struct aim_conn_t *conn) |
553 { | 562 { |
554 return aim_genericreq_n(sess, conn, 0x0003, 0x0002); | 563 return aim_genericreq_n(sess, conn, 0x0003, 0x0002); |
555 } | 564 } |
556 | 565 |
557 /* | 566 /* |
562 * AIM_WARN_ANON anonymous | 571 * AIM_WARN_ANON anonymous |
563 * | 572 * |
564 * returns -1 on error (couldn't alloc packet), next snacid on success. | 573 * returns -1 on error (couldn't alloc packet), next snacid on success. |
565 * | 574 * |
566 */ | 575 */ |
567 int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon) | 576 faim_export int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon) |
568 { | 577 { |
569 struct command_tx_struct *newpacket; | 578 struct command_tx_struct *newpacket; |
570 int curbyte; | 579 int curbyte; |
571 | 580 |
572 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, strlen(destsn)+13))) | 581 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, strlen(destsn)+13))) |
590 aim_tx_enqueue(sess, newpacket); | 599 aim_tx_enqueue(sess, newpacket); |
591 | 600 |
592 return (sess->snac_nextid++); | 601 return (sess->snac_nextid++); |
593 } | 602 } |
594 | 603 |
595 | |
596 | |
597 /* | 604 /* |
598 * aim_debugconn_sendconnect() | 605 * aim_debugconn_sendconnect() |
599 * | 606 * |
600 * For aimdebugd. If you don't know what it is, you don't want to. | 607 * For aimdebugd. If you don't know what it is, you don't want to. |
601 */ | 608 */ |
602 u_long aim_debugconn_sendconnect(struct aim_session_t *sess, | 609 faim_export unsigned long aim_debugconn_sendconnect(struct aim_session_t *sess, |
603 struct aim_conn_t *conn) | 610 struct aim_conn_t *conn) |
604 { | 611 { |
605 return aim_genericreq_n(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEBUGCONN_CONNECT); | 612 return aim_genericreq_n(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEBUGCONN_CONNECT); |
606 } | 613 } |
607 | 614 |
608 /* | 615 /* |
615 * I had one big function that handled all three cases, but then it broke | 622 * I had one big function that handled all three cases, but then it broke |
616 * and I split it up into three. But then I fixed it. I just never went | 623 * and I split it up into three. But then I fixed it. I just never went |
617 * back to the single. I don't see any advantage to doing it either way. | 624 * back to the single. I don't see any advantage to doing it either way. |
618 * | 625 * |
619 */ | 626 */ |
620 u_long aim_genericreq_n(struct aim_session_t *sess, | 627 faim_internal unsigned long aim_genericreq_n(struct aim_session_t *sess, |
621 struct aim_conn_t *conn, | 628 struct aim_conn_t *conn, |
622 u_short family, u_short subtype) | 629 u_short family, u_short subtype) |
623 { | 630 { |
624 struct command_tx_struct *newpacket; | 631 struct command_tx_struct *newpacket; |
625 | 632 |
626 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10))) | 633 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10))) |
627 return 0; | 634 return 0; |
636 | 643 |
637 /* | 644 /* |
638 * | 645 * |
639 * | 646 * |
640 */ | 647 */ |
641 u_long aim_genericreq_l(struct aim_session_t *sess, | 648 faim_internal unsigned long aim_genericreq_l(struct aim_session_t *sess, |
642 struct aim_conn_t *conn, | 649 struct aim_conn_t *conn, |
643 u_short family, u_short subtype, u_long *longdata) | 650 u_short family, u_short subtype, |
651 u_long *longdata) | |
644 { | 652 { |
645 struct command_tx_struct *newpacket; | 653 struct command_tx_struct *newpacket; |
646 u_long newlong; | 654 u_long newlong; |
647 | 655 |
648 /* If we don't have data, there's no reason to use this function */ | 656 /* If we don't have data, there's no reason to use this function */ |
662 | 670 |
663 aim_tx_enqueue(sess, newpacket); | 671 aim_tx_enqueue(sess, newpacket); |
664 return (sess->snac_nextid++); | 672 return (sess->snac_nextid++); |
665 } | 673 } |
666 | 674 |
667 u_long aim_genericreq_s(struct aim_session_t *sess, | 675 faim_internal unsigned long aim_genericreq_s(struct aim_session_t *sess, |
668 struct aim_conn_t *conn, | 676 struct aim_conn_t *conn, |
669 u_short family, u_short subtype, u_short *shortdata) | 677 u_short family, u_short subtype, |
678 u_short *shortdata) | |
670 { | 679 { |
671 struct command_tx_struct *newpacket; | 680 struct command_tx_struct *newpacket; |
672 u_short newshort; | 681 u_short newshort; |
673 | 682 |
674 /* If we don't have data, there's no reason to use this function */ | 683 /* If we don't have data, there's no reason to use this function */ |
694 * aim_bos_reqlocaterights() | 703 * aim_bos_reqlocaterights() |
695 * | 704 * |
696 * Request Location services rights. | 705 * Request Location services rights. |
697 * | 706 * |
698 */ | 707 */ |
699 u_long aim_bos_reqlocaterights(struct aim_session_t *sess, | 708 faim_export unsigned long aim_bos_reqlocaterights(struct aim_session_t *sess, |
700 struct aim_conn_t *conn) | 709 struct aim_conn_t *conn) |
701 { | 710 { |
702 return aim_genericreq_n(sess, conn, 0x0002, 0x0002); | 711 return aim_genericreq_n(sess, conn, 0x0002, 0x0002); |
703 } | 712 } |
704 | 713 |
705 /* | 714 /* |
706 * aim_bos_reqicbmparaminfo() | 715 * aim_bos_reqicbmparaminfo() |
707 * | 716 * |
708 * Request ICBM parameter information. | 717 * Request ICBM parameter information. |
709 * | 718 * |
710 */ | 719 */ |
711 u_long aim_bos_reqicbmparaminfo(struct aim_session_t *sess, | 720 faim_export unsigned long aim_bos_reqicbmparaminfo(struct aim_session_t *sess, |
712 struct aim_conn_t *conn) | 721 struct aim_conn_t *conn) |
713 { | 722 { |
714 return aim_genericreq_n(sess, conn, 0x0004, 0x0004); | 723 return aim_genericreq_n(sess, conn, 0x0004, 0x0004); |
715 } | 724 } |
716 | 725 |
717 /* | 726 /* |
718 * Add ICBM parameter? Huh? | 727 * Add ICBM parameter? Huh? |
719 */ | 728 */ |
720 unsigned long aim_addicbmparam(struct aim_session_t *sess, | 729 faim_export unsigned long aim_addicbmparam(struct aim_session_t *sess, |
721 struct aim_conn_t *conn) | 730 struct aim_conn_t *conn) |
722 { | 731 { |
723 struct command_tx_struct *newpacket; | 732 struct command_tx_struct *newpacket; |
724 int packlen = 10+16, i=0; | 733 int packlen = 10+16, i=0; |
725 | 734 |
726 if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen))) | 735 if(!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, packlen))) |