From 75e51b5ed3b639b9cf7b16b0ddbee7e362c44ef1 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 4 Apr 2017 15:47:00 +0200 Subject: MessageStorage/Processor, correctly resolve conversations (fixup 22adbd3) --- main/src/ui/chat_input/occupants_tab_completer.vala | 14 ++++++-------- main/src/ui/chat_input/view.vala | 4 ++-- main/src/ui/conversation_selector/conversation_row.vala | 2 +- main/src/ui/conversation_selector/list.vala | 4 ++-- main/src/ui/conversation_summary/view.vala | 10 +++++----- main/src/ui/notifications.vala | 2 +- 6 files changed, 17 insertions(+), 19 deletions(-) (limited to 'main') diff --git a/main/src/ui/chat_input/occupants_tab_completer.vala b/main/src/ui/chat_input/occupants_tab_completer.vala index 93b0e7ff..9ef73d8b 100644 --- a/main/src/ui/chat_input/occupants_tab_completer.vala +++ b/main/src/ui/chat_input/occupants_tab_completer.vala @@ -87,14 +87,12 @@ class OccupantsTabCompletor { private Gee.List generate_completions_from_messages() { Gee.List ret = new ArrayList(); - Gee.List? messages = stream_interactor.get_module(MessageManager.IDENTITY).get_messages(conversation, 10); - if (messages != null) { - for (int i = messages.size - 1; i > 0; i--) { - string resourcepart = messages[i].from.resourcepart; - string own_nick = stream_interactor.get_module(MucManager.IDENTITY).get_nick(conversation.counterpart, conversation.account); - if (resourcepart != null && resourcepart != "" && resourcepart != own_nick && !ret.contains(resourcepart)) { - ret.add(resourcepart); - } + Gee.List messages = stream_interactor.get_module(MessageStorage.IDENTITY).get_messages(conversation, 10); + for (int i = messages.size - 1; i > 0; i--) { + string resourcepart = messages[i].from.resourcepart; + string own_nick = stream_interactor.get_module(MucManager.IDENTITY).get_nick(conversation.counterpart, conversation.account); + if (resourcepart != null && resourcepart != "" && resourcepart != own_nick && !ret.contains(resourcepart)) { + ret.add(resourcepart); } } return ret; diff --git a/main/src/ui/chat_input/view.vala b/main/src/ui/chat_input/view.vala index 310c0f35..c0acfcfa 100644 --- a/main/src/ui/chat_input/view.vala +++ b/main/src/ui/chat_input/view.vala @@ -56,7 +56,7 @@ public class View : Box { stream_interactor.get_module(MucManager.IDENTITY).kick(conversation.account, conversation.counterpart, token[1]); break; case "/me": - stream_interactor.get_module(MessageManager.IDENTITY).send_message(text, conversation); + stream_interactor.get_module(MessageProcessor.IDENTITY).send_message(text, conversation); break; case "/nick": stream_interactor.get_module(MucManager.IDENTITY).change_nick(conversation.account, conversation.counterpart, token[1]); @@ -66,7 +66,7 @@ public class View : Box { break; } } else { - stream_interactor.get_module(MessageManager.IDENTITY).send_message(text, conversation); + stream_interactor.get_module(MessageProcessor.IDENTITY).send_message(text, conversation); } text_input.buffer.text = ""; } diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala index ce8845f2..d05973db 100644 --- a/main/src/ui/conversation_selector/conversation_row.vala +++ b/main/src/ui/conversation_selector/conversation_row.vala @@ -46,7 +46,7 @@ public abstract class ConversationRow : ListBoxRow { x_button.clicked.connect(on_x_button_clicked); update_name(Util.get_conversation_display_name(stream_interactor, conversation)); - Entities.Message message = stream_interactor.get_module(MessageManager.IDENTITY).get_last_message(conversation); + Entities.Message message = stream_interactor.get_module(MessageStorage.IDENTITY).get_last_message(conversation); if (message != null) { message_received(message); } diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala index f580c4c5..2e56a305 100644 --- a/main/src/ui/conversation_selector/list.vala +++ b/main/src/ui/conversation_selector/list.vala @@ -31,10 +31,10 @@ public class List : ListBox { stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect((conversation) => { Idle.add(() => {add_conversation(conversation); return false;}); }); - stream_interactor.get_module(MessageManager.IDENTITY).message_received.connect((message, conversation) => { + stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect((message, conversation) => { Idle.add(() => {on_message_received(message, conversation); return false;}); }); - stream_interactor.get_module(MessageManager.IDENTITY).message_sent.connect((message, conversation) => { + stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect((message, conversation) => { Idle.add(() => {on_message_received(message, conversation); return false;}); }); stream_interactor.get_module(PresenceManager.IDENTITY).show_received.connect((show, jid, account) => { diff --git a/main/src/ui/conversation_summary/view.vala b/main/src/ui/conversation_summary/view.vala index d264de32..179c14e3 100644 --- a/main/src/ui/conversation_summary/view.vala +++ b/main/src/ui/conversation_summary/view.vala @@ -35,10 +35,10 @@ public class View : Box { stream_interactor.get_module(CounterpartInteractionManager.IDENTITY).received_state.connect((account, jid, state) => { Idle.add(() => { on_received_state(account, jid, state); return false; }); }); - stream_interactor.get_module(MessageManager.IDENTITY).message_received.connect((message, conversation) => { + stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect((message, conversation) => { Idle.add(() => { show_message(message, conversation, true); return false; }); }); - stream_interactor.get_module(MessageManager.IDENTITY).message_sent.connect((message, conversation) => { + stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect((message, conversation) => { Idle.add(() => { show_message(message, conversation, true); return false; }); }); stream_interactor.get_module(PresenceManager.IDENTITY).show_received.connect((show, jid, account) => { @@ -65,8 +65,8 @@ public class View : Box { last_conversation_item = null; ArrayList objects = new ArrayList(); - Gee.List? messages = stream_interactor.get_module(MessageManager.IDENTITY).get_messages(conversation); - if (messages != null && messages.size > 0) { + Gee.List messages = stream_interactor.get_module(MessageStorage.IDENTITY).get_messages(conversation); + if (messages.size > 0) { earliest_message = messages[0]; objects.add_all(messages); } @@ -158,7 +158,7 @@ public class View : Box { if(reloading) return; reloading = true; } - Gee.List? messages = stream_interactor.get_module(MessageManager.IDENTITY).get_messages_before(conversation, earliest_message); + Gee.List? messages = stream_interactor.get_module(MessageStorage.IDENTITY).get_messages_before(conversation, earliest_message); if (messages != null && messages.size > 0) { earliest_message = messages[0]; MergedMessageItem? current_item = null; diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala index 9d91598a..3846c7ba 100644 --- a/main/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala @@ -24,7 +24,7 @@ public class Notifications : Object { } public void start() { - stream_interactor.get_module(MessageManager.IDENTITY).message_received.connect(on_message_received); + stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect(on_message_received); stream_interactor.get_module(PresenceManager.IDENTITY).received_subscription_request.connect(on_received_subscription_request); } -- cgit v1.2.3-70-g09d2