From 18dcb5884d4950861b07c1e5d28f56fbe01cd3c7 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Tue, 29 Jan 2013 16:27:38 -0500 Subject: [PATCH] Fixing a counter crash; trying to get more info on zombie downtime users --- plugins/counter.go | 4 ++++ plugins/downtime.go | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/counter.go b/plugins/counter.go index 14cc2e5..0f3f0b9 100644 --- a/plugins/counter.go +++ b/plugins/counter.go @@ -116,6 +116,10 @@ func (p *CounterPlugin) Message(message bot.Message) bool { return true } else if len(parts) == 1 { + if len(parts[0]) < 3 { + return false + } + subject := strings.ToLower(nick) itemName := strings.ToLower(parts[0])[:len(parts[0])-2] diff --git a/plugins/downtime.go b/plugins/downtime.go index 86d9009..4bb2f3d 100644 --- a/plugins/downtime.go +++ b/plugins/downtime.go @@ -77,8 +77,11 @@ func (p *DowntimePlugin) Message(message bot.Message) bool { sort.Sort(entries) tops := "The top entries are: " for _, e := range entries { + // filter out ZNC entries - if !strings.HasPrefix(e.Nick, "*") { + if strings.HasPrefix(e.Nick, "*") { + p.remove(e.Nick) + } else { tops = fmt.Sprintf("%s%s: %s ", tops, e.Nick, time.Now().Sub(e.LastSeen)) } } @@ -140,7 +143,7 @@ func (p *DowntimePlugin) Event(kind string, message bot.Message) bool { } else if kind == "PART" { p.remove(strings.ToLower(message.User.Name)) } else { - log.Println("Unknown event: ", message) + log.Println("Unknown event: ", kind, message.User, message) p.record(strings.ToLower(message.User.Name)) } return false