From b987b7a8e5a78ff3cd63da062917b1c5fce91cc2 Mon Sep 17 00:00:00 2001 From: aunsane Date: Wed, 21 Mar 2018 01:28:14 +0300 Subject: MurLua: various fixes - fixed script reloading - fixed string interpolation - hook and service refs moved to Enviroment - removed RegisterProtocol from m_protocols - code cleanup - version bump --- plugins/MirLua/src/m_protocols.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'plugins/MirLua/src/m_protocols.cpp') diff --git a/plugins/MirLua/src/m_protocols.cpp b/plugins/MirLua/src/m_protocols.cpp index 4ecb5d7b3c..a2e3d7fbc1 100644 --- a/plugins/MirLua/src/m_protocols.cpp +++ b/plugins/MirLua/src/m_protocols.cpp @@ -6,8 +6,7 @@ static int lua_GetProtocol(lua_State *L) { const char *szProto = nullptr; - switch (lua_type(L, 1)) - { + switch (lua_type(L, 1)) { case LUA_TNUMBER: { const char *szModule = GetContactProto(lua_tonumber(L, 1)); @@ -38,8 +37,7 @@ static int lua_ProtocolIterator(lua_State *L) int count = lua_tointeger(L, lua_upvalueindex(2)); PROTOCOLDESCRIPTOR **protos = (PROTOCOLDESCRIPTOR**)lua_touserdata(L, lua_upvalueindex(3)); - if (i < count) - { + if (i < count) { lua_pushinteger(L, (i + 1)); lua_replace(L, lua_upvalueindex(1)); MT::Apply(L, protos[i]); @@ -64,21 +62,6 @@ static int lua_Protocols(lua_State *L) return 1; } -static int lua_RegisterProtocol(lua_State *L) -{ - ptrA name(mir_utf8decodeA(luaL_checkstring(L, 1))); - - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = name; - pd.type = PROTOTYPE_PROTOCOL; - int res = Proto_RegisterModule(&pd); - - lua_pushboolean(L, res == 0); - - return 1; -} - static int lua_ChainSend(lua_State *L) { MCONTACT hContact = luaL_checknumber(L, 1); @@ -237,7 +220,6 @@ static luaL_Reg protocolsApi[] = { { "GetProtocol", lua_GetProtocol }, { "Protocols", lua_Protocols }, - { "RegisterProtocol", lua_RegisterProtocol }, { "CallSendChain", lua_ChainSend }, { "CallReceiveChain", lua_ChainRecv }, -- cgit v1.2.3