[danguy] correctly encrypt message in zeroconf network. fixes #3113
This commit is contained in:
parent
2ef20efac5
commit
b15b53b5e2
|
@ -346,15 +346,19 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
|
||||||
msgtxt = msg
|
msgtxt = msg
|
||||||
msgenc = ''
|
msgenc = ''
|
||||||
if keyID and USE_GPG:
|
if keyID and USE_GPG:
|
||||||
#encrypt
|
# encrypt
|
||||||
msgenc = self.gpg.encrypt(msg, [keyID])
|
msgenc, error = self.gpg.encrypt(msg, [keyID])
|
||||||
if msgenc:
|
if msgenc and not error:
|
||||||
msgtxt = '[This message is encrypted]'
|
msgtxt = '[This message is encrypted]'
|
||||||
lang = os.getenv('LANG')
|
lang = os.getenv('LANG')
|
||||||
if lang is not None or lang != 'en': # we're not english
|
if lang is not None or lang != 'en': # we're not english
|
||||||
msgtxt = _('[This message is encrypted]') +\
|
msgtxt = _('[This message is encrypted]') +\
|
||||||
' ([This message is encrypted])' # one in locale and one en
|
' ([This message is encrypted])' # one in locale and one en
|
||||||
|
else:
|
||||||
|
# Encryption failed, do not send message
|
||||||
|
tim = time.localtime()
|
||||||
|
self.dispatch('MSGNOTSENT', (jid, error, msgtxt, tim))
|
||||||
|
return 3
|
||||||
|
|
||||||
if type == 'chat':
|
if type == 'chat':
|
||||||
msg_iq = common.xmpp.Message(to = fjid, body = msgtxt, typ = type)
|
msg_iq = common.xmpp.Message(to = fjid, body = msgtxt, typ = type)
|
||||||
|
|
Loading…
Reference in New Issue