mirror of https://github.com/fluffle/goirc
Update README, fix whitespace fail.
This commit is contained in:
parent
d119e6bca0
commit
a4ac0dd1b7
12
README.md
12
README.md
|
@ -30,18 +30,18 @@ Synopsis:
|
||||||
// e.g. join a channel on connect.
|
// e.g. join a channel on connect.
|
||||||
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") })
|
||||||
|
// And a signal on disconnect
|
||||||
|
quit := make(chan bool)
|
||||||
|
c.AddHandler("disconnected),
|
||||||
|
func(conn *irc.Conn, line *irc.Line) { quit <- true }
|
||||||
|
|
||||||
// Tell client to connect
|
// Tell client to connect
|
||||||
if err := c.Connect("irc.freenode.net"); err != nil {
|
if err := c.Connect("irc.freenode.net"); err != nil {
|
||||||
fmt.Printf("Connection error: %s\n", err.String())
|
fmt.Printf("Connection error: %s\n", err.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop until client gets disconnected, printing any errors
|
// Wait for disconnect
|
||||||
for c.Connected {
|
<-quit
|
||||||
if err := <-c.Err; err != nil {
|
|
||||||
fmt.Printf("goirc error: %s", err.String())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
The test client provides a good (if basic) example of how to use the framework.
|
The test client provides a good (if basic) example of how to use the framework.
|
||||||
|
|
Loading…
Reference in New Issue