Don't throttle connection during registration.

This commit is contained in:
Shiz 2014-02-22 21:04:34 +01:00
parent dd3a8d5b22
commit 0b6e285b6e
1 changed files with 7 additions and 2 deletions

View File

@ -146,23 +146,28 @@ class RFC1459Support(BasicClient):
""" Perform IRC connection registration. """
if self.registered:
return
self._registration_attempts += 1
# Don't throttle during registration, most ircds don't care for flooding during registration,
# and it might speed it up significantly.
self.connection.throttle = False
# Password first.
if self.password:
self.rawmsg('PASS', self.password)
# Then nickname...
self.set_nickname(self._attempt_nicknames.pop(0))
# And now for the rest of the user information.
self.rawmsg('USER', self.username, '0', '*', self.realname)
def _registration_completed(self, message):
""" We're connected and registered. Receive proper nickname and emit fake NICK message. """
if not self.registered:
# Re-enable throttling.
self.registered = True
self.connection.throttle = True
target = message.params[0]
fakemsg = self._create_message('NICK', target, source=self.nickname)
self.on_raw_nick(fakemsg)