Philipp Hörist pushed to branch master at gajim / gajim
Commits:
209fa4c9 by Philipp Hörist at 2017-06-11T22:54:15+02:00
Dont set scrollbar policy in GC config window
This crashes Gajim on Windows.
Its to be investigated why this happens and how we can avoid it.
- - - - -
1 changed file:
- src/config.py
Changes:
=====================================
src/config.py
=====================================
--- a/src/config.py
+++ b/src/config.py
@@ -2935,7 +2935,6 @@ class GroupchatConfigWindow:
self.affiliation_treeview[affiliation].append_column(col)
sw = Gtk.ScrolledWindow()
- sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER)
sw.add(self.affiliation_treeview[affiliation])
add_on_vbox.pack_start(sw, True, True, 0)
gajim.connections[self.account].get_affiliation_list(self.room_jid,
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/209fa4c92634cdd86ee6ae25b34c3ab636…
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
c8115e41 by Philipp Hörist at 2017-06-08T23:34:03+02:00
Set transient for ErrorDialog
Fixes #8649
- - - - -
1 changed file:
- src/adhoc_commands.py
Changes:
=====================================
src/adhoc_commands.py
=====================================
--- a/src/adhoc_commands.py
+++ b/src/adhoc_commands.py
@@ -367,8 +367,10 @@ class CommandWindow:
if self.data_form_widget.get_data_form():
df = self.data_form_widget.get_data_form()
if not df.is_valid():
- dialogs.ErrorDialog(_('Invalid Form'),
- _('The form is not filled correctly.'))
+ dialogs.ErrorDialog(
+ _('Invalid Form'),
+ _('The form is not filled correctly.'),
+ transient_for=self.window)
self.data_form_widget.set_sensitive(True)
return
self.data_form_widget.data_form.type_ = 'submit'
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/c8115e4164496da3527486507cb0c0acb8…
Philipp Hörist pushed to branch gajim_0.16 at gajim / gajim
Commits:
2da22cf3 by Philipp Hörist at 2017-06-08T23:30:08+02:00
Pass use_agent to GPG init instead of overwrite
- - - - -
35f8893b by Philipp Hörist at 2017-06-08T23:30:57+02:00
Remove unused GPG code
- - - - -
5433b2a2 by Philipp Hörist at 2017-06-08T23:31:09+02:00
Always pass utf8 encoded strings to python-gnupg
self.encoding which we set in the init is only intended
to decode gpg´s stderr which uses a system specific encoding.
if we dont encode the data we pass to python-gnupg ourself, it will fallback and use self.encoding.
This might be of no concern if self.encoding is set to 'utf8' and when we are on Linux
which has a preferred encoding of 'utf8'.
But if we are on Windows the preferred encoding for stderr
is most of the time not 'utf8'. If python-gnupg tries to decode a stderr stream that is for example
encoded with 'cp1252' with our set encoding of 'utf8' this will fail.
The solution is to pre-encode the data before we pass it to python-gnupg, so it does not have to
use self.encoding as a fallback. And set self.encoding='latin1' because latin1 will not yield exceptions
on decoding errors. Also gpg itself will fallback to latin1 as stderr encoding when it cant determine the
preferred encoding of a system.
self.decode_errors is used for something differently, and has no influence on the situation.
Fixes #8644
- - - - -
2 changed files:
- src/common/connection.py
- src/common/gpg.py
Changes:
=====================================
src/common/connection.py
=====================================
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -147,7 +147,7 @@ class CommonConnection:
self.USE_GPG = False
if gajim.HAVE_GPG:
self.USE_GPG = True
- self.gpg = gpg.GnuPG(gajim.config.get('use_gpg_agent'))
+ self.gpg = gpg.GnuPG()
self.status = ''
self.old_show = ''
self.priority = gajim.get_priority(name, 'offline')
@@ -248,8 +248,7 @@ class CommonConnection:
signed = ''
keyID = gajim.config.get_per('accounts', self.name, 'keyid')
if keyID and self.USE_GPG:
- use_gpg_agent = gajim.config.get('use_gpg_agent')
- if self.gpg.passphrase is None and not use_gpg_agent:
+ if self.gpg.passphrase is None and not self.gpg.use_agent:
# We didn't set a passphrase
return None
signed = self.gpg.sign(msg, keyID)
@@ -692,8 +691,7 @@ class CommonConnection:
def gpg_passphrase(self, passphrase):
if self.gpg:
- use_gpg_agent = gajim.config.get('use_gpg_agent')
- if use_gpg_agent:
+ if self.gpg.use_agent:
self.gpg.passphrase = None
else:
self.gpg.passphrase = passphrase
@@ -740,7 +738,7 @@ class CommonConnection:
self.server_resource = self._compute_resource()
if gajim.HAVE_GPG:
self.USE_GPG = True
- self.gpg = gpg.GnuPG(gajim.config.get('use_gpg_agent'))
+ self.gpg = gpg.GnuPG()
gajim.nec.push_incoming_event(BeforeChangeShowEvent(None,
conn=self, show=show, message=msg))
self.connect_and_init(show, msg, sign_msg)
@@ -1017,8 +1015,7 @@ class Connection(CommonConnection, ConnectionHandlers):
return
if gajim.HAVE_GPG:
self.USE_GPG = True
- self.gpg = gpg.GnuPG(gajim.config.get(
- 'use_gpg_agent'))
+ self.gpg = gpg.GnuPG()
gajim.nec.push_incoming_event(
AccountCreatedEvent(None, conn=self,
account_info = self.new_account_info))
=====================================
src/common/gpg.py
=====================================
--- a/src/common/gpg.py
+++ b/src/common/gpg.py
@@ -32,26 +32,16 @@ if gajim.HAVE_GPG:
gnupg.logger = logging.getLogger('gajim.c.gnupg')
class GnuPG(gnupg.GPG):
- def __init__(self, use_agent=False):
- gnupg.GPG.__init__(self, gpgbinary=gajim.GPG_BINARY)
+ def __init__(self):
+ use_agent = gajim.config.get('use_gpg_agent')
+ gnupg.GPG.__init__(self, gpgbinary=gajim.GPG_BINARY, use_agent=use_agent)
encoding = gajim.config.get('pgp_encoding')
if encoding:
self.encoding = encoding
self.decode_errors = 'replace'
self.passphrase = None
- self.use_agent = use_agent
self.always_trust = [] # list of keyID to always trust
- def _setup_my_options(self):
- self.options.armor = 1
- self.options.meta_interactive = 0
- self.options.extra_args.append('--no-secmem-warning')
- # disable photo viewer when verifying keys
- self.options.extra_args.append('--verify-options')
- self.options.extra_args.append('no-show-photo')
- if self.use_agent:
- self.options.extra_args.append('--use-agent')
-
def encrypt(self, str_, recipients, always_trust=False):
trust = always_trust
if not trust:
@@ -69,7 +59,7 @@ if gajim.HAVE_GPG:
return '', 'NOT_TRUSTED ' + key['keyid'][-8:]
else:
trust = True
- result = super(GnuPG, self).encrypt(str_, recipients,
+ result = super(GnuPG, self).encrypt(str_.encode('utf8'), recipients,
always_trust=trust, passphrase=self.passphrase)
if result.ok:
@@ -81,13 +71,13 @@ if gajim.HAVE_GPG:
def decrypt(self, str_, keyID):
data = self._addHeaderFooter(str_, 'MESSAGE')
- result = super(GnuPG, self).decrypt(data,
+ result = super(GnuPG, self).decrypt(data.encode('utf8'),
passphrase=self.passphrase)
return str(result)
def sign(self, str_, keyID):
- result = super(GnuPG, self).sign(str_, keyid=keyID, detach=True,
+ result = super(GnuPG, self).sign(str_.encode('utf8'), keyid=keyID, detach=True,
passphrase=self.passphrase)
if result.fingerprint:
@@ -110,7 +100,7 @@ if gajim.HAVE_GPG:
str_,
self._addHeaderFooter(sign, 'SIGNATURE')]
)
- result = super(GnuPG, self).verify(data)
+ result = super(GnuPG, self).verify(data.encode('utf8'))
if result.valid:
return result.key_id
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/cc42fba09bcf837042e5bd72c81f14487…
Philipp Hörist pushed to branch gajim_0.16 at gajim / gajim
Commits:
cc42fba0 by Philipp Hörist at 2017-06-08T23:23:37+02:00
Set transient for ErrorDialog
Fixes #8649
- - - - -
1 changed file:
- src/adhoc_commands.py
Changes:
=====================================
src/adhoc_commands.py
=====================================
--- a/src/adhoc_commands.py
+++ b/src/adhoc_commands.py
@@ -369,8 +369,10 @@ class CommandWindow:
if self.data_form_widget.get_data_form():
df = self.data_form_widget.get_data_form()
if not df.is_valid():
- dialogs.ErrorDialog(_('Invalid Form'),
- _('The form is not filled correctly.'))
+ dialogs.ErrorDialog(
+ _('Invalid Form'),
+ _('The form is not filled correctly.'),
+ transient_for=self.window)
self.data_form_widget.set_sensitive(True)
return
self.data_form_widget.data_form.type_ = 'submit'
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/cc42fba09bcf837042e5bd72c81f144873…
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
92b0a155 by Philipp Hörist at 2017-06-08T19:09:22+02:00
Pass use_agent to GPG init instead of overwrite
- - - - -
2872993b by Philipp Hörist at 2017-06-08T19:10:04+02:00
Remove unused GPG code
- - - - -
1bf66b85 by Philipp Hörist at 2017-06-08T19:33:01+02:00
Always pass utf8 encoded strings to python-gnupg
self.encoding which we set in the init is only intended
to decode gpg´s stderr which uses a system specific encoding.
if we dont encode the data we pass to python-gnupg ourself, it will fallback and use self.encoding.
This might be of no concern if self.encoding is set to 'utf8' and when we are on Linux
which has a preferred encoding of 'utf8'.
But if we are on Windows the preferred encoding for stderr
is most of the time not 'utf8'. If python-gnupg tries to decode a stderr stream that is for example
encoded with 'cp1252' with our set encoding of 'utf8' this will fail.
The solution is to pre-encode the data before we pass it to python-gnupg, so it does not have to
use self.encoding as a fallback. And set self.encoding='latin1' because latin1 will not yield exceptions
on decoding errors. Also gpg itself will fallback to latin1 as stderr encoding when it cant determine the
preferred encoding of a system.
self.decode_errors is used for something differently, and has no influence on the situation.
Fixes #8644
- - - - -
2296e75d by Philipp Hörist at 2017-06-08T19:58:40+02:00
Replace unicode char in print message
- - - - -
3 changed files:
- src/common/connection.py
- src/common/gpg.py
- src/gajim.py
Changes:
=====================================
src/common/connection.py
=====================================
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -132,7 +132,7 @@ class CommonConnection:
self.USE_GPG = False
if gajim.HAVE_GPG:
self.USE_GPG = True
- self.gpg = gpg.GnuPG(gajim.config.get('use_gpg_agent'))
+ self.gpg = gpg.GnuPG()
self.status = ''
self.old_show = ''
self.priority = gajim.get_priority(name, 'offline')
@@ -234,8 +234,7 @@ class CommonConnection:
signed = ''
keyID = gajim.config.get_per('accounts', self.name, 'keyid')
if keyID and self.USE_GPG:
- use_gpg_agent = gajim.config.get('use_gpg_agent')
- if self.gpg.passphrase is None and not use_gpg_agent:
+ if self.gpg.passphrase is None and not self.gpg.use_agent:
# We didn't set a passphrase
return None
signed = self.gpg.sign(msg, keyID)
@@ -566,8 +565,7 @@ class CommonConnection:
def gpg_passphrase(self, passphrase):
if self.gpg:
- use_gpg_agent = gajim.config.get('use_gpg_agent')
- if use_gpg_agent:
+ if self.gpg.use_agent:
self.gpg.passphrase = None
else:
self.gpg.passphrase = passphrase
@@ -614,7 +612,7 @@ class CommonConnection:
self.server_resource = self._compute_resource()
if gajim.HAVE_GPG:
self.USE_GPG = True
- self.gpg = gpg.GnuPG(gajim.config.get('use_gpg_agent'))
+ self.gpg = gpg.GnuPG()
gajim.nec.push_incoming_event(BeforeChangeShowEvent(None,
conn=self, show=show, message=msg))
self.connect_and_init(show, msg, sign_msg)
@@ -892,8 +890,7 @@ class Connection(CommonConnection, ConnectionHandlers):
return
if gajim.HAVE_GPG:
self.USE_GPG = True
- self.gpg = gpg.GnuPG(gajim.config.get(
- 'use_gpg_agent'))
+ self.gpg = gpg.GnuPG()
gajim.nec.push_incoming_event(
AccountCreatedEvent(None, conn=self,
account_info = self.new_account_info))
=====================================
src/common/gpg.py
=====================================
--- a/src/common/gpg.py
+++ b/src/common/gpg.py
@@ -32,26 +32,16 @@ if HAVE_GPG:
gnupg.logger = logging.getLogger('gajim.c.gnupg')
class GnuPG(gnupg.GPG):
- def __init__(self, use_agent=False):
- gnupg.GPG.__init__(self, gpgbinary=GPG_BINARY)
+ def __init__(self):
+ use_agent = gajim.config.get('use_gpg_agent')
+ gnupg.GPG.__init__(self, gpgbinary=GPG_BINARY, use_agent=use_agent)
encoding = gajim.config.get('pgp_encoding')
if encoding:
self.encoding = encoding
self.decode_errors = 'replace'
self.passphrase = None
- self.use_agent = use_agent
self.always_trust = [] # list of keyID to always trust
- def _setup_my_options(self):
- self.options.armor = 1
- self.options.meta_interactive = 0
- self.options.extra_args.append('--no-secmem-warning')
- # disable photo viewer when verifying keys
- self.options.extra_args.append('--verify-options')
- self.options.extra_args.append('no-show-photo')
- if self.use_agent:
- self.options.extra_args.append('--use-agent')
-
def encrypt(self, str_, recipients, always_trust=False):
trust = always_trust
if not trust:
@@ -69,7 +59,7 @@ if HAVE_GPG:
return '', 'NOT_TRUSTED ' + key['keyid'][-8:]
else:
trust = True
- result = super(GnuPG, self).encrypt(str_, recipients,
+ result = super(GnuPG, self).encrypt(str_.encode('utf8'), recipients,
always_trust=trust, passphrase=self.passphrase)
if result.ok:
@@ -81,13 +71,13 @@ if HAVE_GPG:
def decrypt(self, str_, keyID):
data = self._addHeaderFooter(str_, 'MESSAGE')
- result = super(GnuPG, self).decrypt(data,
+ result = super(GnuPG, self).decrypt(data.encode('utf8'),
passphrase=self.passphrase)
return str(result)
def sign(self, str_, keyID):
- result = super(GnuPG, self).sign(str_, keyid=keyID, detach=True,
+ result = super(GnuPG, self).sign(str_.encode('utf8'), keyid=keyID, detach=True,
passphrase=self.passphrase)
if result.fingerprint:
@@ -110,7 +100,7 @@ if HAVE_GPG:
str_,
self._addHeaderFooter(sign, 'SIGNATURE')]
)
- result = super(GnuPG, self).verify(data)
+ result = super(GnuPG, self).verify(data.encode('utf8'))
if result.valid:
return result.key_id
=====================================
src/gajim.py
=====================================
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -122,7 +122,7 @@ class GajimApplication(Gtk.Application):
from distutils.version import LooseVersion as V
if V(nbxmpp.__version__) < V(MIN_NBXMPP_VER):
print('Gajim needs python-nbxmpp >= %s to run. '
- 'Quitting…' % MIN_NBXMPP_VER)
+ 'Quitting...' % MIN_NBXMPP_VER)
sys.exit(1)
# Create and initialize Application Paths & Databases
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/b5e9b07a07508689bf9b8509a0049aa55…
Philipp Hörist pushed to branch gajim_0.16 at gajim / gajim
Commits:
5a2b04c2 by Philipp Hörist at 2017-06-06T00:18:42+02:00
Use dict for zeroconf txt data
Use dict or else zeroconf_connection.py would constantly overwrite it with a dict
which we would have to check and transform back.
so we use a dict and only transform to TXTRecord when we call pybonjour
- - - - -
1 changed file:
- src/common/zeroconf/zeroconf_bonjour.py
Changes:
=====================================
src/common/zeroconf/zeroconf_bonjour.py
=====================================
--- a/src/common/zeroconf/zeroconf_bonjour.py
+++ b/src/common/zeroconf/zeroconf_bonjour.py
@@ -43,7 +43,7 @@ class Zeroconf:
self.port = port # listening port that gets announced
self.username = name
self.host = host
- self.txt = pybonjour.TXTRecord() # service data
+ self.txt = {} # service data
# XXX these CBs should be set to None when we destroy the object
# (go offline), because they create a circular reference
@@ -245,7 +245,7 @@ class Zeroconf:
txt = {}
#remove empty keys
- for key, val in self.txt:
+ for key, val in self.txt.iteritems():
if val:
txt[key] = val
@@ -258,14 +258,13 @@ class Zeroconf:
txt['status'] = self.replace_show(self.txt['status'])
else:
txt['status'] = 'avail'
-
- self.txt = pybonjour.TXTRecord(txt, strict=True)
+ self.txt = txt
try:
self.service_sdRef = pybonjour.DNSServiceRegister(
name=self.name,
regtype=self.stype,
port=self.port,
- txtRecord=self.txt,
+ txtRecord=pybonjour.TXTRecord(self.txt, strict=True),
callBack=self.service_added_callback)
log.info('Publishing service %s of type %s' % (self.name, self.stype))
@@ -399,8 +398,9 @@ class Zeroconf:
if show:
self.txt['status'] = self.replace_show(show)
+ txt = pybonjour.TXTRecord(self.txt, strict=True)
try:
- pybonjour.DNSServiceUpdateRecord(self.service_sdRef, None, 0, self.txt)
+ pybonjour.DNSServiceUpdateRecord(self.service_sdRef, None, 0, txt)
except pybonjour.BonjourError:
return False
return True
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/5a2b04c2f19a5342d1c1dbd91b23da104e…