~emersion/soju-dev

Fix "user not active" error message v1 REJECTED

Hubert Hirtz: 1
 Fix "user not active" error message

 2 files changed, 11 insertions(+), 10 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/soju-dev/patches/25249/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] Fix "user not active" error message Export this patch

---
 downstream.go |  5 +----
 server.go     | 16 ++++++++++------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/downstream.go b/downstream.go
index 5f78b34..9102e5c 100644
--- a/downstream.go
+++ b/downstream.go
@@ -988,10 +988,7 @@ func (dc *downstreamConn) authenticate(username, password string) error {
		return errAuthFailed
	}

	dc.user = dc.srv.getUser(username)
	if dc.user == nil {
		dc.user = dc.srv.addUser(u)
	}
	dc.user = dc.srv.getOrAddUser(u)
	dc.clientName = clientName
	dc.networkName = networkName
	return nil
diff --git a/server.go b/server.go
index 7aeba3a..1be27af 100644
--- a/server.go
+++ b/server.go
@@ -139,6 +139,16 @@ func (s *Server) getUser(name string) *user {
	return u
}

func (s *Server) getOrAddUser(user *User) *user {
	s.lock.Lock()
	u := s.users[user.Username]
	if u == nil {
		u = s.addUserLocked(user)
	}
	s.lock.Unlock()
	return u
}

func (s *Server) addUserLocked(user *User) *user {
	s.Logger.Printf("starting bouncer for user %q", user.Username)
	u := newUser(s, user)
@@ -159,12 +169,6 @@ func (s *Server) addUserLocked(user *User) *user {
	return u
}

func (s *Server) addUser(user *User) *user {
	s.lock.Lock()
	defer s.lock.Unlock()
	return s.addUserLocked(user)
}

var lastDownstreamID uint64 = 0

func (s *Server) handle(ic ircConn) {
-- 
2.33.0
Thanks for working on this. However this just works around the root cause:
sojuctl changes the DB under soju's nose. Other changes like password updates
will still not be propagated. I'd rather be consistent for now, and properly
fix the issue with IPC.