diff options
Diffstat (limited to 'libdino/src/application.vala')
-rw-r--r-- | libdino/src/application.vala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libdino/src/application.vala b/libdino/src/application.vala index 55913a99..f6e651a4 100644 --- a/libdino/src/application.vala +++ b/libdino/src/application.vala @@ -38,6 +38,8 @@ public interface Dino.Application : GLib.Application { ChatInteraction.start(stream_interactor); FileManager.start(stream_interactor, db); + create_actions(); + activate.connect(() => { stream_interactor.connection_manager.log_options = print_xmpp; Idle.add(() => { @@ -93,6 +95,17 @@ public interface Dino.Application : GLib.Application { return (Dino.Application) GLib.Application.get_default(); } + public void create_actions() { + SimpleAction accept_subscription_action = new SimpleAction("accept-subscription", VariantType.INT32); + accept_subscription_action.activate.connect((variant) => { + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(variant.get_int32()); + if (conversation == null) return; + stream_interactor.get_module(PresenceManager.IDENTITY).approve_subscription(conversation.account, conversation.counterpart); + stream_interactor.get_module(PresenceManager.IDENTITY).request_subscription(conversation.account, conversation.counterpart); + }); + add_action(accept_subscription_action); + } + protected void add_connection(Account account) { stream_interactor.connect(account); } |