Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

evauserinfo.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 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 LIBEVAINFO_H
00021 #define LIBEVAINFO_H
00022 
00023 #include "evapacket.h"
00024 #include <string>
00025 #include <vector>
00026 
00027 typedef std::vector<std::string> stringList;
00028     
00029 class ContactInfo {
00030 public: 
00031         ContactInfo();
00032         ContactInfo(const unsigned char *buf, const int len);
00033         ContactInfo( const ContactInfo &rhs);
00034         ~ContactInfo() {};
00035         
00036         void parseData(const unsigned char *buf, const int len);
00037         
00038         enum Info_Index{Info_qqID,       Info_nick,     Info_country,  Info_province,  Info_zipcode, 
00039                         Info_address,    Info_telephone, Info_age,      Info_gender,    Info_name, 
00040                         Info_email,      Info_pagerSn,   Info_pagerNum, Info_pagerSp,   Info_pagerBaseNum, 
00041                         Info_pagerType,  Info_occupation,Info_homepage, Info_authType,  Info_unknown1, 
00042                         Info_unknown2,   Info_face,      Info_mobile,   Info_mobileType,Info_intro, 
00043                         Info_city,       Info_unknown3,  Info_unknown4, Info_unknown5,  Info_openHp, 
00044                         Info_openContact,Info_college,   Info_horoscope,Info_zodiac,    Info_blood, 
00045                         Info_qqShow,     Info_unknown6  };
00046                         
00047         const std::string &at(const Info_Index index) const { return infos[index]; }
00048         const std::string &at(const int index) const { return infos[index]; }  // note this method will not test if out of index range!
00049         const stringList &details() const {  return infos; };
00050         const uint count() const { return infos.size(); }
00051         
00052         void setDetails(const stringList &strList) { infos = strList; }
00053         bool operator== ( const ContactInfo &rhs ) const;
00054         ContactInfo &operator= ( const ContactInfo &rhs ) ;
00055 private:
00056         stringList infos; 
00057         static const unsigned char DIVIDER = 0x1e; 
00058 };
00059 
00060 class GetUserInfoPacket : public OutPacket {
00061 public: 
00062         GetUserInfoPacket();
00063         GetUserInfoPacket(const int id);
00064         GetUserInfoPacket(const GetUserInfoPacket &rhs);
00065         virtual ~GetUserInfoPacket() {}
00066         
00067         OutPacket * copy() { return new GetUserInfoPacket(*this);}
00068         GetUserInfoPacket &operator=(const GetUserInfoPacket &rhs);
00069         
00070         void setUserQQ(const int qqNum) { this->qqNum = qqNum; }
00071         const int getUserQQ() const { return qqNum; }
00072 protected:
00073         virtual int putBody(unsigned char *buf); 
00074      
00075 private:
00076         int qqNum;
00077 };
00078 
00079 class GetUserInfoReplyPacket : public InPacket {
00080 public:
00081         GetUserInfoReplyPacket() {}
00082         GetUserInfoReplyPacket(unsigned char *buf, int len);
00083         GetUserInfoReplyPacket( const GetUserInfoReplyPacket &rhs);
00084         virtual ~GetUserInfoReplyPacket() {}
00085 
00086         InPacket *copy() { return new GetUserInfoReplyPacket(*this);}
00087         GetUserInfoReplyPacket &operator=(const GetUserInfoReplyPacket &rhs);
00088         
00089         const ContactInfo &contactInfo() const { return mContactInfo; }
00090 protected:
00091         virtual void parseBody();
00092 private:
00093         ContactInfo mContactInfo;
00094 };
00095 
00096 class ModifyInfoPacket : public OutPacket {
00097 public:
00098         ModifyInfoPacket();
00099         ModifyInfoPacket(const ContactInfo &info);
00100         ModifyInfoPacket(const ModifyInfoPacket &rhs);
00101         virtual ~ModifyInfoPacket() {}
00102         
00103         OutPacket *copy() { return new ModifyInfoPacket(*this); }
00104         ModifyInfoPacket &operator=(const ModifyInfoPacket &rhs);
00105         
00106         void setPassword( const std::string &password) { currentPwd = password; };
00107         void setNewPassword( const std::string &password) { newPwd = password; };
00108         void setContactInfo( const ContactInfo &info) { newInfo = info; }
00109         
00110         const std::string getPassword() const { return currentPwd; }
00111         const std::string getNewPassword() const { return newPwd; }
00112         const ContactInfo getContactInfo() const { return newInfo; }
00113 protected:
00114         virtual int putBody(unsigned char *buf);
00115 private:
00116         ContactInfo newInfo;
00117         std::string currentPwd;
00118         std::string newPwd;
00119         static const unsigned char DELIMIT = 0x1f;
00120 };
00121 
00122 class ModifyInfoReplyPacket : public InPacket {
00123 public:
00124         ModifyInfoReplyPacket() {};
00125         ModifyInfoReplyPacket(unsigned char *buf, int len);
00126         ModifyInfoReplyPacket(const ModifyInfoReplyPacket &rhs);
00127         virtual ~ModifyInfoReplyPacket() {}
00128         
00129         InPacket *copy() { return new ModifyInfoReplyPacket(*this);}
00130         ModifyInfoReplyPacket &operator=(const ModifyInfoReplyPacket &rhs);     
00131         
00132         const bool isAccepted() const { return accepted; }
00133 protected:
00134         virtual void parseBody();
00135 private:
00136         bool accepted;
00137 };
00138 
00139 #endif

Generated on Mon May 15 20:48:41 2006 for libeva by  doxygen 1.4.4