Check for eme tag before adding fallback text for empty-body OMEMO messages
This commit is contained in:
parent
73cb6eaa49
commit
78ec625dbe
|
@ -247,7 +247,9 @@ public class TrustManager {
|
||||||
StanzaNode? _encrypted = stanza.stanza.get_subnode("encrypted", NS_URI);
|
StanzaNode? _encrypted = stanza.stanza.get_subnode("encrypted", NS_URI);
|
||||||
if (_encrypted == null || MessageFlag.get_flag(stanza) != null || stanza.from == null) return false;
|
if (_encrypted == null || MessageFlag.get_flag(stanza) != null || stanza.from == null) return false;
|
||||||
StanzaNode encrypted = (!)_encrypted;
|
StanzaNode encrypted = (!)_encrypted;
|
||||||
if (message.body == null) message.body = "[This message is OMEMO encrypted]";
|
if (message.body == null && Xep.ExplicitEncryption.get_encryption_tag(stanza) == NS_URI) {
|
||||||
|
message.body = "[This message is OMEMO encrypted]"; // TODO temporary
|
||||||
|
};
|
||||||
if (!Plugin.ensure_context()) return false;
|
if (!Plugin.ensure_context()) return false;
|
||||||
MessageFlag flag = new MessageFlag();
|
MessageFlag flag = new MessageFlag();
|
||||||
stanza.add_flag(flag);
|
stanza.add_flag(flag);
|
||||||
|
|
|
@ -10,5 +10,13 @@ public static void add_encryption_tag_to_message(MessageStanza message, string n
|
||||||
|
|
||||||
message.stanza.put_node(encryption);
|
message.stanza.put_node(encryption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string? get_encryption_tag(MessageStanza message) {
|
||||||
|
StanzaNode? encryption_node = message.stanza.get_subnode("encryption", NS_URI);
|
||||||
|
if (encryption_node != null) {
|
||||||
|
return encryption_node.get_attribute("namespace", NS_URI);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue