2017-08-02 15:29:55 +00:00
|
|
|
extern const string GETTEXT_PACKAGE;
|
|
|
|
extern const string LOCALE_INSTALL_DIR;
|
|
|
|
|
|
|
|
namespace Dino.Plugins.HttpFiles {
|
|
|
|
|
|
|
|
public class Plugin : RootInterface, Object {
|
|
|
|
|
|
|
|
public Dino.Application app;
|
2017-08-29 22:03:37 +00:00
|
|
|
public FileProvider file_provider;
|
2019-07-18 00:03:42 +00:00
|
|
|
public FileSender file_sender;
|
2017-08-02 15:29:55 +00:00
|
|
|
|
|
|
|
public void registered(Dino.Application app) {
|
2017-10-28 21:48:07 +00:00
|
|
|
this.app = app;
|
2017-08-29 22:03:37 +00:00
|
|
|
|
2017-10-28 21:48:07 +00:00
|
|
|
file_provider = new FileProvider(app.stream_interactor, app.db);
|
2019-07-18 00:03:42 +00:00
|
|
|
file_sender = new HttpFileSender(app.stream_interactor, app.db);
|
2017-08-02 15:29:55 +00:00
|
|
|
|
2017-10-28 21:48:07 +00:00
|
|
|
app.stream_interactor.get_module(FileManager.IDENTITY).add_provider(file_provider);
|
2019-07-18 00:03:42 +00:00
|
|
|
app.stream_interactor.get_module(FileManager.IDENTITY).add_sender(file_sender);
|
|
|
|
|
2018-07-16 19:26:39 +00:00
|
|
|
app.stream_interactor.get_module(ContentItemStore.IDENTITY).add_filter(new FileMessageFilter(app.db));
|
2017-08-02 15:29:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void shutdown() {
|
|
|
|
// Nothing to do
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-18 00:03:42 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-08-02 15:29:55 +00:00
|
|
|
}
|