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 LIBEVAADDFRIEND_H 00021 #define LIBEVAADDFRIEND_H 00022 00023 #include "evapacket.h" 00024 #ifndef WIN32 00025 #include <inttypes.h> 00026 #endif 00027 #include <string> 00028 00029 class AddFriendPacket : public OutPacket 00030 { 00031 public: 00032 AddFriendPacket(); 00033 AddFriendPacket(const int id); 00034 AddFriendPacket(const AddFriendPacket &rhs); 00035 virtual ~AddFriendPacket() {}; 00036 00037 OutPacket *copy(){return new AddFriendPacket(*this);} 00038 AddFriendPacket &operator=( const AddFriendPacket &rhs ); 00039 00040 void setAddQQ(const int id) { qqNum = id; } 00041 const int getAddQQ() const { return qqNum; } 00042 protected: 00043 virtual int putBody(unsigned char* buf); 00044 private: 00045 int qqNum; 00046 }; 00047 00048 class AddFriendReplyPacket : public InPacket 00049 { 00050 public: 00051 AddFriendReplyPacket() {} 00052 AddFriendReplyPacket(unsigned char* buf, int len); 00053 AddFriendReplyPacket(const AddFriendReplyPacket &rhs); 00054 virtual ~AddFriendReplyPacket() {}; 00055 00056 InPacket *copy() { return new AddFriendReplyPacket(*this); } 00057 AddFriendReplyPacket &operator=(const AddFriendReplyPacket &rhs); 00058 00059 const int getMyQQ() const { return myQQ; } 00060 const uint8_t getReplyCode() const { return replyCode; } 00061 protected: 00062 virtual void parseBody(); 00063 private: 00064 uint8_t replyCode; 00065 int myQQ; 00066 }; 00067 00068 class AddFriendAuthPacket : public OutPacket 00069 { 00070 public: 00071 AddFriendAuthPacket(); 00072 AddFriendAuthPacket(const int id, const uint8_t type); 00073 AddFriendAuthPacket( AddFriendAuthPacket& rhs); 00074 00075 virtual ~AddFriendAuthPacket() {}; 00076 00077 00078 virtual OutPacket* copy(){return new AddFriendAuthPacket(*this);} 00079 AddFriendAuthPacket &operator=(const AddFriendAuthPacket &rhs); 00080 00081 const std::string getMessage() const { return message; } 00082 void setMessage(const std::string &msg) { message = msg; } 00083 00084 const int getBuddyQQ() const { return buddyQQNum; } 00085 void setBuddyQQ(const int id) { buddyQQNum = id; }; 00086 00087 const uint8_t getType() const { return type; } 00088 void setType(const uint8_t type) { this->type = type; } 00089 protected: 00090 virtual int putBody(unsigned char* buf); 00091 00092 private: 00093 static const unsigned char DIVIDER = 0x1f; 00094 uint8_t type; 00095 int buddyQQNum; 00096 std::string message; 00097 }; 00098 00099 class AddFriendAuthReplyPacket : public InPacket 00100 { 00101 public: 00102 AddFriendAuthReplyPacket() {} 00103 AddFriendAuthReplyPacket(unsigned char* buf, int len); 00104 AddFriendAuthReplyPacket(const AddFriendAuthReplyPacket &rhs); 00105 virtual ~AddFriendAuthReplyPacket() {}; 00106 00107 virtual InPacket* copy(){return new AddFriendAuthReplyPacket(*this);} 00108 AddFriendAuthReplyPacket &operator=(const AddFriendAuthReplyPacket &rhs); 00109 00110 const uint8_t getReplyCode() const { return replyCode; } 00111 const bool isSentOK() const; 00112 00113 protected: 00114 virtual void parseBody(); 00115 private: 00116 uint8_t replyCode; 00117 }; 00118 00119 class DeleteFriendPacket : public OutPacket 00120 { 00121 public: 00122 DeleteFriendPacket(); 00123 DeleteFriendPacket(const int id); 00124 DeleteFriendPacket(const DeleteFriendPacket &rhs); 00125 virtual ~DeleteFriendPacket() {}; 00126 00127 OutPacket *copy(){return new DeleteFriendPacket(*this);} 00128 DeleteFriendPacket &operator=(const DeleteFriendPacket &rhs); 00129 00130 void setBuddyQQ(int id) { buddyQQNum = id; } 00131 const int getBuddyQQ() const { return buddyQQNum; } 00132 protected: 00133 virtual int putBody(unsigned char* buf); 00134 private: 00135 int buddyQQNum; 00136 }; 00137 00138 class DeleteFriendReplyPacket : public InPacket 00139 { 00140 public: 00141 DeleteFriendReplyPacket() {} 00142 DeleteFriendReplyPacket(unsigned char* buf, int len); 00143 DeleteFriendReplyPacket( const DeleteFriendReplyPacket &rhs); 00144 virtual ~DeleteFriendReplyPacket() {}; 00145 00146 virtual InPacket* copy(){return new DeleteFriendReplyPacket(*this);} 00147 DeleteFriendReplyPacket &operator=(const DeleteFriendReplyPacket &rhs); 00148 00149 const uint8_t getReplyCode() const { return replyCode; } 00150 const bool isDeleted() const; 00151 protected: 00152 virtual void parseBody(); 00153 private: 00154 uint8_t replyCode; 00155 00156 }; 00157 00158 class DeleteMePacket : public OutPacket 00159 { 00160 public: 00161 DeleteMePacket(); 00162 DeleteMePacket(const int id); 00163 DeleteMePacket(const DeleteMePacket &rhs); 00164 virtual ~DeleteMePacket() {}; 00165 00166 OutPacket *copy(){return new DeleteMePacket(*this);} 00167 DeleteMePacket &operator=(const DeleteMePacket &rhs); 00168 00169 void setBuddyQQ(int id) { buddyQQNum = id; } 00170 const int getBuddyQQ() const { return buddyQQNum; } 00171 protected: 00172 virtual int putBody(unsigned char* buf); 00173 private: 00174 int buddyQQNum; 00175 }; 00176 00177 class DeleteMeReplyPacket : public InPacket 00178 { 00179 public: 00180 DeleteMeReplyPacket() {} 00181 DeleteMeReplyPacket(unsigned char* buf, int len); 00182 DeleteMeReplyPacket( const DeleteMeReplyPacket &rhs); 00183 virtual ~DeleteMeReplyPacket() {}; 00184 00185 virtual InPacket* copy(){return new DeleteMeReplyPacket(*this);} 00186 DeleteMeReplyPacket &operator=(const DeleteMeReplyPacket &rhs); 00187 00188 const uint8_t getReplyCode() const { return replyCode; } 00189 const bool isDeleted() const; 00190 protected: 00191 virtual void parseBody(); 00192 private: 00193 uint8_t replyCode; 00194 00195 }; 00196 00197 class SystemNotificationPacket : public InPacket 00198 { 00199 public: 00200 SystemNotificationPacket() {}; 00201 SystemNotificationPacket(unsigned char* buf, int len); 00202 SystemNotificationPacket( const SystemNotificationPacket &rhs); 00203 virtual ~SystemNotificationPacket() {}; 00204 00205 virtual InPacket* copy(){return new SystemNotificationPacket(*this);} 00206 SystemNotificationPacket &operator=(const SystemNotificationPacket &rhs); 00207 00208 const uint8_t getType() const { return type; } 00209 const int getMyQQ() const { return myQQ; } 00210 const int getFromQQ() const { return fromQQ; } 00211 const std::string getMessage() const { return message; } 00212 protected: 00213 virtual void parseBody(); 00214 private: 00215 static const uint8_t DIVIDER = 0x1f; 00216 uint8_t type; 00217 int fromQQ; 00218 int myQQ; 00219 std::string message; 00220 }; 00221 00222 #endif 00223
1.4.4