Annotation of ChivanetAimPidgin/oscarprpl/src/c/family_bos.c, revision 1.1.1.1

1.1       snw         1: /*
                      2:  * Purple's oscar protocol plugin
                      3:  * This file is the legal property of its developers.
                      4:  * Please see the AUTHORS file distributed alongside this file.
                      5:  *
                      6:  * This library is free software; you can redistribute it and/or
                      7:  * modify it under the terms of the GNU Lesser General Public
                      8:  * License as published by the Free Software Foundation; either
                      9:  * version 2 of the License, or (at your option) any later version.
                     10:  *
                     11:  * This library is distributed in the hope that it will be useful,
                     12:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
                     13:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                     14:  * Lesser General Public License for more details.
                     15:  *
                     16:  * You should have received a copy of the GNU Lesser General Public
                     17:  * License along with this library; if not, write to the Free Software
                     18:  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
                     19: */
                     20: 
                     21: /*
                     22:  * Family 0x0009 - Basic Oscar Service.
                     23:  *
                     24:  * The functionality of this family has been replaced by SSI.
                     25:  */
                     26: 
                     27: #include "oscar.h"
                     28: 
                     29: #include <string.h>
                     30: 
                     31: /* Subtype 0x0002 - Request BOS rights. */
                     32: void
                     33: aim_bos_reqrights(OscarData *od, FlapConnection *conn)
                     34: {
                     35:        aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_BOS, 0x0002);
                     36: }
                     37: 
                     38: /* Subtype 0x0003 - BOS Rights. */
                     39: static int rights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
                     40: {
                     41:        aim_rxcallback_t userfunc;
                     42:        GSList *tlvlist;
                     43:        guint16 maxpermits = 0, maxdenies = 0;
                     44:        int ret = 0;
                     45: 
                     46:        /*
                     47:         * TLVs follow
                     48:         */
                     49:        tlvlist = aim_tlvlist_read(bs);
                     50: 
                     51:        /*
                     52:         * TLV type 0x0001: Maximum number of buddies on permit list.
                     53:         */
                     54:        if (aim_tlv_gettlv(tlvlist, 0x0001, 1))
                     55:                maxpermits = aim_tlv_get16(tlvlist, 0x0001, 1);
                     56: 
                     57:        /*
                     58:         * TLV type 0x0002: Maximum number of buddies on deny list.
                     59:         */
                     60:        if (aim_tlv_gettlv(tlvlist, 0x0002, 1))
                     61:                maxdenies = aim_tlv_get16(tlvlist, 0x0002, 1);
                     62: 
                     63:        if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
                     64:                ret = userfunc(od, conn, frame, maxpermits, maxdenies);
                     65: 
                     66:        aim_tlvlist_free(tlvlist);
                     67: 
                     68:        return ret;
                     69: }
                     70: 
                     71: static int
                     72: snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
                     73: {
                     74:        if (snac->subtype == 0x0003)
                     75:                return rights(od, conn, mod, frame, snac, bs);
                     76: 
                     77:        return 0;
                     78: }
                     79: 
                     80: int
                     81: bos_modfirst(OscarData *od, aim_module_t *mod)
                     82: {
                     83:        mod->family = SNAC_FAMILY_BOS;
                     84:        mod->version = 0x0001;
                     85:        mod->toolid = 0x0110;
                     86:        mod->toolversion = 0x0629;
                     87:        mod->flags = 0;
                     88:        strncpy(mod->name, "bos", sizeof(mod->name));
                     89:        mod->snachandler = snachandler;
                     90: 
                     91:        return 0;
                     92: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>