1 #include <sys/utsname.h>
6 // TODO: Fix this shit!
7 #include "../../../settings.h"
8 #include "parser_info.h"
10 PARSER_GET_SERVER_INFO::PARSER_GET_SERVER_INFO(const SETTINGS * s, int tn, int un)
12 result("<error message=\"Not implemented\"/>"),
19 PARSER_GET_SERVER_INFO::~PARSER_GET_SERVER_INFO()
23 bool PARSER_GET_SERVER_INFO::StartTag(const char * name, const char ** attr)
25 std::string tag(name);
26 if (tag != "GetServerInfo") {
33 bool PARSER_GET_SERVER_INFO::EndTag(const char * name)
35 std::string tag(name);
36 if (tag != "GetServerInfo") {
40 std::stringstream answer;
41 answer << "<ServerInfo>\n";
42 answer << "\t<version value=\"" << SERVER_VERSION << "\"/>\n";
43 answer << "\t<tariff_num value=\"" << tariffsNum << "\"/>\n";
44 answer << "\t<tariff value=\"2\"/>\n";
45 answer << "\t<users_num value=\"" << usersNum << "\"/>\n";
48 answer << "\t<uname value=\"" << utsn.sysname << " " << utsn.release << " " << utsn.machine << " " << utsn.nodename << "\"/>\n";
49 answer << "\t<dir_num value=\"" << DIR_NUM << "\"/>\n";
50 answer << "\t<day_fee value=\"" << settings->GetDayFee() << "\"/>\n";
51 for (int i = 0; i < DIR_NUM; ++i) {
53 Encode12str(encoded, settings->GetDirName(i));
54 answer << "\t<dir_name_" << i << " value=\"" << encoded << "\"/>\n";
56 answer << "</ServerInfo>";
58 result = answer.str();