mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-10 12:59:22 +01:00
Final fix for SASL and py3k
This commit is contained in:
parent
4170a873b2
commit
e491e14bc3
@ -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,10 +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' %
|
auth_string = base64.b64encode('\x00'.join([
|
||||||
(self.sasl_username, self.sasl_username,
|
self.sasl_username,
|
||||||
self.sasl_password)).encode('utf-8')).decode(
|
self.sasl_username,
|
||||||
'utf-8')
|
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