aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-09-19 22:41:33 +0200
committerfiaxh <git@mx.ax.lt>2017-09-19 23:39:17 +0200
commit8fdb38b99be9c588148d576c23212af765ff7302 (patch)
tree2971a06390d8499a19487c3832df994f1769f6ea /libdino/src/service
parent1f0df864453f4fd9c3d8ba2d90f3def26cbdf862 (diff)
downloaddino-8fdb38b99be9c588148d576c23212af765ff7302.tar.gz
dino-8fdb38b99be9c588148d576c23212af765ff7302.zip
Use GNotification instead of libnotify
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/chat_interaction.vala4
-rw-r--r--libdino/src/service/conversation_manager.vala9
2 files changed, 13 insertions, 0 deletions
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<ChatInteraction> IDENTITY = new ModuleIdentity<ChatInteraction>("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<Jid, Conversation> hm in conversations.values) {
+ foreach (Conversation conversation in hm.values) {
+ if (conversation.id == id) return conversation;
+ }
+ }
+ return null;
+ }
+
public Gee.List<Conversation> get_active_conversations() {
Gee.List<Conversation> ret = new ArrayList<Conversation>(Conversation.equals_func);
foreach (Account account in conversations.keys) {