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 EVASEARCHUSER_H 00021 #define EVASEARCHUSER_H 00022 00023 #include "evapacket.h" 00024 #include "evadefines.h" 00025 #ifndef WIN32 00026 #include <inttypes.h> 00027 #endif 00028 #include <string> 00029 #include <list> 00034 class OnlineUser{ 00035 public: 00036 OnlineUser(); 00037 ~OnlineUser() {} 00038 00039 const int getQQ() const { return qqNum; } 00040 const std::string getNick() const { return nick; } 00041 const short getFace() const { return face; } 00042 const std::string getProvince() const { return province; } 00043 int readData(unsigned char * buf); 00044 OnlineUser &operator=(const OnlineUser &rhs); 00045 private: 00046 int qqNum; 00047 std::string nick; 00048 std::string province; 00049 short face; 00050 }; 00051 00052 class SearchUserPacket : public OutPacket 00053 { 00054 public: 00055 SearchUserPacket(); 00056 SearchUserPacket(SearchUserPacket &rhs); 00057 virtual ~SearchUserPacket() {}; 00058 00059 00060 void setPage(const int p); 00061 void setPage(const std::string p) { page = p; } 00062 const int getIntPage() const { return atoi(page.c_str()); } 00063 const std::string getPage() const { return page; } 00064 void setSearchType(const uint8_t type) { searchType = type; } 00065 const uint8_t getSearchType() const { return searchType; } 00066 void setMatchEntireString(const bool match) { matchEntireString = match; } 00067 const bool getMatchEntireString() const { return matchEntireString; } 00068 void setNick( const std::string &nickname ) { nick = nickname; } 00069 const std::string getNick() const { return nick; } 00070 void setQQ(const int qqNum); 00071 void setQQ(const std::string &id) { qqStr = id; } 00072 const int getIntQQ() const { return atoi(qqStr.c_str()); } 00073 const std::string getQQ() const { return qqStr; } 00074 void setEmail(const std::string &mail) { email = mail; } 00075 const std::string getEmail() const { return email; } 00076 00077 SearchUserPacket &operator=(const SearchUserPacket &rhs); 00078 OutPacket *copy(){ return new SearchUserPacket(*this);} 00079 protected: 00080 virtual int putBody(unsigned char* buf); 00081 private: 00082 uint8_t searchType; 00083 std::string page; 00084 std::string qqStr; 00085 std::string nick; 00086 std::string email; 00087 bool matchEntireString; 00088 static const uint8_t DIVIDER = 0x1F; 00089 static const uint8_t NULL_FIELD = 0x2D; 00090 static const uint8_t PERCENT = 0x25; 00091 }; 00092 00093 class SearchUserReplyPacket : public InPacket 00094 { 00095 public: 00096 SearchUserReplyPacket() {} 00097 SearchUserReplyPacket(unsigned char* buf, int len); 00098 SearchUserReplyPacket(const SearchUserReplyPacket &rhs); 00099 ~SearchUserReplyPacket() {}; 00100 00101 const std::list<OnlineUser> getUsers() const { return users; } 00102 const bool isFinished() const { return finished; } 00103 //void setFinished(const bool f) { finished = f; } 00104 00105 SearchUserReplyPacket &operator=(const SearchUserReplyPacket &rhs); 00106 protected: 00107 virtual void parseBody(); 00108 private: 00109 std::list<OnlineUser> users; 00110 bool finished; 00111 }; 00112 00113 #endif
1.4.4