summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2021-05-20 15:14:08 +0200
committerHubert Hirtz <hubert@hirtz.pm>2021-05-20 22:45:48 +0200
commit9e679e266060b18f2239a8c0b84dab29aefa8230 (patch)
tree855389f5ce12275060c9f6b9394971fb799e9370
parentSeparate command handling from plain messages (diff)
Explicitly support keys in JOIN messages
-rw-r--r--commands.go6
-rw-r--r--irc/session.go9
2 files changed, 11 insertions, 4 deletions
diff --git a/commands.go b/commands.go
index 437bf77..a0cd411 100644
--- a/commands.go
+++ b/commands.go
@@ -197,7 +197,11 @@ func commandDoHelp(app *App, buffer string, args []string) (err error) {
}
func commandDoJoin(app *App, buffer string, args []string) (err error) {
- app.s.Join(args[0])
+ key := ""
+ if len(args) == 2 {
+ key = args[1]
+ }
+ app.s.Join(args[0], key)
return
}
diff --git a/irc/session.go b/irc/session.go
index 69d29aa..e50312f 100644
--- a/irc/session.go
+++ b/irc/session.go
@@ -266,9 +266,12 @@ func (s *Session) SendRaw(raw string) {
s.out <- NewMessage(raw)
}
-func (s *Session) Join(channel string) {
- // TODO support keys
- s.out <- NewMessage("JOIN", channel)
+func (s *Session) Join(channel, key string) {
+ if key == "" {
+ s.out <- NewMessage("JOIN", channel)
+ } else {
+ s.out <- NewMessage("JOIN", channel, key)
+ }
}
func (s *Session) Part(channel, reason string) {