]> andersk Git - libfaim.git/blob - src/bos.c
- Mon Sep 3 18:48:26 PDT 2001
[libfaim.git] / src / bos.c
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 int aim_bos_setgroupperm(aim_session_t *sess, aim_conn_t *conn, fu32_t mask)
16 {
17         return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask);
18 }
19
20 static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
21 {
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;  
50 }
51
52 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
53 {
54
55         if (snac->subtype == 0x0003)
56                 return rights(sess, mod, rx, snac, bs);
57
58         return 0;
59 }
60
61 faim_internal int bos_modfirst(aim_session_t *sess, aim_module_t *mod)
62 {
63
64         mod->family = 0x0009;
65         mod->version = 0x0000;
66         mod->flags = 0;
67         strncpy(mod->name, "bos", sizeof(mod->name));
68         mod->snachandler = snachandler;
69
70         return 0;
71 }
72
73
This page took 0.805121 seconds and 5 git commands to generate.