commit fbe14ad

delthas  ·  2021-07-13 17:30:30 +0000 UTC
parent d659947
Automatically join channels on start

Supporting channels with keys and merging JOINs in a single message is
TODO for later. :)
3 files changed,  +12, -1
M app.go
M app.go
+5, -0
 1@@ -457,6 +457,11 @@ func (app *App) handleIRCEvent(ev interface{}) {
 2 	// Mutate UI state
 3 	switch ev := ev.(type) {
 4 	case irc.RegisteredEvent:
 5+		for _, channel := range app.cfg.Channels {
 6+			// TODO: group JOIN messages
 7+			// TODO: support autojoining channels with keys
 8+			app.s.Join(channel, "")
 9+		}
10 		body := new(ui.StyledStringBuilder)
11 		body.WriteString("Connected to the server")
12 		if app.s.Nick() != app.cfg.Nick {
+2, -1
 1@@ -4,8 +4,8 @@ import (
 2 	"errors"
 3 	"fmt"
 4 	"io/ioutil"
 5-	"strings"
 6 	"strconv"
 7+	"strings"
 8 
 9 	"github.com/gdamore/tcell/v2"
10 
11@@ -53,6 +53,7 @@ type Config struct {
12 	User     string
13 	Password *string
14 	NoTLS    bool `yaml:"no-tls"`
15+	Channels []string
16 
17 	NoTypings bool `yaml:"no-typings"`
18 	Mouse     *bool
+5, -0
 1@@ -33,6 +33,10 @@ Some settings are required, the others are optional.
 2 *password*
 3 	Your password, used for SASL authentication.
 4 
 5+*channels*
 6+	A list of channel names that senpai will automatically join at startup and
 7+	server reconnect.
 8+
 9 *highlights*
10 	A list of keywords that will trigger a notification and a display indicator
11 	when said by others.  By default, senpai will use your current nickname.
12@@ -127,6 +131,7 @@ nick: Guest123456
13 user: senpai
14 real: Guest von Lenon
15 password: A secure password, I guess?
16+channels: ["#rahxephon"]
17 highlights:
18 	- guest
19 	- senpai