-- ==LuaScript==
-- @name SmileyPackSwitcher
-- @description Switching big-small smileypack
-- @author MikalaiR
-- @version 1.5
-- ==/LuaScript==
-- ==Settings==
local fullpack = "Emoji_full"
-- ==/Settings==
local mbb = require('m_msg_buttonsbar')
local icolib = require('m_icolib')
local db = require('m_database')
local BBBF_ISLSIDEBUTTON = 64
local bbButton =
{
Module = "MirLua_SmileyPackSwitcher",
ButtonID = 1,
Flags = BBBF_ISLSIDEBUTTON,
Tooltip = "Big smiley pack",
Icon = icolib.AddIcon('SmileySwitchIconD', 'SmileyPackSwitcher icon')
}
mbb.AddButton(bbButton)
mbb.OnMsgToolBarButtonPressed(function(w, l)
if l.Module == bbButton.Module and l.ButtonID == bbButton.ButtonID then
if db.GetContactSetting(l.hContact, "SmileyAdd", "CustomCategory") == fullpack then
db.DeleteContactSetting(l.hContact, "SmileyAdd", "CustomCategory")
else
db.WriteContactSetting(l.hContact, "SmileyAdd", "CustomCategory", fullpack)
end
end
end)
-- ==LuaScript==
-- @name LToButton
-- @description
-- @author MikalaiR
-- @version 1.1
-- ==/LuaScript==
-- ==Settings==
-- ==/Settings==
local mbb = require('m_msg_buttonsbar')
local icolib = require('m_icolib')
local vars = require('m_variables')
local db = require('m_database')
local message = require('m_message')
local BBBF_ISLSIDEBUTTON = 64
function GetCurrentSong()
local result = ""
local strArtist = vars.FormatString("%listening_artist%")
local strTitle = vars.FormatString("%listening_title%")
if strArtist ~= "" and strTitle ~= "" then
result = strArtist .. " - " .. strTitle
end
return result
end
function GetOutputText(isChat)
local result = ""
local strCurrentSong = GetCurrentSong()
if strCurrentSong ~= "" then
if isChat ~= 0 then
result = "/me слушает " .. strCurrentSong
else
result = "Я слушаю " .. strCurrentSong
end
else
if isChat ~= 0 then
result = "/me ничего не слушает"
else
result = "Я ничего не слушаю"
end
end
return result
end
local bbButton =
{
Module = "MirLua",
ButtonID = 3,
Flags = BBBF_ISLSIDEBUTTON,
Tooltip = "Я слушаю...",
Icon = icolib.AddIcon('LTButtonIcon', 'ListeningTo button icon')
}
mbb.AddButton(bbButton)
mbb.OnMsgToolBarButtonPressed(function(w, l)
if l.Module == bbButton.Module and l.ButtonID == bbButton.ButtonID then
local contactProto = db.GetContactSetting(l.hContact, "Protocol", "p")
local text = GetOutputText(db.GetContactSetting(l.hContact, contactProto, "ChatRoom", 0))
message.Paste(l.hContact, text)
end
end)
//обновлено 20.07.2015