1 #include <sys/utsname.h>
3 #include "stg/version.h"
4 #include "stg/common.h"
5 #include "info_methods.h"
8 void METHOD_INFO::execute(xmlrpc_c::paramList const & paramList,
9 xmlrpc_c::value * const retvalPtr)
11 paramList.verifyEnd(0);
12 std::map<std::string, xmlrpc_c::value> structVal;
28 structVal["version"] = xmlrpc_c::value_string(SERVER_VERSION);
29 structVal["tariff_num"] = xmlrpc_c::value_int(tariffs->GetTariffsNum());
30 structVal["tariff"] = xmlrpc_c::value_int(2);
31 structVal["users_num"] = xmlrpc_c::value_int(users->GetUserNum());
32 structVal["uname"] = xmlrpc_c::value_string(un);
33 structVal["dir_num"] = xmlrpc_c::value_int(DIR_NUM);
34 structVal["day_fee"] = xmlrpc_c::value_int(dayFee);
36 std::vector<xmlrpc_c::value> dirnameVal;
38 for (int i = 0; i< DIR_NUM; i++)
40 dirnameVal.push_back(xmlrpc_c::value_string(dirNames[i]));
43 structVal["dir_names"] = xmlrpc_c::value_array(dirnameVal);
45 *retvalPtr = xmlrpc_c::value_struct(structVal);
48 void METHOD_LOGIN::execute(xmlrpc_c::paramList const & paramList,
49 xmlrpc_c::value * const retvalPtr)
51 std::string login = paramList.getString(0);
52 std::string password = paramList.getString(1);
53 paramList.verifyEnd(2);
55 std::map<std::string, xmlrpc_c::value> structVal;
58 if (config->CheckAdmin(login, password, &cookie))
60 structVal["result"] = xmlrpc_c::value_boolean(false);
61 structVal["cookie"] = xmlrpc_c::value_string("");
65 structVal["result"] = xmlrpc_c::value_boolean(true);
66 structVal["cookie"] = xmlrpc_c::value_string(cookie);
69 *retvalPtr = xmlrpc_c::value_struct(structVal);
72 void METHOD_LOGOUT::execute(xmlrpc_c::paramList const & paramList,
73 xmlrpc_c::value * const retvalPtr)
75 std::string cookie = paramList.getString(0);
76 paramList.verifyEnd(1);
78 std::map<std::string, xmlrpc_c::value> structVal;
80 if (config->LogoutAdmin(cookie))
82 *retvalPtr = xmlrpc_c::value_boolean(false);
86 *retvalPtr = xmlrpc_c::value_boolean(true);