~emersion/public-inbox

soju: Join all channels with a single JOIN message v1 NEEDS REVISION

Eyal Sawady: 1
 Join all channels with a single JOIN message

 1 files changed, 20 insertions(+), 7 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/~emersion/public-inbox/patches/10764/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH soju] Join all channels with a single JOIN message Export this patch

---
 upstream.go | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/upstream.go b/upstream.go
index 1f281fe..7125f11 100644
--- a/upstream.go
+++ b/upstream.go
@@ -526,16 +526,29 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
			dc.updateSupportedCaps()
		})

		// TODO: split this into multiple messages if need be
		names := ""
		keys := ""
		for _, ch := range uc.network.channels {
			params := []string{ch.Name}
			if ch.Key != "" {
				params = append(params, ch.Key)
			if names == "" {
				names = ch.Name
			} else {
				names = names + "," + ch.Name
			}
			uc.SendMessage(&irc.Message{
				Command: "JOIN",
				Params:  params,
			})
			if keys == "" {
				keys = ch.Key
			} else {
				keys = names + "," + ch.Key
			}
		}
		params := []string{names}
		if keys != "" {
			params = append(params, keys)
		}
		uc.SendMessage(&irc.Message{
			Command: "JOIN",
			Params: params,
		})
	case irc.RPL_MYINFO:
		if err := parseMessageParams(msg, nil, &uc.serverName, nil, &uc.availableUserModes, nil); err != nil {
			return err
-- 
2.26.2
Thanks for your patch! Here are some comments.