annotate libfaim/bos.c @ 2062:caba1f59801e

[gaim-migrate @ 2072] What's up. Nothing to see here, move right along. :) committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Tue, 26 Jun 2001 21:53:09 +0000
parents 109cacf1ff97
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
1
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
2 #define FAIM_INTERNAL
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
3 #include <aim.h>
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
4
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
5 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
6 * aim_bos_setgroupperm(mask)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
7 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
8 * Set group permisson mask. Normally 0x1f (all classes).
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
9 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
10 * The group permission mask allows you to keep users of a certain
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
11 * class or classes from talking to you. The mask should be
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
12 * a bitwise OR of all the user classes you want to see you.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
13 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
14 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
15 faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *sess,
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
16 struct aim_conn_t *conn,
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
17 u_long mask)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
18 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
19 return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
20 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
21
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
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)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
23 {
1839
109cacf1ff97 [gaim-migrate @ 1849]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
24 aim_rxcallback_t userfunc;
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
25 int ret = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
26 struct aim_tlvlist_t *tlvlist;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
27 unsigned short maxpermits = 0, maxdenies = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
28
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
29 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
30 * TLVs follow
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
31 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
32 if (!(tlvlist = aim_readtlvchain(data, datalen)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
33 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
34
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
35 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
36 * TLV type 0x0001: Maximum number of buddies on permit list.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
37 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
38 if (aim_gettlv(tlvlist, 0x0001, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
39 maxpermits = aim_gettlv16(tlvlist, 0x0001, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
40
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
41 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
42 * TLV type 0x0002: Maximum number of buddies on deny list.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
43 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
44 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
45 if (aim_gettlv(tlvlist, 0x0002, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
46 maxdenies = aim_gettlv16(tlvlist, 0x0002, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
47
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
48 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
49 ret = userfunc(sess, rx, maxpermits, maxdenies);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
50
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
51 aim_freetlvchain(&tlvlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
52
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
53 return ret;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
54 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
55
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
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)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
57 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
58
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
59 if (snac->subtype == 0x0003)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
60 return rights(sess, mod, rx, snac, data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
61
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
62 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
63 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
64
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
65 faim_internal int bos_modfirst(struct aim_session_t *sess, aim_module_t *mod)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
66 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
67
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
68 mod->family = 0x0009;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
69 mod->version = 0x0000;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
70 mod->flags = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
71 strncpy(mod->name, "bos", sizeof(mod->name));
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
72 mod->snachandler = snachandler;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
73
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
74 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
75 }