Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

Contact.h

00001 /*
00002  * Contact (model)
00003  * A contact on the contact list
00004  *
00005  * Copyright (C) 2001 Barnaby Gray <barnaby@beedesign.co.uk>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020  *
00021  */
00022 
00023 #ifndef CONTACT_H
00024 #define CONTACT_H
00025 
00026 #include <list>
00027 #include <string>
00028 
00029 #include <libicq2000/constants.h>
00030 
00031 using std::list;
00032 using std::string;
00033 
00034 namespace ICQ2000 {
00035 
00036   class MessageEvent;
00037 
00038   // DetailedUserInfo classes
00039 
00040   class MainHomeInfo {
00041    public:
00042     MainHomeInfo();
00043 
00044     string alias, firstname, lastname, email, city, state, phone, fax, street, cellular, zip;
00045     unsigned short country;
00046     unsigned char gmt;
00047 
00048     string getCountry() const;
00049   };
00050 
00051   class HomepageInfo {
00052    public:
00053     HomepageInfo();
00054 
00055     unsigned char age, sex;
00056     string homepage;
00057     unsigned short birth_year;
00058     unsigned char birth_month, birth_day, lang1, lang2, lang3;
00059 
00060     string getBirthDate() const;
00061     string getLanguage(int l) const;
00062   };
00063 
00064   class EmailInfo {
00065    private:
00066     list<string> email_list;
00067 
00068    public:
00069     EmailInfo();
00070 
00071     void addEmailAddress(const string&);
00072   };
00073   
00074   class WorkInfo {
00075    public:
00076     WorkInfo();
00077     
00078     string city, state, street, zip;
00079     unsigned short country;
00080     string company_name, company_dept, company_position, company_web;
00081   };
00082 
00083   class BackgroundInfo {
00084    public:
00085     typedef std::pair<unsigned short, string> School;
00086     list<School> schools;   // school names
00087 
00088     BackgroundInfo();
00089 
00090     void addSchool(unsigned short cat, const string& s);
00091   };
00092 
00093   class PersonalInterestInfo {
00094    public:
00095     typedef std::pair<unsigned short, string> Interest;
00096     list<Interest> interests;
00097 
00098     PersonalInterestInfo();
00099     
00100     void addInterest(unsigned short cat, const string& s);
00101   };
00102 
00103   class Contact {
00104    private:
00105     void Init();
00106     bool m_icqcontact;
00107     bool m_mobilecontact;
00108 
00109     list<MessageEvent*> m_pending_msgs;
00110 
00111     // static fields
00112     unsigned int m_uin;
00113 
00114     // dynamic fields - updated when they come online
00115     unsigned char m_tcp_version;
00116     Status m_status;
00117     bool m_invisible;
00118     bool m_authreq;
00119     bool m_direct;
00120     unsigned int m_ext_ip, m_lan_ip;
00121     unsigned short m_ext_port, m_lan_port;
00122     bool m_accept_adv_msgs;
00123 
00124     static unsigned int imag_uin;
00125     
00126     // other fields
00127     unsigned short m_seqnum;
00128 
00129     // detailed fields
00130     MainHomeInfo m_main_home_info;
00131     HomepageInfo m_homepage_info;
00132     EmailInfo m_email_info;
00133     WorkInfo m_work_info;
00134     PersonalInterestInfo m_personal_interest_info;
00135     BackgroundInfo m_background_info;
00136     string m_about;
00137 
00138   public:
00139     Contact();
00140     Contact(unsigned int uin);
00141     Contact(const string& a, const string& m);
00142 
00143     ~Contact();
00144 
00145     unsigned int getUIN() const;
00146     string getStringUIN() const;
00147     string getMobileNo() const;
00148     string getAlias() const;
00149     string getFirstName() const;
00150     string getLastName() const;
00151     string getEmail() const;
00152 
00153     Status getStatus() const;
00154     string getStatusStr() const;
00155     bool isInvisible() const;
00156     bool getAuthReq() const;
00157 
00158     unsigned int getExtIP() const;
00159     unsigned int getLanIP() const;
00160     unsigned short getExtPort() const;
00161     unsigned short getLanPort() const;
00162     unsigned char getTCPVersion() const;
00163     bool acceptAdvancedMsgs() const;
00164 
00165     void setMobileNo(const string& mn);
00166     void setAlias(const string& al);
00167     void setFirstName(const string& fn);
00168     void setLastName(const string& ln);
00169     void setEmail(const string& em);
00170     void setAuthReq(bool b);
00171 
00172     bool getDirect() const;
00173     void setDirect(bool b);
00174 
00175     void setStatus(Status st);
00176     void setInvisible(bool i);
00177     void setExtIP(unsigned int ip);
00178     void setLanIP(unsigned int ip);
00179     void setExtPort(unsigned short port);
00180     void setLanPort(unsigned short port);
00181     void setTCPVersion(unsigned char v);
00182     void setAcceptAdvMsgs(bool b);
00183    
00184     void setMainHomeInfo(const MainHomeInfo& m);
00185     void setHomepageInfo(const HomepageInfo& s);
00186     void setEmailInfo(const EmailInfo &e);
00187     void setWorkInfo(const WorkInfo &w);
00188     void setInterestInfo(const PersonalInterestInfo& p);
00189     void setBackgroundInfo(const BackgroundInfo& b);
00190     void setAboutInfo(const string& about);
00191 
00192     MainHomeInfo& getMainHomeInfo();
00193     HomepageInfo& getHomepageInfo();
00194     EmailInfo& getEmailInfo();
00195     WorkInfo& getWorkInfo();
00196     BackgroundInfo& getBackgroundInfo();
00197     PersonalInterestInfo& getPersonalInterestInfo();
00198     const string& getAboutInfo() const;
00199 
00200     bool isICQContact() const;
00201     bool isMobileContact() const;
00202 
00203     unsigned short nextSeqNum();
00204 
00205     unsigned int numberPendingMessages() const;
00206 
00207     void addPendingMessage(MessageEvent* e);
00208     MessageEvent *getPendingMessage() const;
00209     void erasePendingMessage(MessageEvent* e);
00210 
00211     static string UINtoString(unsigned int uin);
00212     static unsigned int StringtoUIN(const string& s);
00213 
00214     static unsigned int nextImaginaryUIN();
00215 
00216   };
00217 
00218 }
00219 
00220 #endif

Generated on Tue Jan 15 12:24:34 2002 for libicq2000 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001