mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Merge pull request #446 from nyuszika7h/testing
Fix SASL on py3k + minor change in supybot-botchk
This commit is contained in:
commit
4754df2dbd
@ -97,8 +97,7 @@ if __name__ == '__main__':
|
|||||||
parser.error('No conffile given.')
|
parser.error('No conffile given.')
|
||||||
|
|
||||||
os.chdir(options.botdir)
|
os.chdir(options.botdir)
|
||||||
pidfile = open(options.pidfile, 'ab')
|
open(options.pidfile, 'a').close()
|
||||||
pidfile.close()
|
|
||||||
|
|
||||||
pid = None
|
pid = None
|
||||||
try:
|
try:
|
||||||
|
@ -887,8 +887,16 @@ class Irc(IrcCommandDispatcher):
|
|||||||
self.ident = conf.supybot.ident()
|
self.ident = conf.supybot.ident()
|
||||||
self.alternateNicks = conf.supybot.nick.alternates()[:]
|
self.alternateNicks = conf.supybot.nick.alternates()[:]
|
||||||
self.password = conf.supybot.networks.get(self.network).password()
|
self.password = conf.supybot.networks.get(self.network).password()
|
||||||
self.sasl_username = conf.supybot.networks.get(self.network).sasl.username()
|
self.sasl_username = \
|
||||||
self.sasl_password = conf.supybot.networks.get(self.network).sasl.password()
|
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')
|
self.prefix = '%s!%s@%s' % (self.nick, self.ident, 'unset.domain')
|
||||||
# The rest.
|
# The rest.
|
||||||
self.lastTake = 0
|
self.lastTake = 0
|
||||||
@ -897,6 +905,7 @@ class Irc(IrcCommandDispatcher):
|
|||||||
self.lastping = time.time()
|
self.lastping = time.time()
|
||||||
self.outstandingPing = False
|
self.outstandingPing = False
|
||||||
|
|
||||||
|
|
||||||
def _queueConnectMessages(self):
|
def _queueConnectMessages(self):
|
||||||
if self.zombie:
|
if self.zombie:
|
||||||
self.driver.die()
|
self.driver.die()
|
||||||
@ -906,8 +915,11 @@ class Irc(IrcCommandDispatcher):
|
|||||||
if not self.sasl_username:
|
if not self.sasl_username:
|
||||||
log.error('SASL username is not set, unable to identify.')
|
log.error('SASL username is not set, unable to identify.')
|
||||||
else:
|
else:
|
||||||
auth_string = base64.b64encode('%s\x00%s\x00%s' % (self.sasl_username,
|
auth_string = base64.b64encode('\x00'.join([
|
||||||
self.sasl_username, self.sasl_password))
|
self.sasl_username,
|
||||||
|
self.sasl_username,
|
||||||
|
self.sasl_password
|
||||||
|
]).encode('utf-8')).decode('utf-8')
|
||||||
log.debug('Sending CAP REQ command, requesting capability \'sasl\'.')
|
log.debug('Sending CAP REQ command, requesting capability \'sasl\'.')
|
||||||
self.queueMsg(ircmsgs.IrcMsg(command="CAP", args=('REQ', 'sasl')))
|
self.queueMsg(ircmsgs.IrcMsg(command="CAP", args=('REQ', 'sasl')))
|
||||||
log.debug('Sending AUTHENTICATE command, using mechanism PLAIN.')
|
log.debug('Sending AUTHENTICATE command, using mechanism PLAIN.')
|
||||||
|
@ -461,6 +461,7 @@ def wrap(s, length, break_on_hyphens = False, break_long_words = False):
|
|||||||
|
|
||||||
def isValidArgument(s):
|
def isValidArgument(s):
|
||||||
"""Returns whether s is strictly a valid argument for an IRC message."""
|
"""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
|
return '\r' not in s and '\n' not in s and '\x00' not in s
|
||||||
|
|
||||||
def safeArgument(s):
|
def safeArgument(s):
|
||||||
|
Loading…
Reference in New Issue
Block a user