From 458ab0a054c632e4dab584cc7ff0edcb06e7c9c4 Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 24 Mar 2018 15:04:09 +1300 Subject: [PATCH] never send blank nicks (FIXES yaaic/atomic, Revolution IRC) --HG-- branch : nmdc-ircfrontend --- server.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index a4a1ced..10f1497 100644 --- a/server.go +++ b/server.go @@ -59,6 +59,7 @@ type Server struct { recievedFirstServerMessage bool recievedCtcpVersion bool nickChangeAttempt int + sentFakeSelfJoin bool quirks Quirks } @@ -210,8 +211,12 @@ func (s *Server) upstreamWorker() { case hubEvent := <-s.upstreamEvents: switch hubEvent.EventType { case libnmdc.EVENT_USER_JOINED: - s.reply(rplJoin, hubEvent.Nick, BLESSED_CHANNEL) - // If we want to JOIN with the full power of the supplied nick!user@host, then we'll need to actually remember the active client's USER parameters + if hubEvent.Nick == s.clientNick() && s.sentFakeSelfJoin { + s.sentFakeSelfJoin = false + } else { + // If we want to JOIN with the full power of the supplied nick!user@host, then we'll need to actually remember the active client's USER parameters + s.reply(rplJoin, hubEvent.Nick, BLESSED_CHANNEL) + } case libnmdc.EVENT_USER_PART: s.reply(rplPart, hubEvent.Nick, BLESSED_CHANNEL, "Disconnected") @@ -678,6 +683,15 @@ func (s *Server) sendNames() { }) } + if len(nameList) == 0 { + // We don't have a nick list yet. Many clients can't handle a blank list + // We could delay until we do have a nick list + // Or, we could send our nick only, and filter it out of the next join + + nameList = append(nameList, s.clientNick()) + s.sentFakeSelfJoin = true + } + s.reply(rplNames, BLESSED_CHANNEL, strings.Join(nameList, " ")) s.reply(rplEndOfNames, BLESSED_CHANNEL) }