source: protocols/oscar/bos.c @ 0b1ae59

Last change on this file since 0b1ae59 was 5ebff60, checked in by dequis <dx@…>, at 2015-02-20T22:50:54Z

Reindent everything to K&R style with tabs

Used uncrustify, with the configuration file in ./doc/uncrustify.cfg

Commit author set to "Indent <please@…>" so that it's easier to
skip while doing git blame.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1#include <aim.h>
2#include "bos.h"
3
4/* Request BOS rights (group 9, type 2) */
5int aim_bos_reqrights(aim_session_t *sess, aim_conn_t *conn)
6{
7        return aim_genericreq_n(sess, conn, 0x0009, 0x0002);
8}
9
10/* BOS Rights (group 9, type 3) */
11static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
12{
13        aim_rxcallback_t userfunc;
14        aim_tlvlist_t *tlvlist;
15        guint16 maxpermits = 0, maxdenies = 0;
16        int ret = 0;
17
18        /*
19         * TLVs follow
20         */
21        tlvlist = aim_readtlvchain(bs);
22
23        /*
24         * TLV type 0x0001: Maximum number of buddies on permit list.
25         */
26        if (aim_gettlv(tlvlist, 0x0001, 1)) {
27                maxpermits = aim_gettlv16(tlvlist, 0x0001, 1);
28        }
29
30        /*
31         * TLV type 0x0002: Maximum number of buddies on deny list.
32         */
33        if (aim_gettlv(tlvlist, 0x0002, 1)) {
34                maxdenies = aim_gettlv16(tlvlist, 0x0002, 1);
35        }
36
37        if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
38                ret = userfunc(sess, rx, maxpermits, maxdenies);
39        }
40
41        aim_freetlvchain(&tlvlist);
42
43        return ret;
44}
45
46/*
47 * Set group permisson mask (group 9, type 4)
48 *
49 * Normally 0x1f (all classes).
50 *
51 * The group permission mask allows you to keep users of a certain
52 * class or classes from talking to you.  The mask should be
53 * a bitwise OR of all the user classes you want to see you.
54 *
55 */
56int aim_bos_setgroupperm(aim_session_t *sess, aim_conn_t *conn, guint32 mask)
57{
58        return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask);
59}
60
61static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
62{
63
64        if (snac->subtype == 0x0003) {
65                return rights(sess, mod, rx, snac, bs);
66        }
67
68        return 0;
69}
70
71int bos_modfirst(aim_session_t *sess, aim_module_t *mod)
72{
73
74        mod->family = 0x0009;
75        mod->version = 0x0001;
76        mod->toolid = 0x0110;
77        mod->toolversion = 0x0629;
78        mod->flags = 0;
79        strncpy(mod->name, "bos", sizeof(mod->name));
80        mod->snachandler = snachandler;
81
82        return 0;
83}
84
85
Note: See TracBrowser for help on using the repository browser.