Update README and example client once more.

This commit is contained in:
Alex Bramley 2011-11-09 22:06:54 +00:00
parent 8239bc4b6e
commit 80d8cd4ea7
2 changed files with 8 additions and 5 deletions

View File

@ -23,7 +23,7 @@ Synopsis:
func main() { func main() {
flag.Parse() // parses the logging flags. flag.Parse() // parses the logging flags.
c := irc.New("nick", "ident", "real name", false, nil, nil) c := irc.SimpleClient("nick")
// Optionally, enable SSL // Optionally, enable SSL
c.SSL = true c.SSL = true
@ -55,9 +55,11 @@ the messages from the IRC server, so you have to handle e.g. "332" for
The vast majority of handlers implemented within the framework deal with state The vast majority of handlers implemented within the framework deal with state
tracking of all nicks in any channels that the client is also present in. These tracking of all nicks in any channels that the client is also present in. These
handers are in `client/state_handlers.go`. State tracking is optional, and can handers are in `client/state_handlers.go`. State tracking is optional, disabled
be enabled by passing `true` as the fourth argument to `client.New()`. This API by default, and can be enabled and disabled by calling `EnableStateTracking()`
sucks and may change in the future. and `DisableStateTracking()` respectively. Doing this while connected to an IRC
server will probably result in an inconsistent state and a lot of warnings to
STDERR ;-)
### Misc. ### Misc.

View File

@ -16,7 +16,8 @@ func main() {
flag.Parse() flag.Parse()
// create new IRC connection // create new IRC connection
c := irc.New("GoTest", "gotest", "GoBot", true, nil, nil) c := irc.SimpleClient("GoTest", "gotest")
c.EnableStateTracking()
c.AddHandler("connected", c.AddHandler("connected",
func(conn *irc.Conn, line *irc.Line) { conn.Join(*channel) }) func(conn *irc.Conn, line *irc.Line) { conn.Join(*channel) })