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
00030 namespace ICQ2000 {
00031
00032
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
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
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