X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/3e32eb8e48a56bca543faa522909d3d83538c55d..9701b7ab4dc4cd709ad4dcaa750fc0021f15e231:/include/stg/user_conf.h?ds=inline diff --git a/include/stg/user_conf.h b/include/stg/user_conf.h new file mode 100644 index 00000000..9a6efb23 --- /dev/null +++ b/include/stg/user_conf.h @@ -0,0 +1,158 @@ + /* + $Revision: 1.12 $ + $Date: 2010/03/11 14:42:05 $ + $Author: faust $ + */ + +#ifndef USER_CONF_H +#define USER_CONF_H + +#include +#include +#include "stg_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(), + service(), + 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 service; + 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(), + group(), + credit(), + nextTariff(), + userdata(USERDATA_NUM, RESETABLE()), + 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; + group = uc.group; + credit = uc.credit; + nextTariff = uc.nextTariff; + for (int i = 0; i < USERDATA_NUM; i++) + { + userdata[i] = uc.userdata[i]; + } + creditExpire = uc.creditExpire; + ips = uc.ips; + return *this; + }; + operator USER_CONF() const + { + USER_CONF uc; + uc.password = password; + uc.passive = passive; + uc.disabled = disabled; + uc.disabledDetailStat = disabledDetailStat; + uc.alwaysOnline = alwaysOnline; + uc.tariffName = tariffName; + uc.address = address; + uc.phone = phone; + uc.email = email; + uc.note = note; + uc.realName = realName; + uc.group = group; + uc.credit = credit; + uc.nextTariff = nextTariff; + for (int i = 0; i < USERDATA_NUM; i++) + { + uc.userdata[i] = userdata[i]; + } + uc.creditExpire = creditExpire; + uc.ips = ips; + 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 group; + RESETABLE credit; + RESETABLE nextTariff; + std::vector > userdata; + RESETABLE creditExpire; + RESETABLE ips; +}; +//----------------------------------------------------------------------------- +#endif +