00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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
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
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