aboutsummaryrefslogtreecommitdiff
path: root/hid/main.go
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-02-05 00:30:08 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-02-05 00:31:34 +0100
commitbafd5ef22167527e1bde8aed09b09b62278059b0 (patch)
tree6a951d456e7a65fa4ef1a1d984dd644fd259659f /hid/main.go
parentca245e4aca91747ed6a13a5343ef786d9bf034cb (diff)
downloadhaven-bafd5ef22167527e1bde8aed09b09b62278059b0.tar.gz
haven-bafd5ef22167527e1bde8aed09b09b62278059b0.tar.xz
haven-bafd5ef22167527e1bde8aed09b09b62278059b0.zip
hid: implement WALLOPS
Diffstat (limited to 'hid/main.go')
-rw-r--r--hid/main.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/hid/main.go b/hid/main.go
index e9a0095..fd8d8fb 100644
--- a/hid/main.go
+++ b/hid/main.go
@@ -2854,6 +2854,25 @@ func ircHandleLINKS(msg *message, c *client) {
c.sendReply(RPL_ENDOFLINKS, mask)
}
+func ircHandleWALLOPS(msg *message, c *client) {
+ if len(msg.params) < 1 {
+ c.sendReply(ERR_NEEDMOREPARAMS, msg.command)
+ return
+ }
+ if 0 == c.mode&ircUserModeOperator {
+ c.sendReply(ERR_NOPRIVILEGES)
+ return
+ }
+
+ // Our interpretation: anonymize the sender,
+ // and target all users who want to receive these messages.
+ for _, client := range users {
+ if client == c || 0 != client.mode&ircUserModeRxWallops {
+ client.sendf(":%s WALLOPS :%s", serverName, msg.params[0])
+ }
+ }
+}
+
func ircHandleKILL(msg *message, c *client) {
if len(msg.params) < 2 {
c.sendReply(ERR_NEEDMOREPARAMS, msg.command)
@@ -2908,6 +2927,7 @@ var ircHandlers = map[string]*ircCommand{
"ADMIN": {true, ircHandleADMIN, 0, 0},
"STATS": {true, ircHandleSTATS, 0, 0},
"LINKS": {true, ircHandleLINKS, 0, 0},
+ "WALLOPS": {true, ircHandleWALLOPS, 0, 0},
"MODE": {true, ircHandleMODE, 0, 0},
"PRIVMSG": {true, ircHandlePRIVMSG, 0, 0},