diff options
author | fiaxh <git@lightrise.org> | 2019-07-18 02:03:42 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-07-18 02:03:42 +0200 |
commit | f0abb8aaf9d06106235ca5e0e6b3ca2e425c4422 (patch) | |
tree | 03fce63f8c37b50b5202690a6801234724ed0021 /plugins/http-files/src/plugin.vala | |
parent | 30353e92d63c033857ad0396c921b3bf5cab44c3 (diff) | |
download | dino-f0abb8aaf9d06106235ca5e0e6b3ca2e425c4422.tar.gz dino-f0abb8aaf9d06106235ca5e0e6b3ca2e425c4422.zip |
Refactor file receive/send interfaces and UI
Diffstat (limited to 'plugins/http-files/src/plugin.vala')
-rw-r--r-- | plugins/http-files/src/plugin.vala | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/http-files/src/plugin.vala b/plugins/http-files/src/plugin.vala index e2ce5ad9..bdf48770 100644 --- a/plugins/http-files/src/plugin.vala +++ b/plugins/http-files/src/plugin.vala @@ -7,14 +7,17 @@ public class Plugin : RootInterface, Object { public Dino.Application app; public FileProvider file_provider; + public FileSender file_sender; public void registered(Dino.Application app) { this.app = app; - Manager.start(this.app.stream_interactor, app.db); file_provider = new FileProvider(app.stream_interactor, app.db); + file_sender = new HttpFileSender(app.stream_interactor, app.db); app.stream_interactor.get_module(FileManager.IDENTITY).add_provider(file_provider); + app.stream_interactor.get_module(FileManager.IDENTITY).add_sender(file_sender); + app.stream_interactor.get_module(ContentItemStore.IDENTITY).add_filter(new FileMessageFilter(app.db)); } @@ -23,4 +26,10 @@ public class Plugin : RootInterface, Object { } } +private bool message_is_file(Database db, Entities.Message message) { + Qlite.QueryBuilder builder = db.file_transfer.select({db.file_transfer.id}).with(db.file_transfer.info, "=", message.id.to_string()); + Qlite.QueryBuilder builder2 = db.file_transfer.select({db.file_transfer.id}).with(db.file_transfer.info, "=", message.body); + return builder.count() > 0 || builder2.count() > 0; +} + } |