From 4f4a1036e1ca17eb105d6f35ed83cfbefd936c77 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 2 Dec 2020 16:45:28 +0100 Subject: [PATCH] Handle xmpp URIs opened within Dino with Dino fixes #914 --- .../src/ui/conversation_content_view/message_widget.vala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main/src/ui/conversation_content_view/message_widget.vala b/main/src/ui/conversation_content_view/message_widget.vala index 3186cfbb..05661e56 100644 --- a/main/src/ui/conversation_content_view/message_widget.vala +++ b/main/src/ui/conversation_content_view/message_widget.vala @@ -91,6 +91,7 @@ public class MessageItemWidget : SizeRequestBin { construct { this.add(label); + label.activate_link.connect(on_label_activate_link); this.size_request_mode = SizeRequestMode.HEIGHT_FOR_WIDTH; } @@ -217,6 +218,14 @@ public class MessageItemWidget : SizeRequestBin { } return markup_text; } + + public static bool on_label_activate_link(string uri) { + // Always handle xmpp URIs with Dino + if (!uri.has_prefix("xmpp:")) return false; + File file = File.new_for_uri(uri); + Dino.Application.get_default().open(new File[]{file}, ""); + return true; + } } [GtkTemplate (ui = "/im/dino/Dino/message_item_widget_edit_mode.ui")]