diff options
Diffstat (limited to 'vendor/github.com/lrstanley/girc/handler.go')
-rw-r--r-- | vendor/github.com/lrstanley/girc/handler.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/vendor/github.com/lrstanley/girc/handler.go b/vendor/github.com/lrstanley/girc/handler.go index 6c082708..bde08976 100644 --- a/vendor/github.com/lrstanley/girc/handler.go +++ b/vendor/github.com/lrstanley/girc/handler.go @@ -22,19 +22,28 @@ func (c *Client) RunHandlers(event *Event) { } // Log the event. - c.debug.Print("< " + StripRaw(event.String())) + prefix := "< " + if event.Echo { + prefix += "[echo-message] " + } + c.debug.Print(prefix + StripRaw(event.String())) if c.Config.Out != nil { if pretty, ok := event.Pretty(); ok { fmt.Fprintln(c.Config.Out, StripRaw(pretty)) } } - // Background handlers first. + // Background handlers first. If the event is an echo-message, then only + // send the echo version to ALL_EVENTS. c.Handlers.exec(ALL_EVENTS, true, c, event.Copy()) - c.Handlers.exec(event.Command, true, c, event.Copy()) + if !event.Echo { + c.Handlers.exec(event.Command, true, c, event.Copy()) + } c.Handlers.exec(ALL_EVENTS, false, c, event.Copy()) - c.Handlers.exec(event.Command, false, c, event.Copy()) + if !event.Echo { + c.Handlers.exec(event.Command, false, c, event.Copy()) + } // Check if it's a CTCP. if ctcp := decodeCTCP(event.Copy()); ctcp != nil { |