X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=client.go;h=6cacbdb81ac27fa248ca3aa474b30ed602aeaacc;hb=HEAD;hp=0bfc5371669bd5ec9824cd1cf217b6c03090ad4e;hpb=eaf030e5c88acd8658e8990f4449486f7e2dbc82;p=goircd.git diff --git a/client.go b/client.go index 0bfc537..6cacbdb 100644 --- a/client.go +++ b/client.go @@ -1,19 +1,17 @@ -/* -goircd -- minimalistic simple Internet Relay Chat (IRC) server -Copyright (C) 2014-2021 Sergey Matveev - -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 -the Free Software Foundation, version 3 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ +// goircd -- minimalistic simple Internet Relay Chat (IRC) server +// Copyright (C) 2014-2024 Sergey Matveev +// +// 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 +// the Free Software Foundation, version 3 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . package main @@ -23,9 +21,9 @@ import ( "crypto/subtle" "encoding/hex" "fmt" - "io/ioutil" "log" "net" + "os" "regexp" "sort" "strings" @@ -188,10 +186,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 +228,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 +413,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