]> Cypherpunks.ru repositories - goircd.git/blobdiff - client.go
Excess loop
[goircd.git] / client.go
index 6a21ab0ce7d415edb05bf3f062f4546e010c23e4..e2bc5b212ad22d61b08cab8930211c5d9d3b69d5 100644 (file)
--- a/client.go
+++ b/client.go
@@ -1,6 +1,6 @@
 /*
 goircd -- minimalistic simple Internet Relay Chat (IRC) server
-Copyright (C) 2014-2020 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2014-2023 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -23,9 +23,9 @@ import (
        "crypto/subtle"
        "encoding/hex"
        "fmt"
-       "io/ioutil"
        "log"
        "net"
+       "os"
        "regexp"
        "sort"
        "strings"
@@ -188,10 +188,7 @@ func (c *Client) Reply(text string) {
 }
 
 func (c *Client) ReplyParts(code string, text ...string) {
-       parts := []string{code}
-       for _, t := range text {
-               parts = append(parts, t)
-       }
+       parts := append([]string{code}, text...)
        parts[len(parts)-1] = ":" + parts[len(parts)-1]
        c.Reply(strings.Join(parts, " "))
 }
@@ -233,7 +230,7 @@ func (c *Client) SendMotd() {
                c.ReplyNicknamed("422", "MOTD File is missing")
                return
        }
-       motdText, err := ioutil.ReadFile(*motd)
+       motdText, err := os.ReadFile(*motd)
        if err != nil {
                log.Printf("can not read motd file %s: %v", *motd, err)
                c.ReplyNicknamed("422", "Error reading MOTD File")
@@ -418,7 +415,7 @@ func (c *Client) Register(cmd string, cols []string) {
                                c.Close()
                                return
                        }
-                       contents, err := ioutil.ReadFile(*passwords)
+                       contents, err := os.ReadFile(*passwords)
                        if err != nil {
                                log.Fatalf("can not read passwords file %s: %s", *passwords, err)
                                return