aboutsummaryrefslogtreecommitdiff
path: root/clients.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-12-08 08:52:23 +0800
committerRunxi Yu <me@runxiyu.org>2024-12-08 08:52:23 +0800
commitd201e74fff4e6d82d639d858826bdb4190936c07 (patch)
tree7e5de8e206bf913fc0bbef5eba81b06fa9c1e06c /clients.go
parentAdd basic command handling (diff)
downloadmeseircd-d201e74fff4e6d82d639d858826bdb4190936c07.tar.gz
meseircd-d201e74fff4e6d82d639d858826bdb4190936c07.tar.zst
meseircd-d201e74fff4e6d82d639d858826bdb4190936c07.zip
Server and self awareness
Diffstat (limited to '')
-rw-r--r--clients.go (renamed from client.go)17
1 files changed, 15 insertions, 2 deletions
diff --git a/client.go b/clients.go
index 9c73444..e1b80a6 100644
--- a/client.go
+++ b/clients.go
@@ -5,8 +5,12 @@ import (
)
type Client struct {
- conn net.Conn
- uid [6]byte
+ conn net.Conn
+ UID [6]byte
+ Nick string
+ Ident string
+ Host string
+ Server Server
}
func (client *Client) Send(msg SMsg) {
@@ -23,3 +27,12 @@ func (client *Client) SendRaw(s string) {
client.conn.Close()
}
}
+
+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 {
+ return string(client.Server.SID[:]) + string(client.UID[:])
+}