diff options
author | fiaxh <git@lightrise.org> | 2020-12-04 19:11:27 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-12-04 19:11:27 +0100 |
commit | cc01374d3cb6a8bf477e8f96378f20b9aff57536 (patch) | |
tree | 16275a127a84d9dc5aa1269aef7590d8fd8ea73d /libdino/src/service/file_manager.vala | |
parent | f31e96d6bb51448a87edd820ebca630ca576d890 (diff) | |
download | dino-cc01374d3cb6a8bf477e8f96378f20b9aff57536.tar.gz dino-cc01374d3cb6a8bf477e8f96378f20b9aff57536.zip |
Use advertized/server/live time for sorting instead of arrival time
fixes #310
Diffstat (limited to 'libdino/src/service/file_manager.vala')
-rw-r--r-- | libdino/src/service/file_manager.vala | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/libdino/src/service/file_manager.vala b/libdino/src/service/file_manager.vala index 192dc8a8..f3256601 100644 --- a/libdino/src/service/file_manager.vala +++ b/libdino/src/service/file_manager.vala @@ -149,47 +149,6 @@ public class FileManager : StreamInteractionModule, Object { return false; } - public Gee.List<FileTransfer> get_latest_transfers(Account account, Jid counterpart, int n) { - Qlite.QueryBuilder select = db.file_transfer.select() - .with(db.file_transfer.counterpart_id, "=", db.get_jid_id(counterpart)) - .with(db.file_transfer.account_id, "=", account.id) - .order_by(db.file_transfer.local_time, "DESC") - .limit(n); - return get_transfers_from_qry(select); - } - - public Gee.List<FileTransfer> get_transfers_before(Account account, Jid counterpart, DateTime before, int n) { - Qlite.QueryBuilder select = db.file_transfer.select() - .with(db.file_transfer.counterpart_id, "=", db.get_jid_id(counterpart)) - .with(db.file_transfer.account_id, "=", account.id) - .with(db.file_transfer.local_time, "<", (long)before.to_unix()) - .order_by(db.file_transfer.local_time, "DESC") - .limit(n); - return get_transfers_from_qry(select); - } - - public Gee.List<FileTransfer> get_transfers_after(Account account, Jid counterpart, DateTime after, int n) { - Qlite.QueryBuilder select = db.file_transfer.select() - .with(db.file_transfer.counterpart_id, "=", db.get_jid_id(counterpart)) - .with(db.file_transfer.account_id, "=", account.id) - .with(db.file_transfer.local_time, ">", (long)after.to_unix()) - .limit(n); - return get_transfers_from_qry(select); - } - - private Gee.List<FileTransfer> get_transfers_from_qry(Qlite.QueryBuilder select) { - Gee.List<FileTransfer> ret = new ArrayList<FileTransfer>(); - foreach (Qlite.Row row in select) { - try { - FileTransfer file_transfer = new FileTransfer.from_row(db, row, get_storage_dir()); - ret.insert(0, file_transfer); - } catch (InvalidJidError e) { - warning("Ignoring file transfer with invalid Jid: %s", e.message); - } - } - return ret; - } - public void add_provider(FileProvider file_provider) { file_providers.add(file_provider); file_provider.file_incoming.connect((info, from, time, local_time, conversation, receive_data, file_meta) => { |