mirror of https://github.com/fluffle/goirc
Fix up README and example client.
This commit is contained in:
parent
f27e56c8b0
commit
a88b866b63
|
@ -18,17 +18,17 @@ Synopsis:
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse() // parses the logging flags.
|
flag.Parse() // parses the logging flags.
|
||||||
c := irc.SimpleClient("nick")
|
c := irc.Client("nick")
|
||||||
// Optionally, enable SSL
|
// Optionally, enable SSL
|
||||||
c.SSL = true
|
c.SSL = true
|
||||||
|
|
||||||
// Add handlers to do things here!
|
// Add handlers to do things here!
|
||||||
// e.g. join a channel on connect.
|
// e.g. join a channel on connect.
|
||||||
c.AddHandler("connected",
|
c.HandleFunc("connected",
|
||||||
func(conn *irc.Conn, line *irc.Line) { conn.Join("#channel") })
|
func(conn *irc.Conn, line *irc.Line) { conn.Join("#channel") })
|
||||||
// And a signal on disconnect
|
// And a signal on disconnect
|
||||||
quit := make(chan bool)
|
quit := make(chan bool)
|
||||||
c.AddHandler("disconnected",
|
c.HandleFunc("disconnected",
|
||||||
func(conn *irc.Conn, line *irc.Line) { quit <- true })
|
func(conn *irc.Conn, line *irc.Line) { quit <- true })
|
||||||
|
|
||||||
// Tell client to connect
|
// Tell client to connect
|
||||||
|
|
|
@ -16,14 +16,14 @@ func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
// create new IRC connection
|
// create new IRC connection
|
||||||
c := irc.SimpleClient("GoTest", "gotest")
|
c := irc.Client("GoTest", "gotest")
|
||||||
c.EnableStateTracking()
|
c.EnableStateTracking()
|
||||||
c.AddHandler("connected",
|
c.HandleFunc("connected",
|
||||||
func(conn *irc.Conn, line *irc.Line) { conn.Join(*channel) })
|
func(conn *irc.Conn, line *irc.Line) { conn.Join(*channel) })
|
||||||
|
|
||||||
// Set up a handler to notify of disconnect events.
|
// Set up a handler to notify of disconnect events.
|
||||||
quit := make(chan bool)
|
quit := make(chan bool)
|
||||||
c.AddHandler("disconnected",
|
c.HandleFunc("disconnected",
|
||||||
func(conn *irc.Conn, line *irc.Line) { quit <- true })
|
func(conn *irc.Conn, line *irc.Line) { quit <- true })
|
||||||
|
|
||||||
// set up a goroutine to read commands from stdin
|
// set up a goroutine to read commands from stdin
|
||||||
|
|
Loading…
Reference in New Issue