Make "This message is encrypted" bodies consistent.

This commit is contained in:
js 2008-08-03 23:01:43 +00:00
parent 94a43a03fb
commit 9bb8f8c5e6
2 changed files with 10 additions and 6 deletions

View file

@ -1080,12 +1080,11 @@ class Connection(ConnectionHandlers):
#encrypt #encrypt
msgenc, error = self.gpg.encrypt(msg, [keyID]) msgenc, error = self.gpg.encrypt(msg, [keyID])
if msgenc and not error: if msgenc and not error:
msgtxt = '[This message is encrypted]' msgtxt = '[This message is *encrypted* (See :XEP:`27`]'
lang = os.getenv('LANG') lang = os.getenv('LANG')
if lang is not None and lang != 'en': # we're not english if lang is not None and lang != 'en': # we're not english
# one in locale and one en # one in locale and one en
msgtxt = _('[This message is *encrypted* (See :XEP:`27`]') +\ msgtxt = _(msgtxt) + ' (' + msgtxt + ')'
' ([This message is *encrypted* (See :XEP:`27`])'
else: else:
# Encryption failed, do not send message # Encryption failed, do not send message
tim = localtime() tim = localtime()

View file

@ -11,6 +11,7 @@ import time
import xmpp.c14n import xmpp.c14n
import base64 import base64
import os
XmlDsig = 'http://www.w3.org/2000/09/xmldsig#' XmlDsig = 'http://www.w3.org/2000/09/xmldsig#'
@ -249,8 +250,12 @@ class EncryptedStanzaSession(StanzaSession):
c.NT.mac = base64.b64encode(self.hmac(self.km_s, m_content + \ c.NT.mac = base64.b64encode(self.hmac(self.km_s, m_content + \
crypto.encode_mpi(old_en_counter))) crypto.encode_mpi(old_en_counter)))
stanza.setBody(_('[This message is part of an encrypted session. ' msgtxt = '[This message is part of an encrypted session. ' \
'If you see this message, something went wrong.]')) 'If you see this message, something went wrong.]'
lang = os.getenv('LANG')
if lang is not None and lang != 'en': # we're not english
msgtxt = _(msgtxt) + ' (' + msgtxt + ')'
stanza.setBody(msgtxt)
return stanza return stanza