1 // TODO: Fix this shit!
2 #include "../../../admin.h"
3 #include "../../../users.h"
5 #include "parser_getuser.h"
7 PARSER_GET_USER::PARSER_GET_USER(const ADMIN * ca, const USERS * u)
9 result("<error message=\"Not implemented yet\"/>"),
15 PARSER_GET_USER::~PARSER_GET_USER()
19 bool PARSER_GET_USER::StartTag(const char * name, const char ** attr)
21 std::string tag(name);
22 if (tag != "GetUser") {
26 if (attr[0] == NULL || attr[1] == NULL) {
35 bool PARSER_GET_USER::EndTag(const char * name)
37 std::string tag(name);
38 if (tag != "GetUser") {
43 result = "<error message=\"Login unspecified\"/>";
49 if (users->FindByName(login, &ui)) {
50 result ="<error message=\"User not found\"/>";
54 std::stringstream answer;
56 answer << "\t<login value=\"" << ui->GetLogin() << "\"/>\n";
57 if (currAdmin->GetPriv()->userConf || currAdmin->GetPriv()->userPasswd) {
58 answer << "\t<password value=\"" << ui->property.password.Get() << "\"/>\n";
60 answer << "\t<password value=\"++++++++\"/>\n";
62 answer << "\t<cash value=\"" << ui->property.cash.Get() << "\"/>\n";
63 answer << "\t<freemb value=\"" << ui->property.freeMb.Get() << "\"/>\n";
64 answer << "\t<credit value=\"" << ui->property.credit.Get() << "\"/>\n";
65 if (ui->property.nextTariff.Get() != "") {
66 answer << "\t<tariff value=\"" << ui->property.tariffName.Get()
67 << "/" << ui->property.nextTariff.Get() << "\"/>\n";
69 answer << "\t<tariff value=\"" << ui->property.tariffName.Get() << "\"/>\n";
73 Encode12str(encoded, ui->property.note.Get());
74 answer << "\t<note value=\"" << encoded << "\"/>\n";
75 Encode12str(encoded, ui->property.phone.Get());
76 answer << "\t<phone value=\"" << encoded << "\"/>\n";
77 Encode12str(encoded, ui->property.address.Get());
78 answer << "\t<address value=\"" << encoded << "\"/>\n";
79 Encode12str(encoded, ui->property.email.Get());
80 answer << "\t<email value=\"" << encoded << "\"/>\n";
81 Encode12str(encoded, ui->property.realName.Get());
82 answer << "\t<name value=\"" << encoded << "\"/>\n";
83 Encode12str(encoded, ui->property.group.Get());
84 answer << "\t<group value=\"" << encoded << "\"/>\n";
86 // TODO: Fix this shit!
88 Encode12str(encoded, ui->property.userdata0.Get()); answer << "\t<userdata0 value=\"" << encoded << "\"/>\n";
89 Encode12str(encoded, ui->property.userdata1.Get()); answer << "\t<userdata1 value=\"" << encoded << "\"/>\n";
90 Encode12str(encoded, ui->property.userdata2.Get()); answer << "\t<userdata2 value=\"" << encoded << "\"/>\n";
91 Encode12str(encoded, ui->property.userdata3.Get()); answer << "\t<userdata3 value=\"" << encoded << "\"/>\n";
92 Encode12str(encoded, ui->property.userdata4.Get()); answer << "\t<userdata4 value=\"" << encoded << "\"/>\n";
93 Encode12str(encoded, ui->property.userdata5.Get()); answer << "\t<userdata5 value=\"" << encoded << "\"/>\n";
94 Encode12str(encoded, ui->property.userdata6.Get()); answer << "\t<userdata6 value=\"" << encoded << "\"/>\n";
95 Encode12str(encoded, ui->property.userdata7.Get()); answer << "\t<userdata7 value=\"" << encoded << "\"/>\n";
96 Encode12str(encoded, ui->property.userdata8.Get()); answer << "\t<userdata8 value=\"" << encoded << "\"/>\n";
97 Encode12str(encoded, ui->property.userdata9.Get()); answer << "\t<userdata9 value=\"" << encoded << "\"/>\n";
100 answer << "\t<status value=\"" << ui->GetConnected() << "\"/>\n";
101 answer << "\t<aonline value=\"" << ui->property.alwaysOnline.Get() << "\"/>\n";
102 answer << "\t<currip value=\"" << inet_ntostring(ui->GetCurrIP()) << "\"/>\n";
103 answer << "\t<pingtime value=\"" << ui->GetPingTime() << "\"/>\n";
104 answer << "\t<ip value=\"" << ui->property.ips.Get() << "\"/>\n";
105 answer << "\t<lastcash value=\"" << ui->property.lastCashAdd.Get() << "\"/>\n";
106 answer << "\t<lasttimecash value=\"" << ui->property.lastCashAddTime.Get() << "\"/>\n";
107 answer << "\t<lastactivitytime value=\"" << ui->property.lastActivityTime.Get() << "\"/>\n";
108 answer << "\t<creditexpire value=\"" << ui->property.creditExpire.Get() << "\"/>\n";
109 answer << "\t<down value=\"" << ui->property.down.Get() << "\"/>\n";
110 answer << "\t<passive value=\"" << ui->property.passive.Get() << "\"/>\n";
111 answer << "\t<disabledetailstat value=\"" << ui->property.disabledDetailStat.Get() << "\"/>\n";
113 // TODO: Fix this shit!
115 answer << "\t<traff ";
116 DIR_TRAFF up(ui->property.up.Get());
117 DIR_TRAFF down(ui->property.down.Get());
118 for (int i = 0; i < DIR_NUM; ++i) {
119 answer << "MU" << i << "=\"" << up[i] << "\" ";
120 answer << "MD" << i << "=\"" << down[i] << "\" ";
127 result = answer.str();