switch back to sending WHO on WHO requests (worse for hexchat, much better for andchat)
--HG-- branch : nmdc-ircfrontend
This commit is contained in:
parent
03ea6bb99e
commit
6d124ff084
55
server.go
55
server.go
@ -416,29 +416,8 @@ func (s *Server) handleRegisteredCommand(command string, args []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// Ignore what we're "supposed" to do
|
||||
s.sendNames()
|
||||
|
||||
/*
|
||||
if args[0] == BLESSED_CHANNEL {
|
||||
// always include ourselves
|
||||
s.reply(rplWho, s.upstreamLauncher.Self.Nick, args[0])
|
||||
|
||||
for nick, _ := range s.upstream.Users {
|
||||
if nick != s.upstreamLauncher.Self.Nick { // but don't repeat ourselves
|
||||
s.reply(rplWho, nick, args[0])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// argument is a filter
|
||||
for nick, _ := range s.upstream.Users {
|
||||
if strings.Contains(nick, args[0]) {
|
||||
s.reply(rplWho, nick, args[0])
|
||||
}
|
||||
}
|
||||
}
|
||||
s.reply(rplEndOfWho, args[0])
|
||||
*/
|
||||
// s.sendNames() // Ignore what we're "supposed" to do
|
||||
s.sendWho(args[0])
|
||||
|
||||
case "MODE":
|
||||
if len(args) < 1 {
|
||||
@ -453,7 +432,7 @@ func (s *Server) handleRegisteredCommand(command string, args []string) {
|
||||
|
||||
if len(args) == 1 {
|
||||
// No more args, they just want the mode
|
||||
s.reply(rplChannelModeIs, args[0], BLESSED_CHANNEL_MODE, "")
|
||||
s.sendChannelMode()
|
||||
} else {
|
||||
// Setting modes is disallowed
|
||||
s.reply(errNoPriv)
|
||||
@ -488,6 +467,31 @@ func (s *Server) sendNames() {
|
||||
s.reply(rplEndOfNames, BLESSED_CHANNEL)
|
||||
}
|
||||
|
||||
func (s *Server) sendChannelMode() {
|
||||
s.reply(rplChannelModeIs, BLESSED_CHANNEL, BLESSED_CHANNEL_MODE, "")
|
||||
}
|
||||
|
||||
func (s *Server) sendWho(arg string) {
|
||||
if arg == BLESSED_CHANNEL {
|
||||
// always include ourselves
|
||||
s.reply(rplWho, s.upstreamLauncher.Self.Nick, arg)
|
||||
|
||||
for nick, _ := range s.upstream.Users {
|
||||
if nick != s.upstreamLauncher.Self.Nick { // but don't repeat ourselves
|
||||
s.reply(rplWho, nick, arg)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// argument is a filter
|
||||
for nick, _ := range s.upstream.Users {
|
||||
if strings.Contains(nick, arg) {
|
||||
s.reply(rplWho, nick, arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
s.reply(rplEndOfWho, arg)
|
||||
}
|
||||
|
||||
func (s *Server) sendChannelTopic(topic string) {
|
||||
if len(topic) > 0 {
|
||||
s.reply(rplTopic, BLESSED_CHANNEL, s.upstream.HubName)
|
||||
@ -541,14 +545,17 @@ func (s *Server) reply(code replyCode, args ...string) {
|
||||
s.writeClient(fmt.Sprintf(":%s NICK %s", args[0], args[1]))
|
||||
case rplKill:
|
||||
s.writeClient(fmt.Sprintf(":%s KILL %s A %s", args[0], s.upstreamLauncher.Self.Nick, args[1]))
|
||||
|
||||
case rplMsg:
|
||||
for _, itm := range strings.Split(args[2], "\n") {
|
||||
s.writeClient(fmt.Sprintf(":%s PRIVMSG %s :%s", args[0], args[1], itm))
|
||||
}
|
||||
|
||||
case rplList:
|
||||
s.writeClient(fmt.Sprintf(":%s 322 %s %s", s.name, s.upstreamLauncher.Self.Nick, args[0]))
|
||||
case rplListEnd:
|
||||
s.writeClient(fmt.Sprintf(":%s 323 %s", s.name, s.upstreamLauncher.Self.Nick))
|
||||
|
||||
case rplOper:
|
||||
s.writeClient(fmt.Sprintf(":%s 381 %s :You are now an operator", s.name, s.upstreamLauncher.Self.Nick))
|
||||
case rplChannelModeIs:
|
||||
|
Loading…
Reference in New Issue
Block a user