irc icon indicating copy to clipboard operation
irc copied to clipboard

IRC should override `minetest.send_join/leave_message`

Open magnetar47 opened this issue 2 years ago • 0 comments

Hello. We have a mod in CTF that over-rides minetest.send_join/leave_message to hide the join and leave messages of a certain group of players. While that works for in-game messages, IRC bypasses the aforementioned functions and directly outputs the message to the channel (if set to send join/leave messages). So mods don't have the opportunity to suppress join/leave messages for select players, and other such use-cases.

I was wondering if IRC could instead override minetest.send_join/leave_message like so:

local old_join_func = minetest.send_join_message
function minetest.send_join_message(player_name, ...)
	// Announce player join on IRC channel
	irc.say("*** "..name.." joined the game")

	return old_join_func(player_name, ...)
end

So then I can do:

local old_join_func - minetest.send_join_message
function minetest.send_join_message(pname, ...)
	-- Skip join message if player matches super special criteria
	if not super_special_criteria(pname) then
		return old_join_func(pname, ...)
	end
end

Thoughts and discussion welcome. I'd be willing to implement this if people think this is a good idea.

magnetar47 avatar Aug 13 '22 15:08 magnetar47