aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-12-08 09:25:21 +0800
committerRunxi Yu <me@runxiyu.org>2024-12-08 09:25:21 +0800
commit337995010159041aaf52b7749b46a0c0f55288d1 (patch)
tree373af2f37ebf26ceceea125405cd4b76ab02e2f7 /main.go
parentMake Client.conn optional (diff)
downloadmeseircd-337995010159041aaf52b7749b46a0c0f55288d1.tar.gz
meseircd-337995010159041aaf52b7749b46a0c0f55288d1.tar.zst
meseircd-337995010159041aaf52b7749b46a0c0f55288d1.zip
Primitive client states
Diffstat (limited to '')
-rw-r--r--main.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.go b/main.go
index 34d132e..fdff8b2 100644
--- a/main.go
+++ b/main.go
@@ -5,9 +5,13 @@ import (
"log"
"log/slog"
"net"
+ "os"
)
func main() {
+ logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug}))
+ slog.SetDefault(logger)
+
self = Server{
conn: nil,
SID: [3]byte{'1', 'H', 'C'},
@@ -29,6 +33,7 @@ func main() {
client := &Client{
conn: &conn,
Server: self,
+ State: ClientStatePreRegistration,
}
go func() {
defer func() {
@@ -56,6 +61,7 @@ messageLoop:
(*client.conn).Close()
return
}
+ slog.Debug("recv", "line", line, "conn", client.conn)
msg, err := parseIRCMsg(line)
if err != nil {
switch err {