From 5c184766a1be064980228a853406b5c7787ab2cf Mon Sep 17 00:00:00 2001 From: "." <.@.> Date: Sat, 7 May 2016 18:40:12 +1200 Subject: [PATCH] swap nick+lastMessage tracking / replace with just nick tracking (fixes double-post of /me messages) --HG-- branch : nmdc-ircfrontend --- server.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server.go b/server.go index 980b09f..886a358 100644 --- a/server.go +++ b/server.go @@ -50,8 +50,6 @@ type Server struct { verbose bool autojoin bool - - lastMessage string // FIXME racey } func NewServer(name string, upstream libnmdc.HubAddress, conn net.Conn) *Server { @@ -178,8 +176,8 @@ func (s *Server) upstreamWorker() { s.reply(rplMsg, hubEvent.Nick+"!"+hubEvent.Nick+"@"+hubEvent.Nick, s.upstreamLauncher.Self.Nick, hubEvent.Message) case libnmdc.EVENT_PUBLIC: - if hubEvent.Nick == s.upstreamLauncher.Self.Nick && hubEvent.Message == s.lastMessage { - s.lastMessage = "" // irc doesn't echo our own pubchat + if hubEvent.Nick == s.upstreamLauncher.Self.Nick { + // irc doesn't echo our own pubchat } else { // s.reply(rplMsg, hubEvent.Nick, BLESSED_CHANNEL, hubEvent.Message) s.reply(rplMsg, hubEvent.Nick+"!"+hubEvent.Nick+"@"+hubEvent.Nick, BLESSED_CHANNEL, hubEvent.Message) @@ -364,8 +362,7 @@ func (s *Server) handleRegisteredCommand(command string, args []string) { // channel name, but not really for user nicks if strings.ToLower(args[0]) == BLESSED_CHANNEL { - s.lastMessage = message - s.upstream.SayPublic(s.lastMessage) + s.upstream.SayPublic(message) } else if _, clientExists := s.upstream.Users[args[0]]; clientExists { s.upstream.SayPrivate(args[0], message)