[omemo] Let gajim-core issue a warning on plain text
This commit is contained in:
@@ -428,18 +428,6 @@ class OmemoPlugin(GajimPlugin):
|
|||||||
msg.encrypted = self.encryption_name
|
msg.encrypted = self.encryption_name
|
||||||
return
|
return
|
||||||
|
|
||||||
elif msg.msg_.getTag('body'):
|
|
||||||
account = msg.conn.name
|
|
||||||
|
|
||||||
from_jid = str(msg.msg_.getAttr('from'))
|
|
||||||
from_jid = gajim.get_jid_without_resource(from_jid)
|
|
||||||
|
|
||||||
state = self.get_omemo_state(account)
|
|
||||||
encryption = gajim.config.get_per('contacts', from_jid, 'encryption')
|
|
||||||
|
|
||||||
if encryption == 'OMEMO':
|
|
||||||
msg.msgtxt = '**Unencrypted** ' + msg.msgtxt
|
|
||||||
|
|
||||||
def _message_received(self, msg):
|
def _message_received(self, msg):
|
||||||
""" Handles an incoming message
|
""" Handles an incoming message
|
||||||
|
|
||||||
@@ -520,22 +508,6 @@ class OmemoPlugin(GajimPlugin):
|
|||||||
msg.stanza.setBody(plaintext)
|
msg.stanza.setBody(plaintext)
|
||||||
msg.encrypted = self.encryption_name
|
msg.encrypted = self.encryption_name
|
||||||
|
|
||||||
elif msg.stanza.getTag('body'):
|
|
||||||
account = msg.conn.name
|
|
||||||
|
|
||||||
from_jid = str(msg.stanza.getFrom())
|
|
||||||
jid = gajim.get_jid_without_resource(from_jid)
|
|
||||||
state = self.get_omemo_state(account)
|
|
||||||
encryption = gajim.config.get_per('contacts', jid, 'encryption')
|
|
||||||
|
|
||||||
if encryption == 'OMEMO':
|
|
||||||
msg.msgtxt = '**Unencrypted** ' + msg.msgtxt
|
|
||||||
msg.stanza.setBody(msg.msgtxt)
|
|
||||||
|
|
||||||
ctrl = gajim.interface.msg_win_mgr.get_control(jid, account)
|
|
||||||
if ctrl:
|
|
||||||
self.plain_warning(ctrl)
|
|
||||||
|
|
||||||
def room_memberlist_received(self, event):
|
def room_memberlist_received(self, event):
|
||||||
account = event.conn.name
|
account = event.conn.name
|
||||||
if account in self.disabled_accounts:
|
if account in self.disabled_accounts:
|
||||||
@@ -1107,12 +1079,6 @@ class OmemoPlugin(GajimPlugin):
|
|||||||
log.debug(stanzastr)
|
log.debug(stanzastr)
|
||||||
log.debug('-'*15)
|
log.debug('-'*15)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def plain_warning(chat_control):
|
|
||||||
chat_control.print_conversation_line(
|
|
||||||
'Received plaintext message! ' +
|
|
||||||
'Your next message will still be encrypted!', 'status', '', None)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def no_trusted_fingerprints_warning(chat_control):
|
def no_trusted_fingerprints_warning(chat_control):
|
||||||
msg = "To send an encrypted message, you have to " \
|
msg = "To send an encrypted message, you have to " \
|
||||||
|
|||||||
Reference in New Issue
Block a user