diff --git a/default.yaml b/default.yaml index c97a2b84..4b6fb9c0 100644 --- a/default.yaml +++ b/default.yaml @@ -622,6 +622,7 @@ oper-classes: - "chanreg" - "history" - "defcon" + - "massmessage" # ircd operators opers: diff --git a/irc/handlers.go b/irc/handlers.go index c8d6a311..c6e36c3b 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -2157,6 +2157,27 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi return } channel.SendSplitMessage(command, lowestPrefix, tags, client, message, rb) + } else if target[0] == '$' && len(target) > 2 && client.Oper().HasRoleCapab("massmessage") { + details := client.Details() + matcher, err := utils.CompileGlob(target[2:], false) + if err != nil { + rb.Add(nil, server.name, ERR_UNKNOWNERROR, details.nick, command, client.t("Erroneous target")) + return + } + + nickMaskString := details.nickMask + accountName := details.accountName + isBot := client.HasMode(modes.Bot) + for _, tClient := range server.clients.AllClients() { + if (target[1] == '$' && matcher.MatchString(tClient.server.name)) || // $$servername + (target[1] == '#' && matcher.MatchString(tClient.Hostname())) { // $#hostname + + tnick := tClient.Nick() + for _, session := range tClient.Sessions() { + session.sendSplitMsgFromClientInternal(false, nickMaskString, accountName, isBot, nil, command, tnick, message) + } + } + } } else { lowercaseTarget := strings.ToLower(target) service, isService := OragonoServices[lowercaseTarget] diff --git a/traditional.yaml b/traditional.yaml index 92d95728..8776dff6 100644 --- a/traditional.yaml +++ b/traditional.yaml @@ -594,6 +594,7 @@ oper-classes: - "chanreg" - "history" - "defcon" + - "massmessage" # ircd operators opers: