/* $Revision: 1.12 $ $Date: 2010/03/11 14:42:05 $ $Author: faust $ */ #ifndef USER_CONF_H #define USER_CONF_H #include #include #include "const.h" #include "user_ips.h" #include "resetable.h" #include "os_int.h" //----------------------------------------------------------------------------- struct USER_CONF { USER_CONF() : password(), passive(0), disabled(0), disabledDetailStat(0), alwaysOnline(0), tariffName(), address(), phone(), email(), note(), realName(), corp(), services(), group(), credit(0), nextTariff(), userdata(USERDATA_NUM), creditExpire(0), ips() {} std::string password; int passive; int disabled; int disabledDetailStat; int alwaysOnline; std::string tariffName; std::string address; std::string phone; std::string email; std::string note; std::string realName; std::string corp; std::vector services; std::string group; double credit; std::string nextTariff; std::vector userdata; time_t creditExpire; USER_IPS ips; }; //----------------------------------------------------------------------------- struct USER_CONF_RES { USER_CONF_RES() : password(), passive(), disabled(), disabledDetailStat(), alwaysOnline(), tariffName(), address(), phone(), email(), note(), realName(), corp(), group(), credit(), nextTariff(), userdata(USERDATA_NUM), services(), creditExpire(), ips() { } USER_CONF_RES & operator=(const USER_CONF & uc) { userdata.resize(USERDATA_NUM); password = uc.password; passive = uc.passive; disabled = uc.disabled; disabledDetailStat = uc.disabledDetailStat; alwaysOnline = uc.alwaysOnline; tariffName = uc.tariffName; address = uc.address; phone = uc.phone; email = uc.email; note = uc.note; realName = uc.realName; corp = uc.corp; group = uc.group; credit = uc.credit; nextTariff = uc.nextTariff; for (size_t i = 0; i < USERDATA_NUM; i++) userdata[i] = uc.userdata[i]; services.resize(uc.services.size()); for (size_t i = 0; i < uc.services.size(); ++i) services[i] = uc.services[i]; creditExpire = uc.creditExpire; ips = uc.ips; return *this; } USER_CONF GetData() const { USER_CONF uc; uc.password = password.data(); uc.passive = passive.data(); uc.disabled = disabled.data(); uc.disabledDetailStat = disabledDetailStat.data(); uc.alwaysOnline = alwaysOnline.data(); uc.tariffName = tariffName.data(); uc.address = address.data(); uc.phone = phone.data(); uc.email = email.data(); uc.note = note.data(); uc.realName = realName.data(); uc.corp = corp.data(); uc.group = group.data(); uc.credit = credit.data(); uc.nextTariff = nextTariff.data(); for (size_t i = 0; i < USERDATA_NUM; i++) { uc.userdata[i] = userdata[i].data(); } uc.services.resize(services.size()); for (size_t i = 0; i < services.size(); ++i) uc.services[i] = services[i].data(); uc.creditExpire = creditExpire.data(); uc.ips = ips.data(); return uc; } //------------------------------------------------------------------------- RESETABLE password; RESETABLE passive; RESETABLE disabled; RESETABLE disabledDetailStat; RESETABLE alwaysOnline; RESETABLE tariffName; RESETABLE address; RESETABLE phone; RESETABLE email; RESETABLE note; RESETABLE realName; RESETABLE corp; RESETABLE group; RESETABLE credit; RESETABLE nextTariff; std::vector > userdata; std::vector > services; RESETABLE creditExpire; RESETABLE ips; }; //----------------------------------------------------------------------------- #endif