示例#1
0
文件: irc.go 项目: MDCox/spectator
// joinRooms() joins any irc channel that is included in the `rooms` slice.
func joinRooms(conn *irc.Conn, rooms []string) {
	for _, room := range rooms {
		time.Sleep(time.Second * 2)
		conn.Encode(&irc.Message{
			Command: irc.JOIN,
			Params:  []string{room},
		})
	}
}
示例#2
0
文件: irc.go 项目: MDCox/spectator
// identify() sends the USER and NICK commands to identify upon conenction.
func identify(conn *irc.Conn) {
	var messages []*irc.Message
	messages = append(messages, &irc.Message{
		Command:  irc.USER,
		Params:   []string{"testin", "0", "*"},
		Trailing: "testin",
	})
	messages = append(messages, &irc.Message{
		Command: irc.NICK,
		Params:  []string{"testin"},
	})
	for _, msg := range messages {
		err := conn.Encode(msg)
		if err != nil {
			fmt.Printf("Err: %s \n%s\n", err, msg)
		}
	}
}