Mercurial > pidgin.yaz
comparison libfaim/aim_rxhandlers.c @ 1302:4c5c2fcb83cd
[gaim-migrate @ 1312]
libfaim stuff
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 19 Dec 2000 03:08:06 +0000 |
parents | d8eaf65ca9c3 |
children |
comparison
equal
deleted
inserted
replaced
1301:e973ef7a8a87 | 1302:4c5c2fcb83cd |
---|---|
478 break; | 478 break; |
479 default: | 479 default: |
480 workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_BUD, AIM_CB_BUD_DEFAULT, workingPtr); | 480 workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_BUD, AIM_CB_BUD_DEFAULT, workingPtr); |
481 } | 481 } |
482 break; | 482 break; |
483 case 0x0004: /* Family: Messeging */ | 483 case 0x0004: /* Family: Messaging */ |
484 switch (subtype) { | 484 switch (subtype) { |
485 case 0x0001: | 485 case 0x0001: |
486 workingPtr->handled = aim_parse_msgerror_middle(sess, workingPtr); | 486 workingPtr->handled = aim_parse_msgerror_middle(sess, workingPtr); |
487 break; | 487 break; |
488 case 0x0005: | 488 case 0x0005: |
529 workingPtr->handled = aim_parse_generalerrs(sess, workingPtr); | 529 workingPtr->handled = aim_parse_generalerrs(sess, workingPtr); |
530 else if (subtype == 0x0002) | 530 else if (subtype == 0x0002) |
531 workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x000b, 0x0002, workingPtr); | 531 workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x000b, 0x0002, workingPtr); |
532 else | 532 else |
533 workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_STS, AIM_CB_STS_DEFAULT, workingPtr); | 533 workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_STS, AIM_CB_STS_DEFAULT, workingPtr); |
534 break; | |
535 } | |
536 case 0x0013: { | |
537 printf("lalala: 0x%04x/0x%04x\n", family, subtype); | |
534 break; | 538 break; |
535 } | 539 } |
536 case AIM_CB_FAM_SPECIAL: | 540 case AIM_CB_FAM_SPECIAL: |
537 workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr); | 541 workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr); |
538 break; | 542 break; |
653 ret = userfunc(sess, command, type, sn); | 657 ret = userfunc(sess, command, type, sn); |
654 | 658 |
655 return ret; | 659 return ret; |
656 } | 660 } |
657 | 661 |
662 /* | |
663 * The Rate Limiting System, An Abridged Guide to Nonsense. | |
664 * | |
665 * OSCAR defines several 'rate classes'. Each class has seperate | |
666 * rate limiting properties (limit level, alert level, disconnect | |
667 * level, etc), and a set of SNAC family/type pairs associated with | |
668 * it. The rate classes, their limiting properties, and the definitions | |
669 * of which SNACs are belong to which class, are defined in the | |
670 * Rate Response packet at login to each host. | |
671 * | |
672 * Logically, all rate offenses within one class count against further | |
673 * offenses for other SNACs in the same class (ie, sending messages | |
674 * too fast will limit the number of user info requests you can send, | |
675 * since those two SNACs are in the same rate class). | |
676 * | |
677 * Since the rate classes are defined dynamically at login, the values | |
678 * below may change. But they seem to be fairly constant. | |
679 * | |
680 * Currently, BOS defines five rate classes, with the commonly used | |
681 * members as follows... | |
682 * | |
683 * Rate class 0x0001: | |
684 * - Everything thats not in any of the other classes | |
685 * | |
686 * Rate class 0x0002: | |
687 * - Buddy list add/remove | |
688 * - Permit list add/remove | |
689 * - Deny list add/remove | |
690 * | |
691 * Rate class 0x0003: | |
692 * - User information requests | |
693 * - Outgoing ICBMs | |
694 * | |
695 * Rate class 0x0004: | |
696 * - A few unknowns: 2/9, 2/b, and f/2 | |
697 * | |
698 * Rate class 0x0005: | |
699 * - Chat room create | |
700 * - Outgoing chat ICBMs | |
701 * | |
702 * The only other thing of note is that class 5 (chat) has slightly looser | |
703 * limiting properties than class 3 (normal messages). But thats just a | |
704 * small bit of trivia for you. | |
705 * | |
706 * The last thing that needs to be learned about the rate limiting | |
707 * system is how the actual numbers relate to the passing of time. This | |
708 * seems to be a big mystery. | |
709 * | |
710 */ | |
658 faim_internal int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command) | 711 faim_internal int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command) |
659 { | 712 { |
660 rxcallback_t userfunc = NULL; | 713 rxcallback_t userfunc = NULL; |
661 int ret = 1; | 714 int ret = 1; |
662 int i; | 715 int i; |
663 int code; | 716 int code; |
664 unsigned long parmid, windowsize, clear, alert, limit, disconnect; | 717 unsigned long rateclass, windowsize, clear, alert, limit, disconnect; |
665 unsigned long currentavg, maxavg; | 718 unsigned long currentavg, maxavg; |
666 | 719 |
667 i = 10; | 720 i = 10; |
668 | 721 |
669 code = aimutil_get16(command->data+i); | 722 code = aimutil_get16(command->data+i); |
670 i += 2; | 723 i += 2; |
671 | 724 |
672 parmid = aimutil_get16(command->data+i); | 725 rateclass = aimutil_get16(command->data+i); |
673 i += 2; | 726 i += 2; |
674 | 727 |
675 windowsize = aimutil_get32(command->data+i); | 728 windowsize = aimutil_get32(command->data+i); |
676 i += 4; | 729 i += 4; |
677 clear = aimutil_get32(command->data+i); | 730 clear = aimutil_get32(command->data+i); |
686 i += 4; | 739 i += 4; |
687 maxavg = aimutil_get32(command->data+i); | 740 maxavg = aimutil_get32(command->data+i); |
688 i += 4; | 741 i += 4; |
689 | 742 |
690 if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x000a))) | 743 if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x000a))) |
691 ret = userfunc(sess, command, code, parmid, windowsize, clear, alert, limit, disconnect, currentavg, maxavg); | 744 ret = userfunc(sess, command, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg, maxavg); |
692 | 745 |
693 return ret; | 746 return ret; |
694 } | 747 } |
695 | 748 |
696 faim_internal int aim_parse_evilnotify_middle(struct aim_session_t *sess, struct command_rx_struct *command) | 749 faim_internal int aim_parse_evilnotify_middle(struct aim_session_t *sess, struct command_rx_struct *command) |
697 { | 750 { |
698 rxcallback_t userfunc = NULL; | 751 rxcallback_t userfunc = NULL; |
699 int ret = 1, pos; | 752 int ret = 1; |
700 char *sn = NULL; | 753 int i; |
701 | 754 unsigned short newevil; |
702 if(command->commandlen < 12) /* a warning level dec sends this */ | 755 struct aim_userinfo_s userinfo; |
703 return 1; | 756 |
704 | 757 i = 10; |
705 if ((pos = aimutil_get8(command->data+ 12)) > MAXSNLEN) | 758 newevil = aimutil_get16(command->data+10); |
706 return 1; | 759 i += 2; |
707 | 760 |
708 if(!(sn = (char *)calloc(1, pos+1))) | 761 memset(&userinfo, 0, sizeof(struct aim_userinfo_s)); |
709 return 1; | 762 if (command->commandlen-i) |
710 | 763 i += aim_extractuserinfo(command->data+i, &userinfo); |
711 memcpy(sn, command->data+13, pos); | |
712 | 764 |
713 if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x0010))) | 765 if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x0010))) |
714 ret = userfunc(sess, command, sn); | 766 ret = userfunc(sess, command, newevil, &userinfo); |
715 | 767 |
716 free(sn); | |
717 | |
718 return ret; | 768 return ret; |
719 } | 769 } |
720 | 770 |
721 faim_internal int aim_parsemotd_middle(struct aim_session_t *sess, | 771 faim_internal int aim_parsemotd_middle(struct aim_session_t *sess, |
722 struct command_rx_struct *command, ...) | 772 struct command_rx_struct *command, ...) |
904 * | 954 * |
905 */ | 955 */ |
906 faim_internal int aim_parse_generalerrs(struct aim_session_t *sess, | 956 faim_internal int aim_parse_generalerrs(struct aim_session_t *sess, |
907 struct command_rx_struct *command, ...) | 957 struct command_rx_struct *command, ...) |
908 { | 958 { |
909 u_short family; | 959 unsigned short family; |
910 u_short subtype; | 960 unsigned short subtype; |
961 int ret = 1; | |
962 int error = 0; | |
963 rxcallback_t userfunc = NULL; | |
911 | 964 |
912 family = aimutil_get16(command->data+0); | 965 family = aimutil_get16(command->data+0); |
913 subtype= aimutil_get16(command->data+2); | 966 subtype= aimutil_get16(command->data+2); |
914 | 967 |
915 switch(family) | 968 if (command->commandlen > 10) |
916 { | 969 error = aimutil_get16(command->data+10); |
917 default: | 970 |
918 /* Unknown family */ | 971 if ((userfunc = aim_callhandler(command->conn, family, subtype))) |
919 return aim_callhandler_noparam(sess, command->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_UNKNOWN, command); | 972 ret = userfunc(sess, command, error); |
920 } | 973 |
921 | 974 return ret; |
922 return 1; | 975 } |
923 } | 976 |
924 | 977 |
925 | 978 |
926 |