00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef SNAC_SRV_H
00023 #define SNAC_SRV_H
00024
00025 #include <string>
00026 #include <time.h>
00027 #include <libicq2000/SNAC-base.h>
00028 #include <libicq2000/ICQ.h>
00029 #include <libicq2000/constants.h>
00030 #include <libicq2000/Contact.h>
00031
00032 namespace ICQ2000 {
00033
00034
00035 const unsigned short SNAC_SRV_Error = 0x0001;
00036 const unsigned short SNAC_SRV_Send = 0x0002;
00037 const unsigned short SNAC_SRV_Response = 0x0003;
00038
00039
00040
00041
00042
00043
00044
00045
00046 class SrvFamilySNAC : virtual public SNAC {
00047 public:
00048 unsigned short Family() const { return SNAC_FAM_SRV; }
00049 };
00050
00051 class SrvSendSNAC : public SrvFamilySNAC, public OutSNAC {
00052 protected:
00053 string m_text, m_destination, m_senders_name;
00054 unsigned int m_senders_UIN;
00055 bool m_delivery_receipt;
00056
00057 void OutputBody(Buffer& b) const;
00058
00059 public:
00060 SrvSendSNAC(const string& text, const string& destination,
00061 unsigned int senders_UIN, const string& senders_name, bool delrpt);
00062
00063 unsigned short Subtype() const { return SNAC_SRV_Send; }
00064 };
00065
00066 class SrvRequestOfflineSNAC : public SrvFamilySNAC, public OutSNAC {
00067 private:
00068 unsigned int m_uin;
00069
00070 protected:
00071 void OutputBody(Buffer& b) const;
00072
00073 public:
00074 SrvRequestOfflineSNAC(unsigned int uin);
00075
00076 unsigned short Subtype() const { return SNAC_SRV_Send; }
00077 };
00078
00079 class SrvAckOfflineSNAC : public SrvFamilySNAC, public OutSNAC {
00080 private:
00081 unsigned int m_uin;
00082
00083 protected:
00084 void OutputBody(Buffer& b) const;
00085
00086 public:
00087 SrvAckOfflineSNAC(unsigned int uin);
00088
00089 unsigned short Subtype() const { return SNAC_SRV_Send; }
00090 };
00091
00092 class SrvRequestSimpleUserInfo : public SrvFamilySNAC, public OutSNAC {
00093 private:
00094 unsigned int m_my_uin, m_user_uin;
00095
00096 protected:
00097 void OutputBody(Buffer& b) const;
00098
00099 public:
00100 SrvRequestSimpleUserInfo(unsigned int my_uin, unsigned int user_uin);
00101 unsigned short Subtype() const { return SNAC_SRV_Send; }
00102 };
00103
00104 class SrvRequestShortWP : public SrvFamilySNAC, public OutSNAC {
00105 protected:
00106 unsigned int m_my_uin;
00107 string m_nickname, m_firstname, m_lastname;
00108 void OutputBody(Buffer& b) const;
00109
00110 public:
00111 SrvRequestShortWP(unsigned int my_uin, const string& nickname,
00112 const string& firstname, const string& lastname);
00113
00114 unsigned short Subtype() const { return SNAC_SRV_Send; }
00115 };
00116
00117 class SrvRequestFullWP : public SrvFamilySNAC, public OutSNAC {
00118 private:
00119 unsigned int m_my_uin;
00120 string m_nickname, m_firstname, m_lastname, m_email;
00121 unsigned short m_min_age, m_max_age;
00122 unsigned char m_sex;
00123 unsigned char m_language;
00124 string m_city, m_state, m_company_name, m_department, m_position;
00125 unsigned short m_country;
00126 bool m_only_online;
00127
00128 protected:
00129 void OutputBody(Buffer& b) const;
00130
00131 public:
00132 SrvRequestFullWP(unsigned int my_uin, const string& nickname, const string& firstname,
00133 const string& lastname, const string& email, unsigned short min_age, unsigned short max_age,
00134 unsigned char sex, unsigned char language, const string& city, const string& state,
00135 unsigned short country, const string& company_name, const string& department,
00136 const string& position, bool only_online);
00137
00138 unsigned short Subtype() const { return SNAC_SRV_Send; }
00139 };
00140
00141 class SrvRequestDetailUserInfo : public SrvFamilySNAC, public OutSNAC {
00142 private:
00143 unsigned int m_my_uin, m_user_uin;
00144
00145 protected:
00146 void OutputBody(Buffer& b) const;
00147
00148 public:
00149 SrvRequestDetailUserInfo(unsigned int my_uin, unsigned int user_uin);
00150 unsigned short Subtype() const { return SNAC_SRV_Send; }
00151 };
00152
00153 const unsigned short SrvResponse_Error = 0x0001;
00154 const unsigned short SrvResponse_SMS = 0x0064;
00155 const unsigned short SrvResponse_SMS_Done = 0x0096;
00156 const unsigned short SrvResponse_SimpleUI = 0x0190;
00157 const unsigned short SrvResponse_SimpleUI_Done = 0x019a;
00158 const unsigned short SrvResponse_SearchUI = 0x01a4;
00159 const unsigned short SrvResponse_SearchUI_Done = 0x01ae;
00160 const unsigned short SrvResponse_MainHomeInfo = 0x00c8;
00161 const unsigned short SrvResponse_WorkInfo = 0x00d2;
00162 const unsigned short SrvResponse_HomePageInfo = 0x00dc;
00163 const unsigned short SrvResponse_AboutInfo = 0x00e6;
00164 const unsigned short SrvResponse_EmailInfo = 0x00eb;
00165 const unsigned short SrvResponse_InterestInfo = 0x00f0;
00166 const unsigned short SrvResponse_BackgroundInfo = 0x00fa;
00167 const unsigned short SrvResponse_Unknown = 0x010e;
00168
00169 class SrvResponseSNAC : public SrvFamilySNAC, public InSNAC {
00170 public:
00171 enum ResponseType {
00172 OfflineMessage,
00173 OfflineMessagesComplete,
00174 SMS_Error,
00175 SMS_Response,
00176 SimpleUserInfo,
00177 SearchSimpleUserInfo,
00178 RMainHomeInfo,
00179 RHomepageInfo,
00180 REmailInfo,
00181 RUnknown,
00182 RWorkInfo,
00183 RAboutInfo,
00184 RInterestInfo,
00185 RBackgroundInfo
00186 };
00187
00188 protected:
00189 ResponseType m_type;
00190
00191
00192 string m_source, m_network, m_message_id, m_messages_left;
00193 bool m_deliverable;
00194 int m_error_id;
00195 string m_error_param;
00196
00197
00198 time_t m_time;
00199 unsigned int m_sender_UIN;
00200 ICQSubType *m_icqsubtype;
00201
00202
00203 bool m_empty_contact;
00204 unsigned int m_uin;
00205 string m_alias, m_firstname, m_lastname, m_email;
00206 bool m_last_in_search;
00207
00208
00209 MainHomeInfo m_main_home_info;
00210 HomepageInfo m_homepage_info;
00211 EmailInfo m_email_info;
00212 WorkInfo m_work_info;
00213 BackgroundInfo m_background_info;
00214 PersonalInterestInfo m_personal_interest_info;
00215 string m_about;
00216
00217 bool m_authreq;
00218 Status m_status;
00219 unsigned int m_more_results;
00220
00221 void ParseBody(Buffer& b);
00222 void ParseICQResponse(Buffer& b);
00223 void ParseOfflineMessage(Buffer& b);
00224 void ParseSMSError(Buffer& b);
00225 void ParseSMSResponse(Buffer& b);
00226 void ParseSimpleUserInfo(Buffer &b, unsigned short subtype);
00227 void ParseDetailedUserInfo(Buffer &b, unsigned short subtype);
00228
00229 public:
00230 SrvResponseSNAC();
00231 ~SrvResponseSNAC();
00232
00233 ResponseType getType() const { return m_type; }
00234 string getSource() const { return m_source; }
00235 bool deliverable() const { return m_deliverable; }
00236 string getNetwork() const { return m_network; }
00237 string getMessageId() const { return m_message_id; }
00238 string getMessagesLeft() const { return m_messages_left; }
00239 int getErrorId() const { return m_error_id; }
00240 string getErrorParam() const { return m_error_param; }
00241
00242 ICQSubType *getICQSubType() const { return m_icqsubtype; }
00243 unsigned int getSenderUIN() const { return m_sender_UIN; }
00244 time_t getTime() const { return m_time; }
00245
00246 bool isEmptyContact() const { return m_empty_contact; }
00247 unsigned int getUIN() const { return m_uin; }
00248 string getAlias() const { return m_alias; }
00249 string getFirstName() const { return m_firstname; }
00250 string getLastName() const { return m_lastname; }
00251 string getEmail() const { return m_email; }
00252 bool getAuthReq() const { return m_authreq; }
00253 Status getStatus() const { return m_status; }
00254
00255 bool isLastInSearch() const { return m_last_in_search; }
00256 unsigned int getNumberMoreResults() const { return m_more_results; }
00257
00258
00259 unsigned short Subtype() const { return SNAC_SRV_Response; }
00260
00261
00262 MainHomeInfo& getMainHomeInfo() { return m_main_home_info; }
00263 HomepageInfo& getHomepageInfo() { return m_homepage_info; }
00264 EmailInfo &getEmailInfo() { return m_email_info; }
00265 WorkInfo &getWorkInfo() { return m_work_info; }
00266 BackgroundInfo &getBackgroundInfo() { return m_background_info; }
00267 PersonalInterestInfo &getPersonalInterestInfo() { return m_personal_interest_info; }
00268 string getAboutInfo() const { return m_about; }
00269 };
00270
00271 }
00272
00273 #endif