[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
|
||||
msgenc = ''
|
||||
if keyID and USE_GPG:
|
||||
#encrypt
|
||||
msgenc = self.gpg.encrypt(msg, [keyID])
|
||||
if msgenc:
|
||||
# encrypt
|
||||
msgenc, error = self.gpg.encrypt(msg, [keyID])
|
||||
if msgenc and not error:
|
||||
msgtxt = '[This message is encrypted]'
|
||||
lang = os.getenv('LANG')
|
||||
if lang is not None or lang != 'en': # we're not english
|
||||
msgtxt = _('[This message is encrypted]') +\
|
||||
' ([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':
|
||||
msg_iq = common.xmpp.Message(to = fjid, body = msgtxt, typ = type)
|
||||
|
|
Loading…
Reference in New Issue