1
0
Fork 0
mirror of https://github.com/fluffle/goirc synced 2025-07-05 21:09:24 +00:00

Make enabling/disabling state-tracking easier. Improve constructors.

This commit is contained in:
Alex Bramley 2011-11-07 13:34:13 +00:00
parent 6e87169e2c
commit aa75e0e0c6
4 changed files with 78 additions and 33 deletions

View file

@ -19,8 +19,10 @@ type IRCHandler func(*Conn, *Line)
// "PRIVMSG", "JOIN", etc. but all the numeric replies are left as ascii
// strings of digits like "332" (mainly because I really didn't feel like
// putting massive constant tables in).
func (conn *Conn) AddHandler(name string, f IRCHandler) {
conn.ER.AddHandler(name, NewHandler(f))
func (conn *Conn) AddHandler(name string, f IRCHandler) event.Handler {
h := NewHandler(f)
conn.ER.AddHandler(h, name)
return h
}
// Wrap f in an anonymous unboxing function