aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/content_item_store.vala
diff options
context:
space:
mode:
Diffstat (limited to 'libdino/src/service/content_item_store.vala')
-rw-r--r--libdino/src/service/content_item_store.vala34
1 files changed, 6 insertions, 28 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; }