Added ClearCallback method for clearing all callbacks for an event

This commit is contained in:
Andrew Montgomery-Hurrell
2014-02-11 23:57:08 +00:00
parent 6edb7ec06e
commit bf01c6c9e2
2 changed files with 38 additions and 0 deletions

View File

@@ -40,6 +40,18 @@ func (irc *Connection) RemoveCallback(eventcode string, i string) bool {
return false
}
func (irc *Connection) ClearCallback(eventcode string) bool {
eventcode = strings.ToUpper(eventcode)
if _, ok := irc.events[eventcode]; ok{
irc.events[eventcode] = make(map[string]func(*Event))
return true
}
irc.Log.Println("Event not found")
return false
}
func (irc *Connection) ReplaceCallback(eventcode string, i string, callback func(*Event)) {
eventcode = strings.ToUpper(eventcode)