aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/entity/file_transfer.vala
diff options
context:
space:
mode:
authorfabrixxm <fabrixxm@kirgroup.net>2025-05-21 11:46:13 +0200
committerfiaxh <git@lightrise.org>2025-05-23 19:05:53 +0200
commit22616c74587d60c1fe2eb360d87efa640b7b5908 (patch)
tree6ee61569bfbbd8357d6476477db4907689e596f5 /libdino/src/entity/file_transfer.vala
parent0a564f80ab6fa2707f4577d89416b17d3c9aa28e (diff)
FileTransfer fix store source
Store source in db and add sources to `sfs_sources` is divided in two functions. `persists()` now calls `store_source`, because the sources it want to persist are already added to `sfs_sources`.
Diffstat (limited to 'libdino/src/entity/file_transfer.vala')
-rw-r--r--libdino/src/entity/file_transfer.vala10
1 files changed, 7 insertions, 3 deletions
diff --git a/libdino/src/entity/file_transfer.vala b/libdino/src/entity/file_transfer.vala
index 49ff2aa3..52347028 100644
--- a/libdino/src/entity/file_transfer.vala
+++ b/libdino/src/entity/file_transfer.vala
@@ -224,7 +224,7 @@ public class FileTransfer : Object {
}
foreach (Xep.StatelessFileSharing.Source source in sfs_sources) {
- add_sfs_source(source);
+ persist_source(source);
}
notify.connect(on_update);
@@ -234,7 +234,13 @@ public class FileTransfer : Object {
if (sfs_sources.contains(source)) return; // Don't add the same source twice. Might happen due to MAM and lacking deduplication.
sfs_sources.add(source);
+ if (id != -1) {
+ persist_source(source);
+ }
+ sources_changed();
+ }
+ private void persist_source(Xep.StatelessFileSharing.Source source) {
Xep.StatelessFileSharing.HttpSource? http_source = source as Xep.StatelessFileSharing.HttpSource;
if (http_source != null) {
db.sfs_sources.insert()
@@ -243,8 +249,6 @@ public class FileTransfer : Object {
.value(db.sfs_sources.data, http_source.url)
.perform();
}
-
- sources_changed();
}
public File? get_file() {