diff --git a/scripts/supybot-botchk b/scripts/supybot-botchk index de6e4e802..8d59e8068 100644 --- a/scripts/supybot-botchk +++ b/scripts/supybot-botchk @@ -97,8 +97,7 @@ if __name__ == '__main__': parser.error('No conffile given.') os.chdir(options.botdir) - pidfile = open(options.pidfile, 'ab') - pidfile.close() + open(options.pidfile, 'a').close() pid = None try: diff --git a/src/irclib.py b/src/irclib.py index 5b7d93095..1d31faa20 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -887,8 +887,16 @@ class Irc(IrcCommandDispatcher): self.ident = conf.supybot.ident() self.alternateNicks = conf.supybot.nick.alternates()[:] self.password = conf.supybot.networks.get(self.network).password() - self.sasl_username = conf.supybot.networks.get(self.network).sasl.username() - self.sasl_password = conf.supybot.networks.get(self.network).sasl.password() + self.sasl_username = \ + conf.supybot.networks.get(self.network).sasl.username() + # TODO Find a better way to fix this + if hasattr(self.sasl_username, 'decode'): + self.sasl_username = self.sasl_username.decode('utf-8') + self.sasl_password = \ + conf.supybot.networks.get(self.network).sasl.password() + # TODO Find a better way to fix this + if hasattr(self.sasl_password, 'decode'): + self.sasl_password = self.sasl_password.decode('utf-8') self.prefix = '%s!%s@%s' % (self.nick, self.ident, 'unset.domain') # The rest. self.lastTake = 0 @@ -897,6 +905,7 @@ class Irc(IrcCommandDispatcher): self.lastping = time.time() self.outstandingPing = False + def _queueConnectMessages(self): if self.zombie: self.driver.die() @@ -906,8 +915,11 @@ class Irc(IrcCommandDispatcher): if not self.sasl_username: log.error('SASL username is not set, unable to identify.') else: - auth_string = base64.b64encode('%s\x00%s\x00%s' % (self.sasl_username, - self.sasl_username, self.sasl_password)) + auth_string = base64.b64encode('\x00'.join([ + self.sasl_username, + self.sasl_username, + self.sasl_password + ]).encode('utf-8')).decode('utf-8') log.debug('Sending CAP REQ command, requesting capability \'sasl\'.') self.queueMsg(ircmsgs.IrcMsg(command="CAP", args=('REQ', 'sasl'))) log.debug('Sending AUTHENTICATE command, using mechanism PLAIN.') diff --git a/src/ircutils.py b/src/ircutils.py index fa340458e..abb6f69f0 100644 --- a/src/ircutils.py +++ b/src/ircutils.py @@ -461,6 +461,7 @@ def wrap(s, length, break_on_hyphens = False, break_long_words = False): def isValidArgument(s): """Returns whether s is strictly a valid argument for an IRC message.""" + return '\r' not in s and '\n' not in s and '\x00' not in s def safeArgument(s):