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) }