]>
Commit | Line | Data |
---|---|---|
9f1a4013 | 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 | */ | |
d410cf58 | 15 | faim_export int aim_bos_setgroupperm(aim_session_t *sess, aim_conn_t *conn, fu32_t mask) |
9f1a4013 | 16 | { |
d410cf58 | 17 | return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask); |
9f1a4013 | 18 | } |
19 | ||
d410cf58 | 20 | static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
9f1a4013 | 21 | { |
d410cf58 | 22 | aim_rxcallback_t userfunc; |
23 | aim_tlvlist_t *tlvlist; | |
24 | fu16_t maxpermits = 0, maxdenies = 0; | |
25 | int ret = 0; | |
26 | ||
27 | /* | |
28 | * TLVs follow | |
29 | */ | |
30 | tlvlist = aim_readtlvchain(bs); | |
31 | ||
32 | /* | |
33 | * TLV type 0x0001: Maximum number of buddies on permit list. | |
34 | */ | |
35 | if (aim_gettlv(tlvlist, 0x0001, 1)) | |
36 | maxpermits = aim_gettlv16(tlvlist, 0x0001, 1); | |
37 | ||
38 | /* | |
39 | * TLV type 0x0002: Maximum number of buddies on deny list. | |
40 | */ | |
41 | if (aim_gettlv(tlvlist, 0x0002, 1)) | |
42 | maxdenies = aim_gettlv16(tlvlist, 0x0002, 1); | |
43 | ||
44 | if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) | |
45 | ret = userfunc(sess, rx, maxpermits, maxdenies); | |
46 | ||
47 | aim_freetlvchain(&tlvlist); | |
48 | ||
49 | return ret; | |
9f1a4013 | 50 | } |
51 | ||
d410cf58 | 52 | static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
9f1a4013 | 53 | { |
54 | ||
d410cf58 | 55 | if (snac->subtype == 0x0003) |
56 | return rights(sess, mod, rx, snac, bs); | |
9f1a4013 | 57 | |
d410cf58 | 58 | return 0; |
9f1a4013 | 59 | } |
60 | ||
d410cf58 | 61 | faim_internal int bos_modfirst(aim_session_t *sess, aim_module_t *mod) |
9f1a4013 | 62 | { |
63 | ||
d410cf58 | 64 | mod->family = 0x0009; |
65 | mod->version = 0x0000; | |
66 | mod->flags = 0; | |
67 | strncpy(mod->name, "bos", sizeof(mod->name)); | |
68 | mod->snachandler = snachandler; | |
9f1a4013 | 69 | |
d410cf58 | 70 | return 0; |
9f1a4013 | 71 | } |
d410cf58 | 72 | |
73 |