mirror of https://github.com/fluffle/goirc
correct syntax errors from updating go to 4450:dd9bae5c7eac
This commit is contained in:
parent
7191dd9177
commit
6a8c1a13b2
|
@ -13,12 +13,12 @@ func main() {
|
||||||
c := irc.New("GoTest", "gotest", "GoBot");
|
c := irc.New("GoTest", "gotest", "GoBot");
|
||||||
c.AddHandler("connected",
|
c.AddHandler("connected",
|
||||||
func(conn *irc.Conn, line *irc.Line) {
|
func(conn *irc.Conn, line *irc.Line) {
|
||||||
conn.Join("#");
|
conn.Join("#go-lang");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// connect to server
|
// connect to server
|
||||||
if err := c.Connect("irc.pl0rt.org", ""); err != nil {
|
if err := c.Connect("irc.freenode.net", ""); err != nil {
|
||||||
fmt.Printf("Connection error: %s\n", err);
|
fmt.Printf("Connection error: %s\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ func main() {
|
||||||
// if we don't really want to quit, reconnect!
|
// if we don't really want to quit, reconnect!
|
||||||
if !reallyquit {
|
if !reallyquit {
|
||||||
fmt.Println("Reconnecting...");
|
fmt.Println("Reconnecting...");
|
||||||
if err := c.Connect("irc.pl0rt.org", ""); err != nil {
|
if err := c.Connect("irc.freenode.net", ""); err != nil {
|
||||||
fmt.Printf("Connection error: %s\n", err);
|
fmt.Printf("Connection error: %s\n", err);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ func (conn *Conn) Connect(host, pass string) os.Error {
|
||||||
|
|
||||||
conn.io = bufio.NewReadWriter(
|
conn.io = bufio.NewReadWriter(
|
||||||
bufio.NewReader(conn.sock),
|
bufio.NewReader(conn.sock),
|
||||||
bufio.NewWriter(conn.sock)
|
bufio.NewWriter(conn.sock),
|
||||||
);
|
);
|
||||||
go conn.send();
|
go conn.send();
|
||||||
go conn.recv();
|
go conn.recv();
|
||||||
|
|
|
@ -41,8 +41,8 @@ func (conn *Conn) dispatchEvent(line *Line) {
|
||||||
// So, I think CTCP and (in particular) CTCP ACTION are better handled as
|
// So, I think CTCP and (in particular) CTCP ACTION are better handled as
|
||||||
// separate events as opposed to forcing people to have gargantuan PRIVMSG
|
// separate events as opposed to forcing people to have gargantuan PRIVMSG
|
||||||
// handlers to cope with the possibilities.
|
// handlers to cope with the possibilities.
|
||||||
if line.Cmd == "PRIVMSG" && len(line.Text) > 2
|
if line.Cmd == "PRIVMSG" && len(line.Text) > 2 &&
|
||||||
&& line.Text[0] == '\001' && line.Text[len(line.Text)-1] == '\001' {
|
line.Text[0] == '\001' && line.Text[len(line.Text)-1] == '\001' {
|
||||||
// WOO, it's a CTCP message
|
// WOO, it's a CTCP message
|
||||||
t := strings.Split(line.Text[1:len(line.Text)-1], " ", 2);
|
t := strings.Split(line.Text[1:len(line.Text)-1], " ", 2);
|
||||||
if c := strings.ToUpper(t[0]); c == "ACTION" {
|
if c := strings.ToUpper(t[0]); c == "ACTION" {
|
||||||
|
|
Loading…
Reference in New Issue