1 #include "info_methods.h"
3 #include <sys/utsname.h>
7 void METHOD_INFO::execute(xmlrpc_c::paramList const & paramList,
8 xmlrpc_c::value * const retvalPtr)
10 paramList.verifyEnd(0);
11 std::map<std::string, xmlrpc_c::value> structVal;
27 structVal["version"] = xmlrpc_c::value_string(SERVER_VERSION);
28 structVal["tariff_num"] = xmlrpc_c::value_int(tariffs->GetTariffsNum());
29 structVal["tariff"] = xmlrpc_c::value_int(2);
30 structVal["users_num"] = xmlrpc_c::value_int(users->GetUserNum());
31 structVal["uname"] = xmlrpc_c::value_string(un);
32 structVal["dir_num"] = xmlrpc_c::value_int(DIR_NUM);
33 structVal["day_fee"] = xmlrpc_c::value_int(settings->GetDayFee());
35 std::vector<xmlrpc_c::value> dirnameVal;
37 for (int i = 0; i< DIR_NUM; i++)
40 Encode12str(dn2e, settings->GetDirName(i));
41 dirnameVal.push_back(xmlrpc_c::value_string(dn2e));
44 structVal["dir_names"] = xmlrpc_c::value_array(dirnameVal);
46 *retvalPtr = xmlrpc_c::value_struct(structVal);
49 void METHOD_LOGIN::execute(xmlrpc_c::paramList const & paramList,
50 xmlrpc_c::value * const retvalPtr)
52 std::string login = paramList.getString(0);
53 std::string password = paramList.getString(1);
54 paramList.verifyEnd(2);
56 std::map<std::string, xmlrpc_c::value> structVal;
59 if (config->CheckAdmin(login, password, &cookie))
61 structVal["result"] = xmlrpc_c::value_boolean(false);
62 structVal["cookie"] = xmlrpc_c::value_string("");
66 structVal["result"] = xmlrpc_c::value_boolean(true);
67 structVal["cookie"] = xmlrpc_c::value_string(cookie);
70 *retvalPtr = xmlrpc_c::value_struct(structVal);
73 void METHOD_LOGOUT::execute(xmlrpc_c::paramList const & paramList,
74 xmlrpc_c::value * const retvalPtr)
76 std::string cookie = paramList.getString(0);
77 paramList.verifyEnd(1);
79 std::map<std::string, xmlrpc_c::value> structVal;
81 if (config->LogoutAdmin(cookie))
83 *retvalPtr = xmlrpc_c::value_boolean(false);
87 *retvalPtr = xmlrpc_c::value_boolean(true);