Procházet zdrojové kódy

don't Sprintf for each match, Details().nick -> .Nick()

tags/v2.7.0-rc1
jesopo před 3 roky
rodič
revize
7345ecba48
1 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 4
    4
      irc/handlers.go

+ 4
- 4
irc/handlers.go Zobrazit soubor

@@ -2159,7 +2159,7 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
2159 2159
 		channel.SendSplitMessage(command, lowestPrefix, tags, client, message, rb)
2160 2160
 	} else if target[0] == '$' && len(target) > 2 && client.Oper().HasRoleCapab("massmessage") {
2161 2161
 		details := client.Details()
2162
-		matcher, err := utils.CompileGlob(target[1:], false)
2162
+		matcher, err := utils.CompileGlob(target[2:], false)
2163 2163
 		if err != nil {
2164 2164
 			rb.Add(nil, server.name, ERR_UNKNOWNERROR, details.nick, command, client.t("Erroneous target"))
2165 2165
 			return
@@ -2169,10 +2169,10 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
2169 2169
 		accountName := details.accountName
2170 2170
 		isBot := client.HasMode(modes.Bot)
2171 2171
 		for _, tClient := range server.clients.AllClients() {
2172
-			if matcher.MatchString(fmt.Sprintf("$%s", tClient.server.name)) ||    // $$servername
2173
-				matcher.MatchString(fmt.Sprintf("#%s", tClient.Hostname())) { // $#hostname
2172
+			if (target[1] == '$' && matcher.MatchString(tClient.server.name)) ||    // $$servername
2173
+				(target[1] == '#' && matcher.MatchString(tClient.Hostname())) { // $#hostname
2174 2174
 
2175
-				tnick := tClient.Details().nick
2175
+				tnick := tClient.Nick()
2176 2176
 				for _, session := range tClient.Sessions() {
2177 2177
 					session.sendSplitMsgFromClientInternal(false, nickMaskString, accountName, isBot, nil, command, tnick, message)
2178 2178
 				}

Načítá se…
Zrušit
Uložit