py2 -> py3
This commit is contained in:
parent
54c3f9acaa
commit
d337aeed4e
7 changed files with 11 additions and 10 deletions
|
@ -1216,7 +1216,7 @@ class GcInvitationReceivedEvent(nec.NetworkIncomingEvent):
|
||||||
self.is_continued = False
|
self.is_continued = False
|
||||||
if invite_tag.getAttr('continue') == 'true':
|
if invite_tag.getAttr('continue') == 'true':
|
||||||
self.is_continued = True
|
self.is_continued = True
|
||||||
else
|
else:
|
||||||
self.room_jid = self.msg_obj.fjid
|
self.room_jid = self.msg_obj.fjid
|
||||||
item = self.msg_obj.invite_tag.getTag('invite')
|
item = self.msg_obj.invite_tag.getTag('invite')
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -87,7 +87,7 @@ def add_entropy_sources_OpenSSL():
|
||||||
os.environ, os.getcwd(), os.getpid()]
|
os.environ, os.getcwd(), os.getpid()]
|
||||||
|
|
||||||
for s in sources:
|
for s in sources:
|
||||||
OpenSSL.rand.add(str(s), 0.01)
|
OpenSSL.rand.add(str(s).encode('utf-8'), 0.01)
|
||||||
|
|
||||||
# On Windows add the current contents of the screen to the PRNG state.
|
# On Windows add the current contents of the screen to the PRNG state.
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
|
@ -99,12 +99,13 @@ def add_entropy_sources_OpenSSL():
|
||||||
for d in dirs:
|
for d in dirs:
|
||||||
if os.access(d, os.R_OK):
|
if os.access(d, os.R_OK):
|
||||||
for filename in os.listdir(d):
|
for filename in os.listdir(d):
|
||||||
OpenSSL.rand.add(filename, 0)
|
OpenSSL.rand.add(filename.encode('utf-8'), 0)
|
||||||
try:
|
try:
|
||||||
with open(d + os.sep + filename, "r") as fp:
|
with open(d + os.sep + filename, "r") as fp:
|
||||||
# Limit the ammount of read bytes, in case a memory
|
# Limit the ammount of read bytes, in case a memory
|
||||||
# file was opened
|
# file was opened
|
||||||
OpenSSL.rand.add(str(fp.read(5000)), 0.01)
|
OpenSSL.rand.add(str(fp.read(5000)).encode('utf-8'),
|
||||||
|
0.01)
|
||||||
except:
|
except:
|
||||||
# Ignore all read and access errors
|
# Ignore all read and access errors
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -21,8 +21,8 @@ import os
|
||||||
from common import gajim
|
from common import gajim
|
||||||
import nbxmpp
|
import nbxmpp
|
||||||
from common.jingle_transport import JingleTransportIBB
|
from common.jingle_transport import JingleTransportIBB
|
||||||
from jingle_xtls import SELF_SIGNED_CERTIFICATE
|
from .jingle_xtls import SELF_SIGNED_CERTIFICATE
|
||||||
from jingle_xtls import load_cert_file
|
from .jingle_xtls import load_cert_file
|
||||||
|
|
||||||
contents = {}
|
contents = {}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ Handles Jingle File Transfer (XEP 0234)
|
||||||
import hashlib
|
import hashlib
|
||||||
from common import gajim
|
from common import gajim
|
||||||
import nbxmpp
|
import nbxmpp
|
||||||
import jingle_xtls
|
from . import jingle_xtls
|
||||||
from common.jingle_content import contents, JingleContent
|
from common.jingle_content import contents, JingleContent
|
||||||
from common.jingle_transport import *
|
from common.jingle_transport import *
|
||||||
from common import helpers
|
from common import helpers
|
||||||
|
|
|
@ -286,7 +286,7 @@ def make_certs(filepath, CN):
|
||||||
req = createCertRequest(key, CN=CN)
|
req = createCertRequest(key, CN=CN)
|
||||||
cert = createCertificate(req, req, key, 0, 0, 60*60*24*365*5) # five years
|
cert = createCertificate(req, req, key, 0, 0, 60*60*24*365*5) # five years
|
||||||
with open(filepath + '.pkey', 'wb') as f:
|
with open(filepath + '.pkey', 'wb') as f:
|
||||||
os.chmod(filepath + '.pkey', 0600)
|
os.chmod(filepath + '.pkey', 0o600)
|
||||||
f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, key))
|
f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, key))
|
||||||
with open(filepath + '.cert', 'wb') as f:
|
with open(filepath + '.cert', 'wb') as f:
|
||||||
f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert).decode(
|
f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert).decode(
|
||||||
|
|
|
@ -494,7 +494,7 @@ class Socks5(object):
|
||||||
self._sock.connect(self._server)
|
self._sock.connect(self._server)
|
||||||
self._send=self._sock.send
|
self._send=self._sock.send
|
||||||
self._recv=self._sock.recv
|
self._recv=self._sock.recv
|
||||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError), e:
|
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError) as e:
|
||||||
pass
|
pass
|
||||||
except Exception as ee:
|
except Exception as ee:
|
||||||
errnum = ee.errno
|
errnum = ee.errno
|
||||||
|
|
|
@ -1971,7 +1971,7 @@ class Interface:
|
||||||
import imp
|
import imp
|
||||||
imp.reload(emoticons)
|
imp.reload(emoticons)
|
||||||
emots = emoticons.emoticons
|
emots = emoticons.emoticons
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
return True
|
return True
|
||||||
for emot_filename in emots:
|
for emot_filename in emots:
|
||||||
emot_file = os.path.join(path, emot_filename)
|
emot_file = os.path.join(path, emot_filename)
|
||||||
|
|
Loading…
Add table
Reference in a new issue