don't double-echo our own messages
--HG-- branch : nmdc-ircfrontend
This commit is contained in:
parent
8c5b148bc1
commit
a17c816540
11
server.go
11
server.go
@ -38,6 +38,8 @@ type Server struct {
|
|||||||
upstreamLauncher libnmdc.HubConnectionOptions
|
upstreamLauncher libnmdc.HubConnectionOptions
|
||||||
upstreamCloser chan struct{}
|
upstreamCloser chan struct{}
|
||||||
upstream *libnmdc.HubConnection
|
upstream *libnmdc.HubConnection
|
||||||
|
|
||||||
|
lastMessage string // FIXME racey
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewServer(name string, upstream libnmdc.HubAddress, conn net.Conn) *Server {
|
func NewServer(name string, upstream libnmdc.HubAddress, conn net.Conn) *Server {
|
||||||
@ -142,7 +144,11 @@ func (s *Server) upstreamWorker() {
|
|||||||
s.reply(rplMsg, s.upstreamLauncher.Self.Nick, hubEvent.Nick, hubEvent.Message)
|
s.reply(rplMsg, s.upstreamLauncher.Self.Nick, hubEvent.Nick, hubEvent.Message)
|
||||||
|
|
||||||
case libnmdc.EVENT_PUBLIC:
|
case libnmdc.EVENT_PUBLIC:
|
||||||
s.reply(rplMsg, s.upstreamLauncher.Self.Nick, BLESSED_CHANNEL, hubEvent.Message)
|
if hubEvent.Nick == s.upstreamLauncher.Self.Nick && hubEvent.Message == s.lastMessage {
|
||||||
|
s.lastMessage = "" // irc doesn't echo our own pubchat
|
||||||
|
} else {
|
||||||
|
s.reply(rplMsg, hubEvent.Nick, BLESSED_CHANNEL, hubEvent.Message)
|
||||||
|
}
|
||||||
|
|
||||||
case libnmdc.EVENT_SYSTEM_MESSAGE_FROM_CONN, libnmdc.EVENT_SYSTEM_MESSAGE_FROM_HUB:
|
case libnmdc.EVENT_SYSTEM_MESSAGE_FROM_CONN, libnmdc.EVENT_SYSTEM_MESSAGE_FROM_HUB:
|
||||||
s.sendClientGlobalMessage(hubEvent.Message)
|
s.sendClientGlobalMessage(hubEvent.Message)
|
||||||
@ -256,7 +262,8 @@ func (s *Server) handleRegisteredCommand(command string, args []string) {
|
|||||||
// channel name, but not really for user nicks
|
// channel name, but not really for user nicks
|
||||||
|
|
||||||
if strings.ToLower(args[0]) == BLESSED_CHANNEL {
|
if strings.ToLower(args[0]) == BLESSED_CHANNEL {
|
||||||
s.upstream.SayPublic(message)
|
s.lastMessage = message
|
||||||
|
s.upstream.SayPublic(s.lastMessage)
|
||||||
|
|
||||||
} else if _, clientExists := s.upstream.Users[args[0]]; clientExists {
|
} else if _, clientExists := s.upstream.Users[args[0]]; clientExists {
|
||||||
s.upstream.SayPrivate(args[0], message)
|
s.upstream.SayPrivate(args[0], message)
|
||||||
|
Loading…
Reference in New Issue
Block a user