Main Page   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 
00030 namespace ICQ2000 {
00031 
00032   // Messages (Family 0x0004)
00033   const unsigned short SNAC_MSG_Error = 0x0001;
00034   const unsigned short SNAC_MSG_AddICBMParameter = 0x0002;
00035   const unsigned short SNAC_MSG_Send = 0x0006;
00036   const unsigned short SNAC_MSG_Message = 0x0007;
00037   const unsigned short SNAC_MSG_MessageACK = 0x000b;
00038   const unsigned short SNAC_MSG_OfflineUser = 0x000c;
00039 
00040   // ----------------- Message (Family 0x0004) SNACs --------------
00041   
00042   class MsgFamilySNAC : virtual public SNAC {
00043    public:
00044     unsigned short Family() const { return SNAC_FAM_MSG; }
00045   };
00046 
00047   class MsgAddICBMParameterSNAC : public MsgFamilySNAC, public OutSNAC {
00048    protected:
00049     void OutputBody(Buffer& b) const;
00050     
00051    public:
00052     MsgAddICBMParameterSNAC() { }
00053 
00054     unsigned short Subtype() const { return SNAC_MSG_AddICBMParameter; }
00055   };
00056 
00057   class MsgSendSNAC : public MsgFamilySNAC, public OutSNAC {
00058    protected:
00059     ICQSubType *m_icqsubtype;
00060     bool m_advanced;
00061     unsigned short m_seqnum;
00062     ICBMCookie m_cookie;
00063 
00064     void OutputBody(Buffer& b) const;
00065 
00066    public:
00067     MsgSendSNAC(ICQSubType *icqsubtype, bool ad = false);
00068 
00069     void setSeqNum(unsigned short sn);
00070     void setAdvanced(bool ad);
00071     void setICBMCookie(const ICBMCookie& c);
00072 
00073     unsigned short Subtype() const { return SNAC_MSG_Send; }
00074   };
00075 
00076   class MessageSNAC : public MsgFamilySNAC, public InSNAC {
00077    protected:
00078 
00079     // General fields
00080     UserInfoBlock m_userinfo;
00081     ICQSubType *m_icqsubtype;
00082     ICBMCookie m_cookie;
00083 
00084     void ParseBody(Buffer& b);
00085 
00086    public:
00087     MessageSNAC();
00088     ~MessageSNAC();
00089 
00090     ICQSubType* getICQSubType() const { return m_icqsubtype; }
00091     ICQSubType* grabICQSubType();
00092     ICBMCookie getICBMCookie() const { return m_cookie; }
00093 
00094     unsigned short Subtype() const { return SNAC_MSG_Message; }
00095   };
00096 
00097   class MessageACKSNAC : public MsgFamilySNAC, public InSNAC, public OutSNAC {
00098    protected:
00099     ICBMCookie m_cookie;
00100     UINICQSubType *m_icqsubtype;
00101 
00102     void ParseBody(Buffer& b);
00103     void OutputBody(Buffer& b) const;
00104 
00105    public:
00106     MessageACKSNAC();
00107     MessageACKSNAC(ICBMCookie c, UINICQSubType *icqsubtype);
00108     ~MessageACKSNAC();
00109 
00110     UINICQSubType* getICQSubType() const { return m_icqsubtype; }  
00111     ICBMCookie getICBMCookie() const { return m_cookie; }
00112 
00113     unsigned short Subtype() const { return SNAC_MSG_MessageACK; }
00114   };
00115 
00116   class MessageOfflineUserSNAC : public MsgFamilySNAC, public InSNAC {
00117    protected:
00118     ICBMCookie m_cookie;
00119     unsigned short m_channel;
00120     unsigned int m_uin;
00121 
00122     void ParseBody(Buffer& b);
00123 
00124    public:
00125 
00126     ICBMCookie getICBMCookie() const { return m_cookie; }
00127     unsigned short getChannel() const { return m_channel; }
00128 
00129     unsigned short Subtype() const { return SNAC_MSG_OfflineUser; }
00130     unsigned int getUIN() const { return m_uin; }  
00131   };
00132 
00133 }
00134 
00135 #endif

Generated on Tue Jan 15 12:24:35 2002 for libicq2000 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001