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

SNAC-MSG.h

00001 /*
00002  * SNAC - Message Family
00003  *
00004  * Copyright (C) 2001 Barnaby Gray <barnaby@beedesign.co.uk>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00019  *
00020  */
00021 
00022 #ifndef SNAC_MSG_H
00023 #define SNAC_MSG_H
00024 
00025 #include <libicq2000/SNAC-base.h>
00026 #include <libicq2000/ICQ.h>
00027 #include <libicq2000/UserInfoBlock.h>
00028 #include <libicq2000/ICBMCookie.h>
00029 #include <libicq2000/Capabilities.h>
00030 
00031 namespace ICQ2000 {
00032 
00033   // Messages (Family 0x0004)
00034   const unsigned short SNAC_MSG_Error = 0x0001;
00035   const unsigned short SNAC_MSG_AddICBMParameter = 0x0002;
00036   const unsigned short SNAC_MSG_Send = 0x0006;
00037   const unsigned short SNAC_MSG_Message = 0x0007;
00038   const unsigned short SNAC_MSG_MessageACK = 0x000b;
00039   const unsigned short SNAC_MSG_OfflineUser = 0x000c;
00040 
00041   // ----------------- Message (Family 0x0004) SNACs --------------
00042   
00043   class MsgFamilySNAC : virtual public SNAC {
00044    public:
00045     unsigned short Family() const { return SNAC_FAM_MSG; }
00046   };
00047 
00048   class MsgAddICBMParameterSNAC : public MsgFamilySNAC, public OutSNAC {
00049    protected:
00050     void OutputBody(Buffer& b) const;
00051     
00052    public:
00053     MsgAddICBMParameterSNAC() { }
00054 
00055     unsigned short Subtype() const { return SNAC_MSG_AddICBMParameter; }
00056   };
00057 
00058   class MsgSendSNAC : public MsgFamilySNAC, public OutSNAC {
00059    protected:
00060     ICQSubType *m_icqsubtype;
00061     bool m_advanced;
00062     unsigned short m_seqnum;
00063     ICBMCookie m_cookie;
00064     Capabilities m_dest_capabilities;
00065 
00066     void OutputBody(Buffer& b) const;
00067 
00068    public:
00069     MsgSendSNAC(ICQSubType *icqsubtype, bool ad = false);
00070 
00071     void setSeqNum(unsigned short sn);
00072     void setAdvanced(bool ad);
00073     void setICBMCookie(const ICBMCookie& c);
00074     void set_capabilities(const Capabilities& c);
00075 
00076     unsigned short Subtype() const { return SNAC_MSG_Send; }
00077   };
00078 
00079   class MessageSNAC : public MsgFamilySNAC, public InSNAC {
00080    protected:
00081 
00082     // General fields
00083     UserInfoBlock m_userinfo;
00084     ICQSubType *m_icqsubtype;
00085     ICBMCookie m_cookie;
00086 
00087     void ParseBody(Buffer& b);
00088 
00089    public:
00090     MessageSNAC();
00091     ~MessageSNAC();
00092 
00093     ICQSubType* getICQSubType() const { return m_icqsubtype; }
00094     ICQSubType* grabICQSubType();
00095     ICBMCookie getICBMCookie() const { return m_cookie; }
00096 
00097     unsigned short Subtype() const { return SNAC_MSG_Message; }
00098   };
00099 
00100   class MessageACKSNAC : public MsgFamilySNAC, public InSNAC, public OutSNAC {
00101    protected:
00102     ICBMCookie m_cookie;
00103     UINICQSubType *m_icqsubtype;
00104 
00105     void ParseBody(Buffer& b);
00106     void OutputBody(Buffer& b) const;
00107 
00108    public:
00109     MessageACKSNAC();
00110     MessageACKSNAC(ICBMCookie c, UINICQSubType *icqsubtype);
00111     ~MessageACKSNAC();
00112 
00113     UINICQSubType* getICQSubType() const { return m_icqsubtype; }  
00114     ICBMCookie getICBMCookie() const { return m_cookie; }
00115 
00116     unsigned short Subtype() const { return SNAC_MSG_MessageACK; }
00117   };
00118 
00119   class MessageOfflineUserSNAC : public MsgFamilySNAC, public InSNAC {
00120    protected:
00121     ICBMCookie m_cookie;
00122     unsigned short m_channel;
00123     unsigned int m_uin;
00124 
00125     void ParseBody(Buffer& b);
00126 
00127    public:
00128 
00129     ICBMCookie getICBMCookie() const { return m_cookie; }
00130     unsigned short getChannel() const { return m_channel; }
00131 
00132     unsigned short Subtype() const { return SNAC_MSG_OfflineUser; }
00133     unsigned int getUIN() const { return m_uin; }  
00134   };
00135 
00136 }
00137 
00138 #endif

Generated on Sat Jul 20 16:59:08 2002 for libicq2000 by doxygen1.2.16