00001 /*************************************************************************** 00002 * Copyright (C) 2005 by yunfan * 00003 * yunfan_zg@163.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef LIBEVAEXTRAINFO_H 00021 #define LIBEVAEXTRAINFO_H 00022 00023 #include "evapacket.h" 00024 #include <string> 00025 #include <map> 00026 00027 class RequestExtraInfoPacket : public OutPacket 00028 { 00029 public: 00030 RequestExtraInfoPacket(); 00031 RequestExtraInfoPacket(const unsigned short offset); 00032 RequestExtraInfoPacket(const RequestExtraInfoPacket &rhs); 00033 virtual ~RequestExtraInfoPacket() {}; 00034 00035 OutPacket * copy() { return new RequestExtraInfoPacket(*this);} 00036 RequestExtraInfoPacket &operator=(const RequestExtraInfoPacket &rhs); 00037 00038 void setOffset(const unsigned short offset) { mOffset = offset; } 00039 const short getOffset() const { return mOffset; } 00040 protected: 00041 virtual int putBody(unsigned char *buf); 00042 private: 00043 unsigned short mOffset; 00044 }; 00045 00046 class RequestExtraInfoReplyPacket : public InPacket 00047 { 00048 public: 00049 RequestExtraInfoReplyPacket() {} 00050 RequestExtraInfoReplyPacket(unsigned char *buf, int len); 00051 RequestExtraInfoReplyPacket(const RequestExtraInfoReplyPacket &rhs); 00052 virtual ~RequestExtraInfoReplyPacket(){}; 00053 00054 const unsigned char getReplyCode() const { return mReplyCode; } 00055 const short getOffset() const { return mOffset; } 00056 const std::map<int, unsigned int> &getMembers() const { return mMembers; } 00057 00058 RequestExtraInfoReplyPacket &operator=(const RequestExtraInfoReplyPacket &rhs); 00059 protected: 00060 virtual void parseBody() ; 00061 private: 00062 unsigned char mReplyCode; 00063 unsigned short mOffset; 00064 std::map<int, unsigned int> mMembers; 00065 }; 00066 00067 class SignaturePacket : public OutPacket 00068 { 00069 public: 00070 SignaturePacket() {} 00071 SignaturePacket(const unsigned char type); // type includes QQ_SIGNATURE_MODIFY, QQ_SIGNATURE_DELETE and QQ_SIGNATURE_REQUEST 00072 SignaturePacket(const SignaturePacket &rhs); 00073 virtual ~SignaturePacket() {}; 00074 00075 SignaturePacket &operator=(const SignaturePacket &rhs); 00076 00077 void setType(const unsigned char type) { mType = type; } 00078 const unsigned char getType() const { return mType; } 00079 const std::map<int, int> &getMembers() const { return mMembers; } 00080 void setMembers(const std::map<int, int> &list) { mMembers = list; } 00081 00082 void setSignature( const std::string sig) { mSignature = sig; } 00083 const std::string &getSignature() const { return mSignature; } 00084 protected: 00085 virtual int putBody(unsigned char *buf); 00086 private: 00087 unsigned char mType; 00088 00089 std::string mSignature; 00090 std::map<int, int> mMembers; 00091 }; 00092 00093 typedef struct SignatureElement{ 00094 int lastModifyTime; 00095 std::string signature; 00096 } SignatureElement; 00097 00098 class SignatureReplyPacket : public InPacket 00099 { 00100 public: 00101 SignatureReplyPacket() {} 00102 SignatureReplyPacket(unsigned char *buf, int len); 00103 SignatureReplyPacket(const SignatureReplyPacket &rhs); 00104 virtual ~SignatureReplyPacket(){}; 00105 00106 const unsigned char getType() const { return mType; } 00107 const char getReplyCode() const { return mReplyCode; } 00108 const bool isChangeAccepted() const { return mReplyCode == 0x00; } 00109 00110 const int nextStartID() const { return mNextStartId; } 00111 const std::map<int, SignatureElement> &getMembers() const { return mMembers; } 00112 00113 SignatureReplyPacket &operator=(const SignatureReplyPacket &rhs); 00114 protected: 00115 virtual void parseBody() ; 00116 private: 00117 unsigned char mType; 00118 unsigned char mReplyCode; 00119 int mNextStartId; 00120 std::map<int, SignatureElement> mMembers; 00121 }; 00122 00123 #endif 00124
1.4.4