Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

Capabilities.h

00001 /*
00002  * Capabilities
00003  * Some handling of the mysterious capabilities byte strings
00004  *
00005  * Copyright (C) 2002 Barnaby Gray <barnaby@beedesign.co.uk>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020  *
00021  */
00022 
00023 #ifndef CAPABILITIES_H
00024 #define CAPABILITIES_H
00025 
00026 #include <libicq2000/buffer.h>
00027 
00028 #include <set>
00029 
00030 namespace ICQ2000 {
00031 
00032   class Capabilities {
00033    public:
00034 
00035     /*
00036      * A lot of these flags are AIM specific - so we're unlikely to
00037      * see/use them unless the other end is a 'libfaim pretending to
00038      * be ICQ' client.
00039      */
00040     enum Flag {
00041       Chat            = 0,
00042       Voice           = 1,
00043       SendFile        = 2,
00044       ICQ             = 3,
00045       IMImage         = 4,
00046       BuddyIcon       = 5,
00047       SaveStocks      = 6,
00048       GetFile         = 7,
00049       ICQServerRelay  = 8,
00050       Games           = 9,
00051       Games2          = 10,
00052       SendBuddyList   = 11,
00053       ICQRTF          = 12,
00054       ICQUnknown      = 13,
00055       Empty           = 14,
00056       TrillianCrypt   = 15,
00057       APInfo          = 16,
00058       ICQUnknown2     = 17
00059     };
00060 
00061    private:
00062     static const unsigned int sizeof_cap = 16;
00063 
00064     struct Block {
00065       Flag flag;
00066       unsigned char data[sizeof_cap];
00067     };
00068     static const Block caps[];
00069 
00070     std::set<Flag> m_flags;
00071 
00072    public:
00073     Capabilities();
00074     
00075     void default_icq2000_capabilities();
00076     void default_icq2002_capabilities();
00077 
00078     void clear();
00079     void set_capability_flag(Flag f);
00080     void clear_capability_flag(Flag f);
00081     bool has_capability_flag(Flag f) const;
00082 
00083     void Parse(Buffer& b, unsigned short len);
00084     void Output(Buffer& b) const;
00085 
00086     unsigned short get_length() const;
00087 
00088     bool get_accept_adv_msgs() const;
00089   };
00090 
00091 }
00092 
00093 #endif

Generated on Fri Apr 26 23:48:14 2002 for libicq2000 by doxygen1.2.15