summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/m_protocols.cpp
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2017-10-10 21:55:12 +0300
committeraunsane <aunsane@gmail.com>2017-10-10 21:55:26 +0300
commit39e461bb614d75a6f23511a016afaeb3aba35f1a (patch)
treeb61e3b3571bec7cb072abf91b512d0c398ee9195 /plugins/MirLua/src/m_protocols.cpp
parentd3387c7307fa3f883e77c17e443874b3a085ded5 (diff)
MirLua:
- m_json moved into base plugin - added m_http module -version bump
Diffstat (limited to 'plugins/MirLua/src/m_protocols.cpp')
-rw-r--r--plugins/MirLua/src/m_protocols.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/MirLua/src/m_protocols.cpp b/plugins/MirLua/src/m_protocols.cpp
index 42b24c4936..ab206489f2 100644
--- a/plugins/MirLua/src/m_protocols.cpp
+++ b/plugins/MirLua/src/m_protocols.cpp
@@ -64,6 +64,21 @@ 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);
@@ -222,6 +237,7 @@ static luaL_Reg protocolsApi[] =
{
{ "GetProtocol", lua_GetProtocol },
{ "Protocols", lua_Protocols },
+ { "RegisterProtocol", lua_Protocols },
{ "CallSendChain", lua_ChainSend },
{ "CallReceiveChain", lua_ChainRecv },