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++)
41 Encode12str(dn2e, dirNames[i]);
42 dirnameVal.push_back(xmlrpc_c::value_string(dn2e));
45 structVal["dir_names"] = xmlrpc_c::value_array(dirnameVal);
47 *retvalPtr = xmlrpc_c::value_struct(structVal);
50 void METHOD_LOGIN::execute(xmlrpc_c::paramList const & paramList,
51 xmlrpc_c::value * const retvalPtr)
53 std::string login = paramList.getString(0);
54 std::string password = paramList.getString(1);
55 paramList.verifyEnd(2);
57 std::map<std::string, xmlrpc_c::value> structVal;
60 if (config->CheckAdmin(login, password, &cookie))
62 structVal["result"] = xmlrpc_c::value_boolean(false);
63 structVal["cookie"] = xmlrpc_c::value_string("");
67 structVal["result"] = xmlrpc_c::value_boolean(true);
68 structVal["cookie"] = xmlrpc_c::value_string(cookie);
71 *retvalPtr = xmlrpc_c::value_struct(structVal);
74 void METHOD_LOGOUT::execute(xmlrpc_c::paramList const & paramList,
75 xmlrpc_c::value * const retvalPtr)
77 std::string cookie = paramList.getString(0);
78 paramList.verifyEnd(1);
80 std::map<std::string, xmlrpc_c::value> structVal;
82 if (config->LogoutAdmin(cookie))
84 *retvalPtr = xmlrpc_c::value_boolean(false);
88 *retvalPtr = xmlrpc_c::value_boolean(true);