From d544994641de67c816babeb000c486fa1c02b052 Mon Sep 17 00:00:00 2001 From: lye Date: Tue, 20 Mar 2012 23:11:35 -0500 Subject: [PATCH] rfc1459 compliance: PASS before NICK/USER --- irc.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/irc.go b/irc.go index e3f1a11..0455e06 100644 --- a/irc.go +++ b/irc.go @@ -173,14 +173,17 @@ func (i *IRCConnection) postConnect() error { i.Error = make(chan error, 10) i.syncreader = make(chan bool) i.syncwriter = make(chan bool) + go reader(i) go writer(i) go pinger(i) - i.pwrite <- fmt.Sprintf("NICK %s\r\n", i.nick) - i.pwrite <- fmt.Sprintf("USER %s 0.0.0.0 0.0.0.0 :%s\r\n", i.user, i.user) + if len(i.Password) > 0 { i.pwrite <- fmt.Sprintf("PASS %s\r\n", i.Password) } + + i.pwrite <- fmt.Sprintf("NICK %s\r\n", i.nick) + i.pwrite <- fmt.Sprintf("USER %s 0.0.0.0 0.0.0.0 :%s\r\n", i.user, i.user) return nil }