diff options
Diffstat (limited to 'plugins/MirLua/src/m_protocols.cpp')
-rw-r--r-- | plugins/MirLua/src/m_protocols.cpp | 16 |
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 },
|