]> Cypherpunks.ru repositories - goircd.git/blobdiff - goircd.go
Unify copyright comment format
[goircd.git] / goircd.go
index f8aad490d8a47b44f900c022ea9ee7adb7e37bdd..510c81cbdfc956b2485b527b9487c7a9677f1542 100644 (file)
--- a/goircd.go
+++ b/goircd.go
@@ -1,26 +1,23 @@
-/*
-goircd -- minimalistic simple Internet Relay Chat (IRC) server
-Copyright (C) 2014-2020 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
-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 <http://www.gnu.org/licenses/>.
-*/
+// goircd -- minimalistic simple Internet Relay Chat (IRC) server
+// Copyright (C) 2014-2024 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
+// 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 <http://www.gnu.org/licenses/>.
 
 package main
 
 import (
        "crypto/tls"
        "flag"
-       "io/ioutil"
        "log"
        "net"
        "os"
@@ -33,7 +30,7 @@ import (
 )
 
 const (
-       Version = "1.9.0"
+       Version = "1.9.1"
 
        StateTopicFilename = "topic"
        StateKeyFilename   = "key"
@@ -144,7 +141,7 @@ func main() {
                        log.Fatalln("can not read statedir", err)
                }
                for _, state := range states {
-                       buf, err := ioutil.ReadFile(path.Join(state, StateTopicFilename))
+                       buf, err := os.ReadFile(path.Join(state, StateTopicFilename))
                        if err != nil {
                                log.Fatalf(
                                        "can not read state %s/%s: %v",
@@ -153,7 +150,7 @@ func main() {
                        }
                        room := RoomRegister(path.Base(state))
                        room.topic = strings.TrimRight(string(buf), "\n")
-                       buf, err = ioutil.ReadFile(path.Join(state, StateKeyFilename))
+                       buf, err = os.ReadFile(path.Join(state, StateKeyFilename))
                        if err == nil {
                                room.key = strings.TrimRight(string(buf), "\n")
                        } else {
@@ -178,7 +175,7 @@ func main() {
                                }
 
                                topicPath := path.Join(statePath, StateTopicFilename)
-                               if err := ioutil.WriteFile(
+                               if err := os.WriteFile(
                                        topicPath,
                                        []byte(event.topic+"\n"),
                                        permStateFile,
@@ -188,7 +185,7 @@ func main() {
                                }
 
                                keyPath := path.Join(statePath, StateKeyFilename)
-                               if err := ioutil.WriteFile(
+                               if err := os.WriteFile(
                                        keyPath,
                                        []byte(event.key+"\n"),
                                        permStateFile,
@@ -221,7 +218,7 @@ func main() {
        }
        log.Println("goircd", Version, "started")
 
-       needsShutdown := make(chan os.Signal, 0)
+       needsShutdown := make(chan os.Signal, 1)
        signal.Notify(needsShutdown, syscall.SIGTERM, syscall.SIGINT)
        go func() {
                <-needsShutdown