default_ircport = 6697
else:
default_ircport = 6667
- self.username = parsed.username
+ self.username = parsed.username or 'irker'
self.password = parsed.password
self.hostname = parsed.hostname
self.port = parsed.port or default_ircport
return
if self.username or self.password:
auth = '{}:{}@'.format(
- self.username, '*' * len(self.password or ''))
+ self.username or '', '*' * len(self.password or ''))
else:
auth = ''
if self.port:
loop = asyncio.get_event_loop()
loop.call_later(delay=self._receive_ttl, callback=self._check_ttl)
self._last_rx = time.time()
- if self._password:
+ if self._password and self._username:
self.writeline('PASS {}'.format(self._password))
self.writeline('NICK {}'.format(self._nick))
- self.writeline('USER {} 0 * :{}'.format(
- self._username, self._realname))
+ if self._username:
+ self.writeline('USER {} 0 * :{}'.format(
+ self._username, self._realname))
def connection_lost(self, exc):
super(IRCProtocol, self).connection_lost(exc=exc)