comparison src/protocols/oscar/bos.c @ 2246:933346315b9b

[gaim-migrate @ 2256] heh. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 09 Sep 2001 10:07:14 +0000
parents 424a40f12a6c
children c41030cfed76
comparison
equal deleted inserted replaced
2245:31157c54fe6e 2246:933346315b9b
10 * The group permission mask allows you to keep users of a certain 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 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. 12 * a bitwise OR of all the user classes you want to see you.
13 * 13 *
14 */ 14 */
15 faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *sess, 15 faim_export int aim_bos_setgroupperm(aim_session_t *sess, aim_conn_t *conn, fu32_t mask)
16 struct aim_conn_t *conn,
17 u_long mask)
18 { 16 {
19 return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask); 17 return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask);
20 } 18 }
21 19
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) 20 static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
23 { 21 {
24 aim_rxcallback_t userfunc; 22 aim_rxcallback_t userfunc;
25 int ret = 0; 23 aim_tlvlist_t *tlvlist;
26 struct aim_tlvlist_t *tlvlist; 24 fu16_t maxpermits = 0, maxdenies = 0;
27 unsigned short maxpermits = 0, maxdenies = 0; 25 int ret = 0;
28 26
29 /* 27 /*
30 * TLVs follow 28 * TLVs follow
31 */ 29 */
32 if (!(tlvlist = aim_readtlvchain(data, datalen))) 30 tlvlist = aim_readtlvchain(bs);
33 return 0;
34 31
35 /* 32 /*
36 * TLV type 0x0001: Maximum number of buddies on permit list. 33 * TLV type 0x0001: Maximum number of buddies on permit list.
37 */ 34 */
38 if (aim_gettlv(tlvlist, 0x0001, 1)) 35 if (aim_gettlv(tlvlist, 0x0001, 1))
39 maxpermits = aim_gettlv16(tlvlist, 0x0001, 1); 36 maxpermits = aim_gettlv16(tlvlist, 0x0001, 1);
40 37
41 /* 38 /*
42 * TLV type 0x0002: Maximum number of buddies on deny list. 39 * TLV type 0x0002: Maximum number of buddies on deny list.
43 * 40 */
44 */ 41 if (aim_gettlv(tlvlist, 0x0002, 1))
45 if (aim_gettlv(tlvlist, 0x0002, 1)) 42 maxdenies = aim_gettlv16(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 43
51 aim_freetlvchain(&tlvlist); 44 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
45 ret = userfunc(sess, rx, maxpermits, maxdenies);
52 46
53 return ret; 47 aim_freetlvchain(&tlvlist);
48
49 return ret;
54 } 50 }
55 51
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) 52 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
57 { 53 {
58 54
59 if (snac->subtype == 0x0003) 55 if (snac->subtype == 0x0003)
60 return rights(sess, mod, rx, snac, data, datalen); 56 return rights(sess, mod, rx, snac, bs);
61 57
62 return 0; 58 return 0;
63 } 59 }
64 60
65 faim_internal int bos_modfirst(struct aim_session_t *sess, aim_module_t *mod) 61 faim_internal int bos_modfirst(aim_session_t *sess, aim_module_t *mod)
66 { 62 {
67 63
68 mod->family = 0x0009; 64 mod->family = 0x0009;
69 mod->version = 0x0000; 65 mod->version = 0x0000;
70 mod->flags = 0; 66 mod->flags = 0;
71 strncpy(mod->name, "bos", sizeof(mod->name)); 67 strncpy(mod->name, "bos", sizeof(mod->name));
72 mod->snachandler = snachandler; 68 mod->snachandler = snachandler;
73 69
74 return 0; 70 return 0;
75 } 71 }
72
73