3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-23 18:54:05 +01:00

clientbot: in conditionals, don't break if irc.pseudoclient isn't set yet

This commit is contained in:
James Lu 2016-07-17 23:09:11 -07:00
parent de618393c0
commit e7ae6ddbff

View File

@ -32,7 +32,7 @@ class ClientbotWrapperProtocol(Protocol):
""" """
Formats text with the given sender as a prefix. Formats text with the given sender as a prefix.
""" """
if source == self.irc.pseudoclient.uid: if self.irc.pseudoclient and source == self.irc.pseudoclient.uid:
return text return text
else: else:
# TODO: configurable formatting # TODO: configurable formatting
@ -100,7 +100,7 @@ class ClientbotWrapperProtocol(Protocol):
self.irc.users[client].channels.add(channel) self.irc.users[client].channels.add(channel)
# Only joins for the main PyLink client are actually forwarded. Others are ignored. # Only joins for the main PyLink client are actually forwarded. Others are ignored.
if client == self.irc.pseudoclient.uid: if self.irc.pseudoclient and client == self.irc.pseudoclient.uid:
self.irc.send('JOIN %s' % channel) self.irc.send('JOIN %s' % channel)
else: else:
log.debug('(%s) join: faking JOIN of client %s/%s to %s', self.irc.name, client, log.debug('(%s) join: faking JOIN of client %s/%s to %s', self.irc.name, client,
@ -143,7 +143,7 @@ class ClientbotWrapperProtocol(Protocol):
self.irc.users[source].channels.discard(channel) self.irc.users[source].channels.discard(channel)
# Only parts for the main PyLink client are actually forwarded. Others are ignored. # Only parts for the main PyLink client are actually forwarded. Others are ignored.
if source == self.irc.pseudoclient.uid: if self.irc.pseudoclient and source == self.irc.pseudoclient.uid:
self.irc.send('PART %s :%s' % (channel, reason)) self.irc.send('PART %s :%s' % (channel, reason))
def quit(self, source, reason): def quit(self, source, reason):