~taiite/public-inbox

senpai: Automatically join channels on start v1 SUPERSEDED

delthas: 1
 Automatically join channels on start

 3 files changed, 15 insertions(+), 8 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~taiite/public-inbox/patches/23789/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH senpai] Automatically join channels on start Export this patch

Supporting channels with keys and merging JOINs in a single message is
TODO for later. :)
---
 app.go         |  5 +++++
 config.go      |  3 ++-
 irc/session.go | 15 ++++++++-------
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/app.go b/app.go
index 57c12de..3b8e3ad 100644
--- a/app.go
+++ b/app.go
@@ -464,6 +464,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/irc/session.go b/irc/session.go
index e50312f..18a2c6b 100644
--- a/irc/session.go
+++ b/irc/session.go
@@ -104,13 +104,14 @@ type Session struct {
	typings      *Typings             // incoming typing notifications.
	typingStamps map[string]time.Time // user typing instants.

	nick   string
	nickCf string // casemapped nickname.
	user   string
	real   string
	acct   string
	host   string
	auth   SASLClient
	nick     string
	nickCf   string // casemapped nickname.
	user     string
	real     string
	acct     string
	host     string
	auth     SASLClient
	autojoin map[string]string

	availableCaps map[string]string
	enabledCaps   map[string]struct{}
-- 
2.30.0
Seems alright, since even gamja is supporting this feature, though
there is little use for this since senpai isn't really usable without a
bouncer.

Could you please add this configuration option to doc/senpai.5.scd and
I'll push this.