aboutsummaryrefslogtreecommitdiff
path: root/plugins/omemo
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-12-04 17:10:46 +0100
committerfiaxh <git@lightrise.org>2020-12-04 17:16:09 +0100
commitf31e96d6bb51448a87edd820ebca630ca576d890 (patch)
treea5073e29a7520d7356c7641545aea024ddd06d8e /plugins/omemo
parentc0be0f5f85e9976400be5a6f7f3898366ecbbad4 (diff)
downloaddino-f31e96d6bb51448a87edd820ebca630ca576d890.tar.gz
dino-f31e96d6bb51448a87edd820ebca630ca576d890.zip
Improve contact description in OMEMO warnings
fixes #947
Diffstat (limited to 'plugins/omemo')
-rw-r--r--plugins/omemo/src/ui/bad_messages_populator.vala19
1 files changed, 12 insertions, 7 deletions
diff --git a/plugins/omemo/src/ui/bad_messages_populator.vala b/plugins/omemo/src/ui/bad_messages_populator.vala
index 2f878aaa..4984cc6c 100644
--- a/plugins/omemo/src/ui/bad_messages_populator.vala
+++ b/plugins/omemo/src/ui/bad_messages_populator.vala
@@ -137,9 +137,12 @@ public class BadMessagesWidget : Box {
this.halign = Align.CENTER;
this.visible = true;
- var sb = new StringBuilder();
- string who = _("Your contact");
- if (conversation.type_ == Conversation.Type.GROUPCHAT) {
+ string who = "";
+ if (conversation.type_ == Conversation.Type.CHAT) {
+ who = Dino.get_participant_display_name(plugin.app.stream_interactor, conversation, jid);
+ } else if (conversation.type_ == Conversation.Type.GROUPCHAT) {
+ who = jid.to_string();
+ // `jid` is a real JID. In MUCs, try to show nicks instead (given that the JID is currently online)
var occupants = plugin.app.stream_interactor.get_module(MucManager.IDENTITY).get_occupants(conversation.counterpart, conversation.account);
if (occupants == null) return;
foreach (Jid occupant in occupants) {
@@ -148,13 +151,15 @@ public class BadMessagesWidget : Box {
}
}
}
+
+ string warning_text = "";
if (badness_type == BadnessType.UNTRUSTED) {
- sb.append(_("%s has been using an untrusted device. You won't see messages from devices that you do not trust.").printf(who));
- sb.append(" <a href=\"\">%s</a>".printf(_("Manage devices")));
+ warning_text = _("%s has been using an untrusted device. You won't see messages from devices that you do not trust.").printf(who) +
+ " <a href=\"\">%s</a>".printf(_("Manage devices"));
} else {
- sb.append(_("%s does not trust this device. That means, you might be missing messages.").printf(who));
+ warning_text += _("%s does not trust this device. That means, you might be missing messages.").printf(who);
}
- Label label = new Label(sb.str) { margin_start=70, margin_end=70, justify=Justification.CENTER, use_markup=true, selectable=true, wrap=true, wrap_mode=Pango.WrapMode.WORD_CHAR, hexpand=true, visible=true };
+ Label label = new Label(warning_text) { margin_start=70, margin_end=70, justify=Justification.CENTER, use_markup=true, selectable=true, wrap=true, wrap_mode=Pango.WrapMode.WORD_CHAR, hexpand=true, visible=true };
label.get_style_context().add_class("dim-label");
this.add(label);