1
0
Fork 0
forked from External/ergo

modes: Add experimental, untested +R user mode to block messages from unregistered users

This commit is contained in:
Daniel Oaks 2017-08-17 17:52:30 +10:00
parent b975c6f182
commit f9ef97b204
3 changed files with 17 additions and 7 deletions

View file

@ -1133,7 +1133,11 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
clientOnlyTags = nil
}
msgid := server.generateMessageID()
user.SendSplitMsgFromClient(msgid, client, clientOnlyTags, "PRIVMSG", user.nick, splitMsg)
// restrict messages appropriately when +R is set
// intentionally make the sending user think the message went through fine
if !user.flags[RegisteredOnly] || client.registered {
user.SendSplitMsgFromClient(msgid, client, clientOnlyTags, "PRIVMSG", user.nick, splitMsg)
}
if client.capabilities[EchoMessage] {
client.SendSplitMsgFromClient(msgid, client, clientOnlyTags, "PRIVMSG", user.nick, splitMsg)
}
@ -1829,7 +1833,11 @@ func noticeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
clientOnlyTags = nil
}
msgid := server.generateMessageID()
user.SendSplitMsgFromClient(msgid, client, clientOnlyTags, "NOTICE", user.nick, splitMsg)
// restrict messages appropriately when +R is set
// intentionally make the sending user think the message went through fine
if !user.flags[RegisteredOnly] || client.registered {
user.SendSplitMsgFromClient(msgid, client, clientOnlyTags, "NOTICE", user.nick, splitMsg)
}
if client.capabilities[EchoMessage] {
client.SendSplitMsgFromClient(msgid, client, clientOnlyTags, "NOTICE", user.nick, splitMsg)
}