3 Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "s_modchannels.h"
21 #include "s_internal.h"
23 void ScriptApiModChannels::on_modchannel_message(const std::string &channel,
24 const std::string &sender, const std::string &message)
26 SCRIPTAPI_PRECHECKHEADER
28 // Get core.registered_on_generateds
29 lua_getglobal(L, "core");
30 lua_getfield(L, -1, "registered_on_modchannel_message");
32 lua_pushstring(L, channel.c_str());
33 lua_pushstring(L, sender.c_str());
34 lua_pushstring(L, message.c_str());
35 runCallbacks(3, RUN_CALLBACKS_MODE_AND);
38 void ScriptApiModChannels::on_modchannel_signal(
39 const std::string &channel, ModChannelSignal signal)
41 SCRIPTAPI_PRECHECKHEADER
43 // Get core.registered_on_generateds
44 lua_getglobal(L, "core");
45 lua_getfield(L, -1, "registered_on_modchannel_signal");
47 lua_pushstring(L, channel.c_str());
48 lua_pushinteger(L, (int)signal);
49 runCallbacks(2, RUN_CALLBACKS_MODE_AND);