diff options
author | fiaxh <git@mx.ax.lt> | 2018-11-04 20:19:34 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2018-11-04 20:19:34 +0100 |
commit | 3af9faac82dc19d5d9059d190cc17ce7186e4a10 (patch) | |
tree | a47c7248e2c021264822b6f6398750df52da3dc9 /libdino/src/service | |
parent | ddd17e720e9170ea7016e2fdf80f91808666ec36 (diff) | |
download | dino-3af9faac82dc19d5d9059d190cc17ce7186e4a10.tar.gz dino-3af9faac82dc19d5d9059d190cc17ce7186e4a10.zip |
Use ContentItems in ConversationSelector, Chat/Groupchat(Pm)Row -> ConversationRow
Diffstat (limited to 'libdino/src/service')
-rw-r--r-- | libdino/src/service/content_item_store.vala | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libdino/src/service/content_item_store.vala b/libdino/src/service/content_item_store.vala index 0b89e288..1886236c 100644 --- a/libdino/src/service/content_item_store.vala +++ b/libdino/src/service/content_item_store.vala @@ -82,7 +82,15 @@ public class ContentItemStore : StreamInteractionModule, Object { return item.size > 0 ? item[0] : null; } - public Gee.List<ContentItem> get_latest(Conversation conversation, int count) { + public ContentItem? get_latest(Conversation conversation) { + Gee.List<ContentItem> items = get_n_latest(conversation, 1); + if (items.size > 0) { + return items.get(0); + } + return null; + } + + public Gee.List<ContentItem> get_n_latest(Conversation conversation, int count) { QueryBuilder select = db.content_item.select() .with(db.content_item.conversation_id, "=", conversation.id) .with(db.content_item.hide, "=", false) |