diff options
Diffstat (limited to 'libdino/src/service')
-rw-r--r-- | libdino/src/service/content_item_store.vala | 34 | ||||
-rw-r--r-- | libdino/src/service/message_correction.vala | 1 | ||||
-rw-r--r-- | libdino/src/service/message_processor.vala | 6 |
3 files changed, 10 insertions, 31 deletions
diff --git a/libdino/src/service/content_item_store.vala b/libdino/src/service/content_item_store.vala index ddb6571a..87244a23 100644 --- a/libdino/src/service/content_item_store.vala +++ b/libdino/src/service/content_item_store.vala @@ -14,7 +14,6 @@ public class ContentItemStore : StreamInteractionModule, Object { private StreamInteractor stream_interactor; private Database db; - private Gee.List<ContentFilter> filters = new ArrayList<ContentFilter>(); private HashMap<Conversation, ContentItemCollection> collection_conversations = new HashMap<Conversation, ContentItemCollection>(Conversation.hash_func, Conversation.equals_func); public static void start(StreamInteractor stream_interactor, Database db) { @@ -149,10 +148,6 @@ public class ContentItemStore : StreamInteractionModule, Object { return get_items_from_query(select, conversation); } - public void add_filter(ContentFilter content_filter) { - filters.add(content_filter); - } - public void insert_message(Message message, Conversation conversation, bool hide = false) { MessageItem item = new MessageItem(message, conversation, -1); item.id = db.add_content_item(conversation, message.time, message.local_time, 1, message.id, hide); @@ -165,12 +160,10 @@ public class ContentItemStore : StreamInteractionModule, Object { select.with(db.content_item.hide, "=", false); foreach (Row row in select) { MessageItem item = new MessageItem(message, conversation, row[db.content_item.id]); - if (!discard(item)) { - if (collection_conversations.has_key(conversation)) { - collection_conversations.get(conversation).insert_item(item); - } - new_item(item, conversation); + if (collection_conversations.has_key(conversation)) { + collection_conversations.get(conversation).insert_item(item); } + new_item(item, conversation); break; } } @@ -178,12 +171,10 @@ public class ContentItemStore : StreamInteractionModule, Object { private void insert_file_transfer(FileTransfer file_transfer, Conversation conversation) { FileItem item = new FileItem(file_transfer, conversation, -1); item.id = db.add_content_item(conversation, file_transfer.time, file_transfer.local_time, 2, file_transfer.id, false); - if (!discard(item)) { - if (collection_conversations.has_key(conversation)) { - collection_conversations.get(conversation).insert_item(item); - } - new_item(item, conversation); + if (collection_conversations.has_key(conversation)) { + collection_conversations.get(conversation).insert_item(item); } + new_item(item, conversation); } private void insert_call(Call call, Conversation conversation) { @@ -205,15 +196,6 @@ public class ContentItemStore : StreamInteractionModule, Object { .set(db.content_item.hide, hide) .perform(); } - - private bool discard(ContentItem content_item) { - foreach (ContentFilter filter in filters) { - if (filter.discard(content_item)) { - return true; - } - } - return false; - } } public interface ContentItemCollection : Object { @@ -221,10 +203,6 @@ public interface ContentItemCollection : Object { public abstract void remove_item(ContentItem item); } -public interface ContentFilter : Object { - public abstract bool discard(ContentItem content_item); -} - public abstract class ContentItem : Object { public int id { get; set; } public string type_ { get; set; } diff --git a/libdino/src/service/message_correction.vala b/libdino/src/service/message_correction.vala index 1374621a..322fa1c1 100644 --- a/libdino/src/service/message_correction.vala +++ b/libdino/src/service/message_correction.vala @@ -45,7 +45,6 @@ public class MessageCorrection : StreamInteractionModule, MessageListener { Message out_message = stream_interactor.get_module(MessageProcessor.IDENTITY).create_out_message(correction_text, conversation); out_message.edit_to = stanza_id; outstanding_correction_nodes[out_message.stanza_id] = stanza_id; - stream_interactor.get_module(MessageStorage.IDENTITY).add_message(out_message, conversation); stream_interactor.get_module(MessageProcessor.IDENTITY).send_xmpp_message(out_message, conversation); db.message_correction.insert() diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala index fcabeba6..4fe1f6c3 100644 --- a/libdino/src/service/message_processor.vala +++ b/libdino/src/service/message_processor.vala @@ -60,7 +60,6 @@ public class MessageProcessor : StreamInteractionModule, Object { } public Entities.Message send_message(Entities.Message message, Conversation conversation) { - stream_interactor.get_module(MessageStorage.IDENTITY).add_message(message, conversation); stream_interactor.get_module(ContentItemStore.IDENTITY).insert_message(message, conversation); send_xmpp_message(message, conversation); message_sent(message, conversation); @@ -575,7 +574,7 @@ public class MessageProcessor : StreamInteractionModule, Object { private class StoreContentItemListener : MessageListener { - public string[] after_actions_const = new string[]{ "DEDUPLICATE", "DECRYPT", "FILTER_EMPTY", "STORE", "CORRECTION" }; + public string[] after_actions_const = new string[]{ "DEDUPLICATE", "DECRYPT", "FILTER_EMPTY", "STORE", "CORRECTION", "MESSAGE_REINTERPRETING" }; public override string action_group { get { return "STORE_CONTENT_ITEM"; } } public override string[] after_actions { get { return after_actions_const; } } @@ -634,6 +633,9 @@ public class MessageProcessor : StreamInteractionModule, Object { } message.marked = Entities.Message.Marked.UNSENT; message.encryption = conversation.encryption; + + stream_interactor.get_module(MessageStorage.IDENTITY).add_message(message, conversation); + return message; } |