Update rbot.go to be compatible with the giant merge

This commit is contained in:
raylu 2010-11-04 13:12:23 -04:00
parent ff21e678d4
commit 652867410a
1 changed files with 10 additions and 2 deletions

12
rbot.go
View File

@ -5,6 +5,9 @@ import (
"fmt" "fmt"
"os" "os"
"strings" "strings"
"time"
"crypto/tls"
"crypto/rand"
"github.com/kless/goconfig/config" "github.com/kless/goconfig/config"
) )
@ -36,11 +39,16 @@ func connect(network string) {
server := readConfString(network, "server") server := readConfString(network, "server")
nick := readConfString(network, "nick") nick := readConfString(network, "nick")
user := readConfString(network, "user") user := readConfString(network, "user")
ssl := readConfBool(network, "ssl")
nickserv, _ := conf.String(network, "nickserv") nickserv, _ := conf.String(network, "nickserv")
c := irc.New(nick, user, user) c := irc.New(nick, user, user)
c.Network = network c.Network = network
c.SSL = readConfBool(network, "ssl")
if c.SSL {
// we don't care about certificate validity
c.SSLConfig = &tls.Config{Rand: rand.Reader, Time: time.Nanoseconds}
}
c.AddHandler("connected", c.AddHandler("connected",
func(conn *irc.Conn, line *irc.Line) { func(conn *irc.Conn, line *irc.Line) {
fmt.Printf("Connected to %s!\n", conn.Host) fmt.Printf("Connected to %s!\n", conn.Host)
@ -58,7 +66,7 @@ func connect(network string) {
for { for {
fmt.Printf("Connecting to %s...\n", server) fmt.Printf("Connecting to %s...\n", server)
if err := c.Connect(server, ssl, ""); err != nil { if err := c.Connect(server); err != nil {
fmt.Printf("Connection error: %s\n", err) fmt.Printf("Connection error: %s\n", err)
break break
} }