aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-12-08 21:34:30 +0800
committerRunxi Yu <me@runxiyu.org>2024-12-08 21:34:30 +0800
commitf86032e68213087b8f087245851b915b5f6acfa6 (patch)
tree33e617793050e7ed25a914a70da43e33f5ba4650
parentUID -> CID (diff)
downloadmeseircd-f86032e68213087b8f087245851b915b5f6acfa6.tar.gz
meseircd-f86032e68213087b8f087245851b915b5f6acfa6.tar.zst
meseircd-f86032e68213087b8f087245851b915b5f6acfa6.zip
Server & Client should only have pointer receivers
-rw-r--r--clients.go6
-rw-r--r--main.go2
-rw-r--r--servers.go8
3 files changed, 8 insertions, 8 deletions
diff --git a/clients.go b/clients.go
index 16dea78..1c3f8e0 100644
--- a/clients.go
+++ b/clients.go
@@ -17,7 +17,7 @@ type Client struct {
Host string
Caps map[string]struct{}
Extra map[string]any
- Server Server
+ Server *Server
State ClientState
}
@@ -40,12 +40,12 @@ func (client *Client) SendRaw(s string) error {
return nil
}
-func (client Client) ClientSource() string {
+func (client *Client) ClientSource() string {
// TODO: Edge cases where these aren't available
return client.Nick + "!" + client.Ident + "@" + client.Host
}
-func (client Client) ServerSource() string {
+func (client *Client) ServerSource() string {
return client.CID
}
diff --git a/main.go b/main.go
index 3f6025a..b17c713 100644
--- a/main.go
+++ b/main.go
@@ -16,7 +16,7 @@ func main() {
setupCapls()
- self = Server{
+ self = &Server{
conn: nil,
SID: "001",
Name: "irc.runxiyu.org",
diff --git a/servers.go b/servers.go
index 4cc8b31..f9dd319 100644
--- a/servers.go
+++ b/servers.go
@@ -16,7 +16,7 @@ func (server *Server) Send(msg SMsg) error {
}
func (server *Server) SendRaw(s string) error {
- if server == &self {
+ if server == self {
return ErrSendToSelf
}
if server.conn == nil {
@@ -34,12 +34,12 @@ func (server *Server) SendRaw(s string) error {
return nil
}
-func (server Server) ClientSource() string {
+func (server *Server) ClientSource() string {
return server.Name
}
-func (server Server) ServerSource() string {
+func (server *Server) ServerSource() string {
return server.SID
}
-var self Server
+var self *Server