never send blank nicks (FIXES yaaic/atomic, Revolution IRC)

--HG--
branch : nmdc-ircfrontend
This commit is contained in:
mappu 2018-03-24 15:04:09 +13:00
parent 0e7e2b629c
commit 458ab0a054

View File

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