diff --git a/TODO.txt b/TODO.txt index e0ce56e..01c2555 100644 --- a/TODO.txt +++ b/TODO.txt @@ -36,6 +36,7 @@ WISHLIST + REF === diff --git a/server.go b/server.go index 5223182..2063a35 100644 --- a/server.go +++ b/server.go @@ -77,7 +77,7 @@ func (s *Server) RunWorker() { // Send the connection handshake. // Can't connect to the upstream server yet, until we've recieved a nick. - s.sendClientGlobalMessage(s.motd) + s.sendMOTD(s.motd) for { if s.clientConn == nil { @@ -152,7 +152,7 @@ func (s *Server) upstreamWorker() { // description change - no relevance for IRC users case libnmdc.EVENT_CONNECTION_STATE_CHANGED: - s.sendClientGlobalMessage("Upstream: " + hubEvent.StateChange.Format()) + s.reply(rplMsg, "", BLESSED_CHANNEL, "* Upstream: "+hubEvent.StateChange.Format()) case libnmdc.EVENT_HUBNAME_CHANGED: s.sendChannelTopic(hubEvent.Nick) @@ -168,8 +168,7 @@ func (s *Server) upstreamWorker() { } case libnmdc.EVENT_SYSTEM_MESSAGE_FROM_CONN, libnmdc.EVENT_SYSTEM_MESSAGE_FROM_HUB: - s.reply(rplMsg, "", BLESSED_CHANNEL, hubEvent.Message) // experimental - // s.sendClientGlobalMessage(hubEvent.Message) + s.reply(rplMsg, "", BLESSED_CHANNEL, hubEvent.Message) } } @@ -360,22 +359,22 @@ func (s *Server) handleRegisteredCommand(command string, args []string) { if args[0] == BLESSED_CHANNEL { // always include ourselves - s.reply(rplWho, s.upstreamLauncher.Self.Nick) + 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) + 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) + s.reply(rplWho, nick, args[0]) } } } - s.reply(rplEndOfWho) + s.reply(rplEndOfWho, args[0]) case "MODE": if len(args) < 1 { @@ -420,7 +419,7 @@ func (s *Server) sendChannelTopic(topic string) { } } -func (s *Server) sendClientGlobalMessage(motd string) { +func (s *Server) sendMOTD(motd string) { s.reply(rplMOTDStart) for len(motd) > 80 { @@ -455,9 +454,9 @@ func (s *Server) reply(code replyCode, args ...string) { s.writeClient(fmt.Sprintf(":%s 366 %s %s :End of NAMES list", s.name, s.upstreamLauncher.Self.Nick, args[0])) case rplWho: - s.writeClient(fmt.Sprintf(":%s 352 %s %s %s %s %s %s H :0 %s", s.name, s.upstreamLauncher.Self.Nick, BLESSED_CHANNEL, args[0], args[0], s.name, args[0], args[0])) + s.writeClient(fmt.Sprintf(":%s 352 %s %s %s %s %s %s H :0 %s", s.name, s.upstreamLauncher.Self.Nick, args[1], args[0], args[0], s.name, args[0], args[0])) case rplEndOfWho: - s.writeClient(fmt.Sprintf(":%s 315 :End of WHO list", s.name)) + s.writeClient(fmt.Sprintf(":%s 315 %s %s :End of WHO list", s.name, s.upstreamLauncher.Self.Nick, args[0])) case rplNickChange: s.writeClient(fmt.Sprintf(":%s NICK %s", args[0], args[1]))