FIxed some problems

This commit is contained in:
Ryan Newell 2014-10-15 18:32:09 -05:00
parent 61871358c2
commit 4556de1087
4 changed files with 8 additions and 5 deletions

View File

@ -122,6 +122,7 @@ core.builtin_auth_handler = {
core.auth_table[name] = {
password = password,
privileges = core.string_to_privs(core.setting_get("default_privs")),
lastlogin = 0,
}
save_auth_file()
end,

View File

@ -126,7 +126,7 @@ bool ScriptApiServer::setPassword(const std::string &playername,
}
bool ScriptApiServer::set_login_time(const std::string &playername,
const std::int &logintime)
int logintime)
{
SCRIPTAPI_PRECHECKHEADER
@ -136,7 +136,7 @@ bool ScriptApiServer::set_login_time(const std::string &playername,
if(lua_type(L, -1) != LUA_TFUNCTION)
throw LuaError("Authentication handler missing set_login_time");
lua_pushstring(L, playername.c_str());
lua_pushNumber(L, logintime);
lua_pushnumber(L, logintime);
if(lua_pcall(L, 2, 1, m_errorhandler))
scriptError();
return lua_toboolean(L, -1);

View File

@ -42,6 +42,8 @@ public:
const std::string &password);
bool setPassword(const std::string &playername,
const std::string &password);
bool set_login_time(const std::string &playername,
int logintime)
private:
void getAuthHandler();
void readPrivileges(int index, std::set<std::string> &result);

View File

@ -1601,11 +1601,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
L"a minute.");
}
time_t time;
time = time(NULL);
time_t logtim;
logtim = time(NULL);
m_script->set_login_time(playername, (int) time);
m_script->set_login_time(playername, (int) logtim);
m_clients.setPlayerName(peer_id,playername);