1
0
Fork 0
mirror of https://github.com/fluffle/goirc synced 2025-07-12 08:11:17 +00:00

update README and comments so godoc creates nice helpful html documentation

This commit is contained in:
Alex Bramley 2009-12-18 22:39:22 +00:00
parent 07ff350dd0
commit e5131515b8
5 changed files with 158 additions and 59 deletions

View file

@ -8,7 +8,19 @@ import (
"strconv"
)
// Add an event handler for a specific IRC command
// AddHandler() adds an event handler for a specific IRC command.
//
// Handlers take the form of an anonymous function (currently):
// func(conn *irc.Conn, line *irc.Line) {
// // handler code here
// }
//
// Handlers are triggered on incoming Lines from the server, with the handler
// "name" being equivalent to Line.Cmd. Read the RFCs for details on what
// replies could come from the server. They'll generally be things like
// "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 func(*Conn, *Line)) {
n := strings.ToUpper(name)
if e, ok := conn.events[n]; ok {