Tue, 27 Mar 2001 00:51:09 +0000
[gaim-migrate @ 1659]
Update libfaim.
| 1649 | 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 unsigned long aim_bos_setgroupperm(struct aim_session_t *sess, | |
| 16 | struct aim_conn_t *conn, | |
| 17 | u_long mask) | |
| 18 | { | |
| 19 | return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask); | |
| 20 | } | |
| 21 | ||
| 22 | faim_export int aim_0001_0020(struct aim_session_t *sess, struct aim_conn_t *conn) | |
| 23 | { | |
| 24 | struct command_tx_struct *tx; | |
| 25 | int i = 0; | |
| 26 | ||
| 27 | if (!sess || !conn) | |
| 28 | return 0; | |
| 29 | ||
| 30 | if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10+2+16))) | |
| 31 | return -1; | |
| 32 | ||
| 33 | tx->lock = 1; | |
| 34 | ||
| 35 | /* Hummm.... */ | |
| 36 | i = aim_putsnac(tx->data, 0x0001, 0x0020, 0x0000, sess->snac_nextid++); | |
| 37 | i += aimutil_put16(tx->data+i, 0x0010); | |
| 38 | i += aimutil_put32(tx->data+i, 0x469bf5e7); | |
| 39 | i += aimutil_put32(tx->data+i, 0x01a19b28); | |
| 40 | i += aimutil_put32(tx->data+i, 0x54c59ea6); | |
| 41 | i += aimutil_put32(tx->data+i, 0x88eae54a); | |
| 42 | ||
| 43 | tx->commandlen = i; | |
| 44 | tx->lock = 0; | |
| 45 | aim_tx_enqueue(sess, tx); | |
| 46 | ||
| 47 | return 0; | |
| 48 | } | |
| 49 | ||
| 50 | 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) | |
| 51 | { | |
| 52 | rxcallback_t userfunc; | |
| 53 | int ret = 0; | |
| 54 | struct aim_tlvlist_t *tlvlist; | |
| 55 | unsigned short maxpermits = 0, maxdenies = 0; | |
| 56 | ||
| 57 | /* | |
| 58 | * TLVs follow | |
| 59 | */ | |
| 60 | if (!(tlvlist = aim_readtlvchain(data, datalen))) | |
| 61 | return 0; | |
| 62 | ||
| 63 | /* | |
| 64 | * TLV type 0x0001: Maximum number of buddies on permit list. | |
| 65 | */ | |
| 66 | if (aim_gettlv(tlvlist, 0x0001, 1)) | |
| 67 | maxpermits = aim_gettlv16(tlvlist, 0x0001, 1); | |
| 68 | ||
| 69 | /* | |
| 70 | * TLV type 0x0002: Maximum number of buddies on deny list. | |
| 71 | * | |
| 72 | */ | |
| 73 | if (aim_gettlv(tlvlist, 0x0002, 1)) | |
| 74 | maxdenies = aim_gettlv16(tlvlist, 0x0002, 1); | |
| 75 | ||
| 76 | if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) | |
| 77 | ret = userfunc(sess, rx, maxpermits, maxdenies); | |
| 78 | ||
| 79 | aim_freetlvchain(&tlvlist); | |
| 80 | ||
| 81 | return ret; | |
| 82 | } | |
| 83 | ||
| 84 | 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) | |
| 85 | { | |
| 86 | ||
| 87 | if (snac->subtype == 0x0003) | |
| 88 | return rights(sess, mod, rx, snac, data, datalen); | |
| 89 | ||
| 90 | return 0; | |
| 91 | } | |
| 92 | ||
| 93 | faim_internal int bos_modfirst(struct aim_session_t *sess, aim_module_t *mod) | |
| 94 | { | |
| 95 | ||
| 96 | mod->family = 0x0009; | |
| 97 | mod->version = 0x0000; | |
| 98 | mod->flags = 0; | |
| 99 | strncpy(mod->name, "bos", sizeof(mod->name)); | |
| 100 | mod->snachandler = snachandler; | |
| 101 | ||
| 102 | return 0; | |
| 103 | } |