Commit ece53ebd authored by Yann Leboulanger's avatar Yann Leboulanger

[NooN8] make the really dense code more readable

parent bda8f905
......@@ -461,18 +461,18 @@ class SASL(PlugIn):
self.realm = chal['realm']
if 'qop' in chal and ((chal['qop'] =='auth') or \
(isinstance(chal['qop'], list) and 'auth' in chal['qop'])):
self.resp = {}
self.resp['username'] = self.username
self.resp = {'username': self.username,
'nonce': chal['nonce'],
'cnonce': '%x' % rndg.getrandbits(196),
'nc': ('00000001'), # ToDo: Is this a tupel or only a string?
'qop': 'auth',
'digest-uri': 'xmpp/' + self._owner.Server,
'charset': 'utf-8'
}
if self.realm:
self.resp['realm'] = self.realm
else:
self.resp['realm'] = self._owner.Server
self.resp['nonce'] = chal['nonce']
self.resp['cnonce'] = '%x' % rndg.getrandbits(196)
self.resp['nc'] = ('00000001')
self.resp['qop'] = 'auth'
self.resp['digest-uri'] = 'xmpp/' + self._owner.Server
self.resp['charset'] = 'utf-8'
# Password is now required
self._owner._caller.get_password(self.set_password, self.mechanism)
elif 'rspauth' in chal:
......
......@@ -104,7 +104,7 @@ class XMPPDispatcher(PlugIn):
# \ufddo -> \ufdef range
c = '\ufdd0'
r = c
while (c < '\ufdef'):
while c < '\ufdef':
c = chr(ord(c) + 1)
r += '|' + c
......@@ -112,7 +112,7 @@ class XMPPDispatcher(PlugIn):
c = '\ufffe'
r += '|' + c
r += '|' + chr(ord(c) + 1)
while (c < '\U0010fffe'):
while c < '\U0010fffe':
c = chr(ord(c) + 0x10000)
r += '|' + c
r += '|' + chr(ord(c) + 1)
......
......@@ -143,7 +143,7 @@ class Smacks():
self.enabled = True
self.resuming = True
self.con.set_oldst()
if self.old_uqueue != []:
if self.old_uqueue:
log.info('Session resumed, replaying %s stanzas...' % len(self.old_uqueue))
for i in self.old_uqueue:
self._owner.Connection.send(i, False)
......
......@@ -583,7 +583,7 @@ class NonBlockingTCP(NonBlockingTransport, IdleObject):
except UnicodeDecodeError:
for i in range(-1, -4, -1):
char = sent_data[i]
if char & 0xc0 == 0xc0:
if ord(char) & 0xc0 == 0xc0:
self.sent_bytes_buff = sent_data[i:]
sent_data = sent_data[:i]
break
......@@ -794,7 +794,7 @@ class NonBlockingHTTP(NonBlockingTCP):
headers.append('Connection: Keep-Alive')
headers.append('\r\n')
headers = '\r\n'.join(headers)
return('%s%s' % (headers, httpbody))
return '%s%s' % (headers, httpbody)
def parse_http_message(self, message):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment