diff options
author | bobufa <bobufa@users.noreply.github.com> | 2018-07-25 20:41:51 +0200 |
---|---|---|
committer | bobufa <bobufa@users.noreply.github.com> | 2018-08-13 22:39:18 +0200 |
commit | e376a577b6bfcdd9bdc0cc6ca283d99199a0197a (patch) | |
tree | 741cab1ce822fcfc89655e762abfe2ceb3892357 /libdino/src/service/message_storage.vala | |
parent | 4901b096708ff5ca54c3e5393de74f2a8be55894 (diff) | |
download | dino-e376a577b6bfcdd9bdc0cc6ca283d99199a0197a.tar.gz dino-e376a577b6bfcdd9bdc0cc6ca283d99199a0197a.zip |
improve sidebar UI
- only display messages that are content items
- only display messages for active accounts
- "fix" textview issue
- add empty states (no search, no results)
Diffstat (limited to 'libdino/src/service/message_storage.vala')
-rw-r--r-- | libdino/src/service/message_storage.vala | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libdino/src/service/message_storage.vala b/libdino/src/service/message_storage.vala index 9fb6ab19..50fc94b3 100644 --- a/libdino/src/service/message_storage.vala +++ b/libdino/src/service/message_storage.vala @@ -52,7 +52,7 @@ public class MessageStorage : StreamInteractionModule, Object { return null; } - public Gee.List<Message>? get_messages_before_message(Conversation? conversation, DateTime before, int id, int count = 20) { + public Gee.List<MessageItem> get_messages_before_message(Conversation? conversation, DateTime before, int id, int count = 20) { // SortedSet<Message>? before = messages[conversation].head_set(message); // if (before != null && before.size >= count) { // Gee.List<Message> ret = new ArrayList<Message>(Message.equals_func); @@ -66,14 +66,22 @@ public class MessageStorage : StreamInteractionModule, Object { // } // return ret; // } else { - Gee.List<Message> db_messages = db.get_messages(conversation.counterpart, conversation.account, Util.get_message_type_for_conversation(conversation), count, before, null, id); - return db_messages; + Gee.List<Message> db_messages = db.get_messages(conversation.counterpart, conversation.account, Util.get_message_type_for_conversation(conversation), count, before, null, id); + Gee.List<MessageItem> ret = new ArrayList<MessageItem>(); + foreach (Message message in db_messages) { + ret.add(new MessageItem(message, conversation, -1)); + } + return ret; // } } - public Gee.List<Message>? get_messages_after_message(Conversation? conversation, DateTime after, int id, int count = 20) { + public Gee.List<MessageItem> get_messages_after_message(Conversation? conversation, DateTime after, int id, int count = 20) { Gee.List<Message> db_messages = db.get_messages(conversation.counterpart, conversation.account, Util.get_message_type_for_conversation(conversation), count, null, after, id); - return db_messages; + Gee.List<MessageItem> ret = new ArrayList<MessageItem>(); + foreach (Message message in db_messages) { + ret.add(new MessageItem(message, conversation, -1)); + } + return ret; } public Message? get_message_by_id(int id, Conversation conversation) { |