diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/MirLua/docs/examples/database.lua | 14 | ||||
-rw-r--r-- | plugins/MirLua/src/m_database.cpp | 4 | ||||
-rw-r--r-- | plugins/MirLua/src/m_genmenu.cpp | 5 | ||||
-rw-r--r-- | plugins/MirLua/src/m_msg_buttonsbar.cpp | 7 |
4 files changed, 17 insertions, 13 deletions
diff --git a/plugins/MirLua/docs/examples/database.lua b/plugins/MirLua/docs/examples/database.lua index 33b6863322..93c17cb818 100644 --- a/plugins/MirLua/docs/examples/database.lua +++ b/plugins/MirLua/docs/examples/database.lua @@ -6,25 +6,23 @@ local db = require('m_database') -- @param module The name of section -- @param setting The name of setting -- @return value The value -db.WriteContactSetting(nil, 'MirLua', 'testByte', true) db.WriteContactSetting(nil, 'MirLua', 'testNum', -2342) -db.WriteContactSetting(nil, 'MirLua', 'testString', "Hello!") --- Return value from database -- @param hContact The handle of contact (can be NULL) -- @param module The name of section -- @param setting The name of setting -local str = db.GetContactSetting(nil, 'MirLua', 'testString'); +-- @param default The value which will be returned if setting doesn't not exists +local bValue = db.GetContactSetting(nil, 'MirLua', 'testByte'); -- print string value if bool value is true -if db.GetContactSetting(nil, 'MirLua', 'testByte') then - print(str) +if bValue then + local sValue = db.GetContactSetting(nil, 'MirLua', 'testString', 'Hello!') + print(sValue) end --- Delete value from database -- @param hContact The handle of contact (can be NULL) -- @param module The name of section -- @param setting The name of setting -db.DeleteContactSetting(nil, 'MirLua', 'testString'); - -db.WriteContactSetting(nil, 'MirLua', 'ShowConsole', 1) +db.DeleteContactSetting(nil, 'MirLua', 'testNum'); diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp index 91f7361e88..5aedf56b8f 100644 --- a/plugins/MirLua/src/m_database.cpp +++ b/plugins/MirLua/src/m_database.cpp @@ -59,7 +59,7 @@ static int lua_GetContactSetting(lua_State *L) DBVARIANT dbv;
if (db_get(hContact, szModule, szSetting, &dbv))
{
- lua_pushnil(L);
+ lua_pushvalue(L, 4);
return 1;
}
@@ -85,7 +85,7 @@ static int lua_GetContactSetting(lua_State *L) default:
db_free(&dbv);
- lua_pushnil(L);
+ lua_pushvalue(L, 4);
return 1;
}
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index cda7655a77..2e4445d71d 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -7,7 +7,10 @@ static CLISTMENUITEM* MakeMenuItem(lua_State *L) lua_pushstring(L, "Name");
lua_gettable(L, -2);
- pmi->pszName = mir_utf8decode((char*)luaL_checkstring(L, -1), NULL);
+ if (!(pmi->flags & CMIF_UNICODE))
+ pmi->pszName = mir_utf8decode((char*)lua_tostring(L, -1), NULL);
+ else
+ pmi->ptszName = mir_utf8decodeT((char*)luaL_checkstring(L, -1));
lua_pop(L, 1);
lua_pushstring(L, "Flags");
diff --git a/plugins/MirLua/src/m_msg_buttonsbar.cpp b/plugins/MirLua/src/m_msg_buttonsbar.cpp index bdaabf2a94..a9b1f6756f 100644 --- a/plugins/MirLua/src/m_msg_buttonsbar.cpp +++ b/plugins/MirLua/src/m_msg_buttonsbar.cpp @@ -18,12 +18,15 @@ static BBButton* MakeBBButton(lua_State *L) lua_pushstring(L, "Flags");
lua_gettable(L, -2);
- tbb->bbbFlags = BBBF_ISLSIDEBUTTON | lua_tointeger(L, -1);
+ tbb->bbbFlags = lua_tointeger(L, -1);
lua_pop(L, 1);
lua_pushstring(L, "Tooltip");
lua_gettable(L, -2);
- tbb->ptszTooltip = mir_utf8decodeT((char*)lua_tostring(L, -1));
+ if ((tbb->bbbFlags & BBBF_ANSITOOLTIP))
+ tbb->pszTooltip = mir_utf8decode((char*)lua_tostring(L, -1), NULL);
+ else
+ tbb->ptszTooltip = mir_utf8decodeT((char*)lua_tostring(L, -1));
lua_pop(L, 1);
lua_pushstring(L, "Icon");
|