Merge pull request #3 from rfw/master

Fix error behaviour and edge cases.
This commit is contained in:
Shiz 2014-02-04 02:11:33 -08:00
commit 00587532f1
2 changed files with 7 additions and 5 deletions

View File

@ -272,10 +272,7 @@ class BasicClient:
del self.users[nickname]
def _format_hostmask(self, nickname):
if nickname not in self.users:
raise KeyError('Unknown user "{usr}".'.format(usr=nickname))
user = self.users[nickname]
user = self.users.get(nickname, {"username": "*", "hostname": "*"})
return '{n}!{u}@{h}'.format(n=nickname, u=user['username'] or '*', h=user['hostname'] or '*')
@ -914,6 +911,11 @@ class BasicClient:
# MOTD is done, let's tell our bot the connection is ready.
self.on_connect()
def on_raw_422(self, message):
""" MOTD is missing. """
self.motd = None
self.on_connect()
def on_raw_421(self, message):
""" Server responded with 'unknown command'. """
self.logger.warn('Server responded with "Unknown command: {}"'.format(message.params[0]))

View File

@ -83,7 +83,7 @@ class IRCv3_1Support(sasl.SASLSupport, tls.TLSSupport):
self._sync_user(nick, user, host)
# Emit a fake join message.
fakemsg = self._construct_message('JOIN', channels, source=message.source)
fakemsg = self._create_message('JOIN', channels, source=message.source)
super().on_raw_join(fakemsg)
if account == NO_ACCOUNT: