aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-10-22 03:39:13 +0200
committerfiaxh <git@mx.ax.lt>2017-10-22 18:26:31 +0200
commit128a015d45031f2b064f3a8e4d6bb99579eefd60 (patch)
tree63cbdc979c8676babb7bbc9499f97dc03994126b /main/src
parent555187deb9a5ce1af94d241868de6babdd6166b6 (diff)
downloaddino-128a015d45031f2b064f3a8e4d6bb99579eefd60.tar.gz
dino-128a015d45031f2b064f3a8e4d6bb99579eefd60.zip
Directly start chat from xmpp uri if only one account is active
fixes #160
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/application.vala25
1 files changed, 16 insertions, 9 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index 5ce5e063..ff5f44ac 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -58,17 +58,24 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
dialog.present();
break;
case "message":
- AddConversation.Chat.Dialog dialog = new AddConversation.Chat.Dialog(stream_interactor, stream_interactor.get_accounts());
- dialog.set_filter(jid);
- dialog.set_transient_for(window);
- dialog.title = _("Start Chat");
- dialog.ok_button.label = _("Start");
- dialog.selected.connect((account, jid) => {
- Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.CHAT);
+ 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);
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true);
window.on_conversation_selected(conversation);
- });
- dialog.present();
+ } else {
+ AddConversation.Chat.Dialog dialog = new AddConversation.Chat.Dialog(stream_interactor, stream_interactor.get_accounts());
+ dialog.set_filter(jid);
+ dialog.set_transient_for(window);
+ dialog.title = _("Start Chat");
+ dialog.ok_button.label = _("Start");
+ dialog.selected.connect((account, jid) => {
+ Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.CHAT);
+ stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true);
+ window.on_conversation_selected(conversation);
+ });
+ dialog.present();
+ }
break;
}
}