aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/application.vala
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2019-12-22 04:10:53 +0100
committerMarvin W <git@larma.de>2019-12-23 16:58:53 +0100
commita0a956ee0878d24bd06be7f5d75dc4ccd4e7901d (patch)
treecbb079649066c2001b6d6881137108e70eed9d3f /main/src/ui/application.vala
parent3218dc0211ac717230fe03fad82681a626d968b5 (diff)
downloaddino-a0a956ee0878d24bd06be7f5d75dc4ccd4e7901d.tar.gz
dino-a0a956ee0878d24bd06be7f5d75dc4ccd4e7901d.zip
Properly check Jids everywhere
Diffstat (limited to 'main/src/ui/application.vala')
-rw-r--r--main/src/ui/application.vala18
1 files changed, 12 insertions, 6 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index c8db09da..2b4b2d3e 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -50,12 +50,18 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
public void handle_uri(string jid, string query, Gee.Map<string, string> options) {
switch (query) {
case "join":
- show_join_muc_dialog(null, new Jid(jid));
+ show_join_muc_dialog(null, jid);
break;
case "message":
Gee.List<Account> accounts = stream_interactor.get_accounts();
- if (accounts.size == 1) {
- Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(new Jid(jid), accounts[0], Conversation.Type.CHAT);
+ Jid parsed_jid = null;
+ try {
+ parsed_jid = new Jid(jid);
+ } catch (InvalidJidError ignored) {
+ // Ignored
+ }
+ if (accounts.size == 1 && parsed_jid != null) {
+ Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(parsed_jid, accounts[0], Conversation.Type.CHAT);
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
controller.select_conversation(conversation);
} else {
@@ -128,7 +134,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
accept_muc_invite_action.activate.connect((variant) => {
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(variant.get_int32());
if (conversation == null) return;
- show_join_muc_dialog(conversation.account, conversation.counterpart);
+ show_join_muc_dialog(conversation.account, conversation.counterpart.to_string());
});
add_action(accept_muc_invite_action);
@@ -182,13 +188,13 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
license_type: License.GPL_3_0);
}
- private void show_join_muc_dialog(Account? account, Jid jid) {
+ private void show_join_muc_dialog(Account? account, string jid) {
Dialog dialog = new Dialog.with_buttons(_("Join Channel"), window, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.USE_HEADER_BAR, _("Join"), ResponseType.OK, _("Cancel"), ResponseType.CANCEL);
dialog.modal = true;
Button ok_button = dialog.get_widget_for_response(ResponseType.OK) as Button;
ok_button.get_style_context().add_class("suggested-action");
ConferenceDetailsFragment conference_fragment = new ConferenceDetailsFragment(stream_interactor) { ok_button=ok_button };
- conference_fragment.jid = jid.to_string();
+ conference_fragment.jid = jid;
if (account != null) {
conference_fragment.account = account;
}