summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2021-07-13 19:30:30 +0200
committerHubert Hirtz <hubert@hirtz.pm>2021-07-13 23:12:56 +0200
commitfbe14ad58816ed90e22c1dd998cea2844f0fed38 (patch)
tree83853289e2a8ca156a2e490ba7b5380d0d3b94b6
parentDon't send typing=done when input is already empty (diff)
Automatically join channels on start
Supporting channels with keys and merging JOINs in a single message is TODO for later. :)
-rw-r--r--app.go5
-rw-r--r--config.go3
-rw-r--r--doc/senpai.5.scd5
3 files changed, 12 insertions, 1 deletions
diff --git a/app.go b/app.go
index 820a356..4bd12db 100644
--- a/app.go
+++ b/app.go
@@ -457,6 +457,11 @@ func (app *App) handleIRCEvent(ev interface{}) {
// Mutate UI state
switch ev := ev.(type) {
case irc.RegisteredEvent:
+ for _, channel := range app.cfg.Channels {
+ // TODO: group JOIN messages
+ // TODO: support autojoining channels with keys
+ app.s.Join(channel, "")
+ }
body := new(ui.StyledStringBuilder)
body.WriteString("Connected to the server")
if app.s.Nick() != app.cfg.Nick {
diff --git a/config.go b/config.go
index b744ba8..10656f4 100644
--- a/config.go
+++ b/config.go
@@ -4,8 +4,8 @@ import (
"errors"
"fmt"
"io/ioutil"
- "strings"
"strconv"
+ "strings"
"github.com/gdamore/tcell/v2"
@@ -53,6 +53,7 @@ type Config struct {
User string
Password *string
NoTLS bool `yaml:"no-tls"`
+ Channels []string
NoTypings bool `yaml:"no-typings"`
Mouse *bool
diff --git a/doc/senpai.5.scd b/doc/senpai.5.scd
index 66a2ccd..b3edd18 100644
--- a/doc/senpai.5.scd
+++ b/doc/senpai.5.scd
@@ -33,6 +33,10 @@ Some settings are required, the others are optional.
*password*
Your password, used for SASL authentication.
+*channels*
+ A list of channel names that senpai will automatically join at startup and
+ server reconnect.
+
*highlights*
A list of keywords that will trigger a notification and a display indicator
when said by others. By default, senpai will use your current nickname.
@@ -127,6 +131,7 @@ nick: Guest123456
user: senpai
real: Guest von Lenon
password: A secure password, I guess?
+channels: ["#rahxephon"]
highlights:
- guest
- senpai