3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-26 05:49:25 +01:00

Merge pull request #1629 from jesopo/global-notice

implement mass/global messaging
This commit is contained in:
Shivaram Lingamneni 2021-04-21 07:58:40 -04:00 committed by GitHub
commit 8bf6231ec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

View File

@ -622,6 +622,7 @@ oper-classes:
- "chanreg" - "chanreg"
- "history" - "history"
- "defcon" - "defcon"
- "massmessage"
# ircd operators # ircd operators
opers: opers:

View File

@ -2157,6 +2157,27 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
return return
} }
channel.SendSplitMessage(command, lowestPrefix, tags, client, message, rb) 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 { } else {
lowercaseTarget := strings.ToLower(target) lowercaseTarget := strings.ToLower(target)
service, isService := OragonoServices[lowercaseTarget] service, isService := OragonoServices[lowercaseTarget]

View File

@ -594,6 +594,7 @@ oper-classes:
- "chanreg" - "chanreg"
- "history" - "history"
- "defcon" - "defcon"
- "massmessage"
# ircd operators # ircd operators
opers: opers: