mirror of
https://github.com/gissleh/irc.git
synced 2026-10-02 08:35:35 +00:00
fix query messages not being put in right target.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package irctest
|
||||
|
||||
import "github.com/gissleh/irc"
|
||||
|
||||
type EventLog struct {
|
||||
events []*irc.Event
|
||||
}
|
||||
|
||||
func (l *EventLog) First(kind, verb string) *irc.Event {
|
||||
for _, e := range l.events {
|
||||
if e.Verb() == verb && e.Kind() == kind {
|
||||
return e
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *EventLog) Last(kind, verb string) *irc.Event {
|
||||
for i := len(l.events) - 1; i >= 0; i-- {
|
||||
e := l.events[i]
|
||||
if e.Verb() == verb && e.Kind() == kind {
|
||||
return e
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *EventLog) Handler(event *irc.Event, _ *irc.Client) {
|
||||
l.events = append(l.events, event)
|
||||
}
|
||||
Reference in New Issue
Block a user