From 8fdb38b99be9c588148d576c23212af765ff7302 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 19 Sep 2017 22:41:33 +0200 Subject: Use GNotification instead of libnotify --- libdino/src/service/chat_interaction.vala | 4 ++++ libdino/src/service/conversation_manager.vala | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'libdino/src') diff --git a/libdino/src/service/chat_interaction.vala b/libdino/src/service/chat_interaction.vala index 0aefc418..f08534aa 100644 --- a/libdino/src/service/chat_interaction.vala +++ b/libdino/src/service/chat_interaction.vala @@ -9,6 +9,8 @@ public class ChatInteraction : StreamInteractionModule, Object { public static ModuleIdentity IDENTITY = new ModuleIdentity("chat_interaction"); public string id { get { return IDENTITY.id; } } + public signal void focused_in(Conversation conversation); + public signal void focused_out(Conversation conversation); public signal void conversation_read(Conversation conversation); public signal void conversation_unread(Conversation conversation); @@ -77,6 +79,7 @@ public class ChatInteraction : StreamInteractionModule, Object { private void on_conversation_focused(Conversation? conversation) { focus_in = true; if (conversation == null) return; + focused_in(selected_conversation); conversation_read(selected_conversation); check_send_read(); selected_conversation.read_up_to = stream_interactor.get_module(MessageStorage.IDENTITY).get_last_message(conversation); @@ -85,6 +88,7 @@ public class ChatInteraction : StreamInteractionModule, Object { private void on_conversation_unfocused(Conversation? conversation) { focus_in = false; if (conversation == null) return; + focused_out(selected_conversation); if (last_input_interaction.has_key(conversation)) { send_chat_state_notification(conversation, Xep.ChatStateNotifications.STATE_PAUSED); last_input_interaction.unset(conversation); diff --git a/libdino/src/service/conversation_manager.vala b/libdino/src/service/conversation_manager.vala index 0f827e26..471ec74a 100644 --- a/libdino/src/service/conversation_manager.vala +++ b/libdino/src/service/conversation_manager.vala @@ -74,6 +74,15 @@ public class ConversationManager : StreamInteractionModule, Object { return null; } + public Conversation? get_conversation_by_id(int id) { + foreach (HashMap hm in conversations.values) { + foreach (Conversation conversation in hm.values) { + if (conversation.id == id) return conversation; + } + } + return null; + } + public Gee.List get_active_conversations() { Gee.List ret = new ArrayList(Conversation.equals_func); foreach (Account account in conversations.keys) { -- cgit v1.2.3-54-g00ecf