mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 20:09:41 +01:00
don't Sprintf for each match, Details().nick -> .Nick()
This commit is contained in:
parent
76697dff0f
commit
7345ecba48
@ -2159,7 +2159,7 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
|
|||||||
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") {
|
} else if target[0] == '$' && len(target) > 2 && client.Oper().HasRoleCapab("massmessage") {
|
||||||
details := client.Details()
|
details := client.Details()
|
||||||
matcher, err := utils.CompileGlob(target[1:], false)
|
matcher, err := utils.CompileGlob(target[2:], false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rb.Add(nil, server.name, ERR_UNKNOWNERROR, details.nick, command, client.t("Erroneous target"))
|
rb.Add(nil, server.name, ERR_UNKNOWNERROR, details.nick, command, client.t("Erroneous target"))
|
||||||
return
|
return
|
||||||
@ -2169,10 +2169,10 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
|
|||||||
accountName := details.accountName
|
accountName := details.accountName
|
||||||
isBot := client.HasMode(modes.Bot)
|
isBot := client.HasMode(modes.Bot)
|
||||||
for _, tClient := range server.clients.AllClients() {
|
for _, tClient := range server.clients.AllClients() {
|
||||||
if matcher.MatchString(fmt.Sprintf("$%s", tClient.server.name)) || // $$servername
|
if (target[1] == '$' && matcher.MatchString(tClient.server.name)) || // $$servername
|
||||||
matcher.MatchString(fmt.Sprintf("#%s", tClient.Hostname())) { // $#hostname
|
(target[1] == '#' && matcher.MatchString(tClient.Hostname())) { // $#hostname
|
||||||
|
|
||||||
tnick := tClient.Details().nick
|
tnick := tClient.Nick()
|
||||||
for _, session := range tClient.Sessions() {
|
for _, session := range tClient.Sessions() {
|
||||||
session.sendSplitMsgFromClientInternal(false, nickMaskString, accountName, isBot, nil, command, tnick, message)
|
session.sendSplitMsgFromClientInternal(false, nickMaskString, accountName, isBot, nil, command, tnick, message)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user