initial scaffolding for inverted, custom message list
This commit is contained in:
@@ -4,6 +4,7 @@ using Gee;
|
||||
public class Repository : Object
|
||||
{
|
||||
public signal void conversations_updated();
|
||||
public signal void messages_updated(string conversation_guid);
|
||||
|
||||
public static Repository get_instance() {
|
||||
if (instance == null) {
|
||||
@@ -43,6 +44,21 @@ public class Repository : Object
|
||||
|
||||
return returned_conversations;
|
||||
}
|
||||
|
||||
public Message[] get_messages(string conversation_guid, string last_message_id = "") throws Error {
|
||||
if (dbus_repository == null) {
|
||||
throw new Error(1337, 1, "Repository not connected");
|
||||
}
|
||||
|
||||
var messages = dbus_repository.get_messages(conversation_guid, last_message_id);
|
||||
Message[] returned_messages = new Message[messages.length];
|
||||
|
||||
for (int i = 0; i < messages.length; i++) {
|
||||
returned_messages[i] = new Message.from_hash_table(messages[i]);
|
||||
}
|
||||
|
||||
return returned_messages;
|
||||
}
|
||||
|
||||
private async void connect_to_dbus() {
|
||||
bool connected = false;
|
||||
@@ -65,6 +81,10 @@ public class Repository : Object
|
||||
dbus_repository.conversations_updated.connect(() => {
|
||||
conversations_updated();
|
||||
});
|
||||
|
||||
dbus_repository.messages_updated.connect((conversation_guid) => {
|
||||
messages_updated(conversation_guid);
|
||||
});
|
||||
|
||||
// Initial load
|
||||
conversations_updated();
|
||||
|
||||
Reference in New Issue
Block a user