Improve order of connect messages.

This commit is contained in:
Valentin Lorentz 2015-05-17 12:31:14 +02:00
parent 9cb967023e
commit a2004b7150
2 changed files with 29 additions and 30 deletions

View File

@ -956,6 +956,22 @@ class Irc(IrcCommandDispatcher):
return
if self.password:
log.info('%s: Queuing PASS command, not logging the password.',
self.network)
self.sendMsg(ircmsgs.password(self.password))
log.debug('%s: Sending NICK command, nick is %s.',
self.network, self.nick)
self.sendMsg(ircmsgs.nick(self.nick))
log.debug('%s: Sending USER command, ident is %s, user is %s.',
self.network, self.ident, self.user)
self.sendMsg(ircmsgs.user(self.ident, self.user))
self.sasl = None
if ecdsa and self.sasl_username and self.sasl_ecdsa_key:
@ -980,22 +996,6 @@ class Irc(IrcCommandDispatcher):
else:
self.sendMsg(ircmsgs.IrcMsg(command='CAP', args=('END',)))
if self.password:
log.info('%s: Queuing PASS command, not logging the password.',
self.network)
self.sendMsg(ircmsgs.password(self.password))
log.debug('%s: Queuing NICK command, nick is %s.',
self.network, self.nick)
self.sendMsg(ircmsgs.nick(self.nick))
log.debug('%s: Queuing USER command, ident is %s, user is %s.',
self.network, self.ident, self.user)
self.sendMsg(ircmsgs.user(self.ident, self.user))
def doAuthenticate(self, msg):
if len(msg.args) == 1 and msg.args[0] == '+':
log.info('%s: Authenticating using SASL.', self.network)

View File

@ -383,19 +383,19 @@ class IrcTestCase(SupyTestCase):
m = self.irc.takeMsg()
self.failUnless(m.command == 'NICK', 'Expected NICK, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'USER', 'Expected USER, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m)
def testPingResponse(self):
self.irc.feedMsg(ircmsgs.ping('123'))
@ -435,7 +435,6 @@ class IrcTestCase(SupyTestCase):
except:
pass
self.irc.reset()
self.failIf(self.irc.fastqueue)
self.failIf(self.irc.state.history)
self.failIf(self.irc.state.channels)
self.failIf(self.irc.outstandingPing)
@ -493,13 +492,13 @@ class IrcCallbackTestCase(SupyTestCase):
conf.supybot.user.setValue(user)
expected = [
ircmsgs.nick(nick),
ircmsgs.user('limnoria', user),
ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-notify')),
ircmsgs.IrcMsg(command='CAP', args=('REQ', 'extended-join')),
ircmsgs.IrcMsg(command='CAP', args=('REQ', 'multi-prefix')),
ircmsgs.IrcMsg(command='CAP', args=('REQ', 'metadata-notify')),
ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-tag')),
ircmsgs.IrcMsg(command='CAP', args=('END',)),
ircmsgs.user('limnoria', user)
]
irc = irclib.Irc('test')
msgs = [irc.takeMsg()]