2022-02-25 21:59:19 +01:00
|
|
|
--[[
|
|
|
|
****************************************************************
|
|
|
|
******* ******
|
|
|
|
******* Support for Matterbridge ******
|
|
|
|
******* (?) by A.C.M. and Bastrabun on your-land ******
|
|
|
|
******* ******
|
|
|
|
****************************************************************
|
|
|
|
|
|
|
|
]]--
|
|
|
|
|
2022-02-25 22:53:38 +01:00
|
|
|
local sc = smart_chat
|
2022-02-25 22:09:48 +01:00
|
|
|
|
2022-02-25 22:53:38 +01:00
|
|
|
if(sc.matterbridge == true) then
|
2022-02-25 21:59:19 +01:00
|
|
|
|
2022-02-25 22:53:38 +01:00
|
|
|
if(minetest.global_exist(yl_matterbridge)) then
|
2022-02-26 16:47:40 +01:00
|
|
|
|
2022-02-26 16:25:48 +01:00
|
|
|
--[[
|
|
|
|
****************************************************************
|
|
|
|
******* Function yl_matterbridge.chat_message ******
|
|
|
|
****************************************************************
|
|
|
|
|
|
|
|
turns the on_register_chat_messages() from matterbridge off
|
|
|
|
because smart_chat has register his own event
|
|
|
|
]]--
|
2022-02-25 23:05:19 +01:00
|
|
|
|
|
|
|
function yl_matterbridge.chat_message(username, message_text)
|
2022-02-25 23:03:39 +01:00
|
|
|
end
|
2022-02-25 23:05:19 +01:00
|
|
|
|
2022-02-26 16:25:48 +01:00
|
|
|
--[[
|
|
|
|
****************************************************************
|
|
|
|
******* Function yl_matterbridge.receive_from_bridge ******
|
|
|
|
****************************************************************
|
|
|
|
|
|
|
|
Overwrites the function handle the message about smart_chat
|
|
|
|
]]--
|
|
|
|
|
2022-02-26 05:02:18 +01:00
|
|
|
function yl_matterbridge.receive_from_bridge(user_name, message_text, account)
|
|
|
|
local line = "<"..account_name.."|" .. user_name .. "> " .. message_text
|
2022-02-26 05:43:29 +01:00
|
|
|
local all_player = minetest.get_connected_players()
|
2022-02-25 21:59:19 +01:00
|
|
|
|
2022-02-26 05:43:29 +01:00
|
|
|
for _,player in pairs(all_player) do
|
|
|
|
local pname = player:get_player_name()
|
2022-02-26 16:47:40 +01:00
|
|
|
if(lib.check_global(pname) or lib.public[pname]) then -- Player is in Pub-Channel
|
2022-02-26 16:25:48 +01:00
|
|
|
lib.chat(pname, line)
|
2022-02-25 22:09:48 +01:00
|
|
|
|
2022-02-26 05:43:29 +01:00
|
|
|
end -- if(lib.check_global
|
|
|
|
|
|
|
|
end -- func(user_name
|
|
|
|
end -- function yl_matterbridge
|
2022-02-26 05:50:43 +01:00
|
|
|
|
2022-02-26 16:25:48 +01:00
|
|
|
--[[
|
|
|
|
****************************************************************
|
|
|
|
******* Function yl_matterbridge.send_2_bridge ******
|
|
|
|
****************************************************************
|
|
|
|
|
|
|
|
Function to send a message to the matterbridge
|
|
|
|
]]--
|
|
|
|
|
2022-02-25 22:53:38 +01:00
|
|
|
function sc.send_2_bridge(user_name, message_text)
|
|
|
|
local line = "<" .. user_name .. "@" .. sc.servername .. "> " .. message_text
|
2022-02-26 16:25:48 +01:00
|
|
|
if(sc.check_global(user_name)) then -- is User in public-channel?
|
2022-02-26 05:02:18 +01:00
|
|
|
yl_matterbridge.send_to_bridge(username, line)
|
2022-02-26 05:50:43 +01:00
|
|
|
|
2022-02-26 05:02:18 +01:00
|
|
|
end -- if(sc.check_global
|
2022-02-25 21:59:19 +01:00
|
|
|
|
2022-02-25 22:53:38 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
end -- if(minetest.global_exist
|
|
|
|
|
|
|
|
end -- if( sc.matterbridge
|
2022-02-25 22:09:48 +01:00
|
|
|
|