Fri, 27 Apr 2001 22:21:53 +0000
[gaim-migrate @ 1773]
la la la
| 1649 | 1 | |
| 2 | #define FAIM_INTERNAL | |
| 3 | #include <aim.h> | |
| 4 | ||
| 5 | /* | |
| 6 | * aim_bos_setgroupperm(mask) | |
| 7 | * | |
| 8 | * Set group permisson mask. Normally 0x1f (all classes). | |
| 9 | * | |
| 10 | * The group permission mask allows you to keep users of a certain | |
| 11 | * class or classes from talking to you. The mask should be | |
| 12 | * a bitwise OR of all the user classes you want to see you. | |
| 13 | * | |
| 14 | */ | |
| 15 | faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *sess, | |
| 16 | struct aim_conn_t *conn, | |
| 17 | u_long mask) | |
| 18 | { | |
| 19 | return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask); | |
| 20 | } | |
| 21 | ||
| 22 | static int rights(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen) | |
| 23 | { | |
| 24 | rxcallback_t userfunc; | |
| 25 | int ret = 0; | |
| 26 | struct aim_tlvlist_t *tlvlist; | |
| 27 | unsigned short maxpermits = 0, maxdenies = 0; | |
| 28 | ||
| 29 | /* | |
| 30 | * TLVs follow | |
| 31 | */ | |
| 32 | if (!(tlvlist = aim_readtlvchain(data, datalen))) | |
| 33 | return 0; | |
| 34 | ||
| 35 | /* | |
| 36 | * TLV type 0x0001: Maximum number of buddies on permit list. | |
| 37 | */ | |
| 38 | if (aim_gettlv(tlvlist, 0x0001, 1)) | |
| 39 | maxpermits = aim_gettlv16(tlvlist, 0x0001, 1); | |
| 40 | ||
| 41 | /* | |
| 42 | * TLV type 0x0002: Maximum number of buddies on deny list. | |
| 43 | * | |
| 44 | */ | |
| 45 | if (aim_gettlv(tlvlist, 0x0002, 1)) | |
| 46 | maxdenies = aim_gettlv16(tlvlist, 0x0002, 1); | |
| 47 | ||
| 48 | if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) | |
| 49 | ret = userfunc(sess, rx, maxpermits, maxdenies); | |
| 50 | ||
| 51 | aim_freetlvchain(&tlvlist); | |
| 52 | ||
| 53 | return ret; | |
| 54 | } | |
| 55 | ||
| 56 | static int snachandler(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen) | |
| 57 | { | |
| 58 | ||
| 59 | if (snac->subtype == 0x0003) | |
| 60 | return rights(sess, mod, rx, snac, data, datalen); | |
| 61 | ||
| 62 | return 0; | |
| 63 | } | |
| 64 | ||
| 65 | faim_internal int bos_modfirst(struct aim_session_t *sess, aim_module_t *mod) | |
| 66 | { | |
| 67 | ||
| 68 | mod->family = 0x0009; | |
| 69 | mod->version = 0x0000; | |
| 70 | mod->flags = 0; | |
| 71 | strncpy(mod->name, "bos", sizeof(mod->name)); | |
| 72 | mod->snachandler = snachandler; | |
| 73 | ||
| 74 | return 0; | |
| 75 | } |