summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {