~taiite/public-inbox

senpai: Don't double-enable caps v1 APPLIED

Simon Ser: 1
 Don't double-enable caps

 1 files changed, 4 insertions(+), 2 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/27015/mbox | git am -3
Learn more about email & git

[PATCH senpai] Don't double-enable caps Export this patch

Some servers might adjust their sasl cap at runtime, e.g.

    CAP NEW sasl=PLAIN,EXTERNAL
    […]
    CAP NEW sasl=PLAIN

In this case, we don't really want to `CAP REQ sasl` again, because
this will make us re-authenticate a second time.

Avoid requesting caps which have already been ACKed.
---
 irc/session.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/irc/session.go b/irc/session.go
index b6d5873ca79a..87b77b62a2bf 100644
--- a/irc/session.go
+++ b/irc/session.go
@@ -650,8 +650,10 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
		case "NEW":
			for _, c := range ParseCaps(caps) {
				s.availableCaps[c.Name] = c.Value
				_, ok := SupportedCapabilities[c.Name]
				if !ok {
				if _, ok := SupportedCapabilities[c.Name]; !ok {
					continue
				}
				if _, ok := s.enabledCaps[c.Name]; ok {
					continue
				}
				s.out <- NewMessage("CAP", "REQ", c.Name)

base-commit: 3904c9190d94f273c0ae9937d3161b9fe4adf856
-- 
2.34.1
LGTM