Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
s_server.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include "cpp_api/s_base.h"
8#include <set>
9
11 : virtual public ScriptApiBase
12{
13public:
14 // Calls on_chat_message handlers
15 // Returns true if script handled message
16 bool on_chat_message(const std::string &name, const std::string &message);
17
18 // Calls when mods are loaded
19 void on_mods_loaded();
20
21 // Calls on_shutdown handlers
22 void on_shutdown();
23
24 // Calls core.format_chat_message
25 std::string formatChatMessage(const std::string &name,
26 const std::string &message);
27
28 /* auth */
29 bool getAuth(const std::string &playername,
30 std::string *dst_password,
31 std::set<std::string> *dst_privs,
32 s64 *dst_last_login = nullptr);
33 void createAuth(const std::string &playername,
34 const std::string &password);
35 bool setPassword(const std::string &playername,
36 const std::string &password);
37
38 /* dynamic media handling */
39 static u32 allocateDynamicMediaCallback(lua_State *L, int f_idx);
40 void freeDynamicMediaCallback(u32 token);
41 void on_dynamic_media_added(u32 token, const std::string &playername);
42
43private:
44 void getAuthHandler();
45 void readPrivileges(int index, std::set<std::string> &result);
46};
Definition s_base.h:64
Definition s_server.h:12
static u32 allocateDynamicMediaCallback(lua_State *L, int f_idx)
Definition s_server.cpp:186
bool getAuth(const std::string &playername, std::string *dst_password, std::set< std::string > *dst_privs, s64 *dst_last_login=nullptr)
Definition s_server.cpp:10
void freeDynamicMediaCallback(u32 token)
Definition s_server.cpp:219
void createAuth(const std::string &playername, const std::string &password)
Definition s_server.cpp:91
void getAuthHandler()
Definition s_server.cpp:54
void readPrivileges(int index, std::set< std::string > &result)
Definition s_server.cpp:72
void on_shutdown()
Definition s_server.cpp:152
bool on_chat_message(const std::string &name, const std::string &message)
Definition s_server.cpp:126
std::string formatChatMessage(const std::string &name, const std::string &message)
Definition s_server.cpp:163
bool setPassword(const std::string &playername, const std::string &password)
Definition s_server.cpp:108
void on_mods_loaded()
Definition s_server.cpp:141
void on_dynamic_media_added(u32 token, const std::string &playername)
Definition s_server.cpp:234