summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/MirLua/src/m_genmenu.cpp50
-rw-r--r--plugins/MirLua/src/m_msg_buttonsbar.cpp2
-rw-r--r--plugins/MirLua/src/mlua_utils.cpp2
3 files changed, 9 insertions, 45 deletions
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp
index bccf9b835e..a5f2ccc6d1 100644
--- a/plugins/MirLua/src/m_genmenu.cpp
+++ b/plugins/MirLua/src/m_genmenu.cpp
@@ -9,8 +9,8 @@ static void MakeMenuItem(lua_State *L, CMenuItem &mi)
mi.flags = lua_tointeger(L, -1);
lua_pop(L, 1);
- if (!(mi.flags & CMIF_UNICODE))
- mi.flags |= CMIF_UNICODE;
+ if (!(mi.flags & CMIF_TCHAR))
+ mi.flags |= CMIF_TCHAR;
lua_pushstring(L, "Name");
lua_gettable(L, -2);
@@ -38,43 +38,11 @@ static void MakeMenuItem(lua_State *L, CMenuItem &mi)
lua_pop(L, 1);
}
-static int lua_AddMainMenuItem(lua_State *L)
+static int lua_AddMenuItem(lua_State *L)
{
- if (lua_type(L, 1) != LUA_TTABLE)
- {
- lua_pushlightuserdata(L, 0);
- return 1;
- }
-
- CMenuItem mi;
- MakeMenuItem(L, mi);
+ int hMenuObject = lua_tointeger(L, 1);
- HGENMENU res = ::Menu_AddMainMenuItem(&mi);
- lua_pushlightuserdata(L, res);
-
- return 1;
-}
-
-static int lua_AddContactMenuItem(lua_State *L)
-{
- if (lua_type(L, 1) != LUA_TTABLE)
- {
- lua_pushlightuserdata(L, 0);
- return 1;
- }
-
- CMenuItem mi;
- MakeMenuItem(L, mi);
-
- HGENMENU res = ::Menu_AddContactMenuItem(&mi, NULL);
- lua_pushlightuserdata(L, res);
-
- return 1;
-}
-
-static int lua_AddTrayMenuItem(lua_State *L)
-{
- if (lua_type(L, 1) != LUA_TTABLE)
+ if (lua_type(L, 2) != LUA_TTABLE)
{
lua_pushlightuserdata(L, 0);
return 1;
@@ -83,7 +51,7 @@ static int lua_AddTrayMenuItem(lua_State *L)
CMenuItem mi;
MakeMenuItem(L, mi);
- HGENMENU res = (HGENMENU)::CallService("CList/AddTrayMenuItem", 0, (LPARAM)&mi);
+ HGENMENU res = ::Menu_AddItem(hMenuObject, &mi, NULL);
lua_pushlightuserdata(L, res);
return 1;
@@ -92,7 +60,7 @@ static int lua_AddTrayMenuItem(lua_State *L)
static int lua_ModifyMenuItem(lua_State *L)
{
HGENMENU hMenuItem = (HGENMENU)lua_touserdata(L, 1);
- ptrT name(mir_utf8decodeT(luaL_checkstring(L, 2)));
+ ptrT name(mir_utf8decodeT(lua_tostring(L, 2)));
HANDLE hIcolibItem = lua_touserdata(L, 3);
int flags = lua_tointeger(L, 4);
@@ -146,9 +114,7 @@ static int lua_RemoveMenuItem(lua_State *L)
static luaL_Reg genmenuApi[] =
{
- { "AddMainMenuItem", lua_AddMainMenuItem },
- { "AddContactMenuItem", lua_AddContactMenuItem },
- { "AddTrayMenuItem", lua_AddTrayMenuItem },
+ { "AddMenuItem", lua_AddMenuItem },
{ "ModifyMenuItem", lua_ModifyMenuItem },
{ "ShowMenuItem", lua_ShowMenuItem },
{ "EnableMenuItem", lua_EnableMenuItem },
diff --git a/plugins/MirLua/src/m_msg_buttonsbar.cpp b/plugins/MirLua/src/m_msg_buttonsbar.cpp
index 6bfc73550c..4d969fdfa6 100644
--- a/plugins/MirLua/src/m_msg_buttonsbar.cpp
+++ b/plugins/MirLua/src/m_msg_buttonsbar.cpp
@@ -50,8 +50,6 @@ static int lua_AddButton(lua_State *L)
INT_PTR res = ::CallService(MS_BB_ADDBUTTON, 0, (LPARAM)bbb);
lua_pushinteger(L, res);
- mir_free(bbb->pszModuleName);
- mir_free(bbb->ptszTooltip);
return 1;
}
diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp
index 371b23d95b..d4eded5ea9 100644
--- a/plugins/MirLua/src/mlua_utils.cpp
+++ b/plugins/MirLua/src/mlua_utils.cpp
@@ -3,7 +3,7 @@
bool luaM_checkboolean(lua_State *L, int idx)
{
luaL_checktype(L, 2, LUA_TBOOLEAN);
- return lua_toboolean(L, idx);
+ return lua_toboolean(L, idx) > 0;
}
WPARAM luaM_towparam(lua_State *L, int idx)