2014-09-19 18:42:07 +03:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
// Copyright 2014 Perttu Ahola <celeron55@gmail.com>
|
2014-09-18 23:47:05 +03:00
|
|
|
#pragma once
|
|
|
|
#include "interface/event.h"
|
2014-09-19 15:54:23 +03:00
|
|
|
#include "network/api.h"
|
2014-09-18 23:47:05 +03:00
|
|
|
|
|
|
|
namespace client_file
|
|
|
|
{
|
2014-09-19 02:54:36 +03:00
|
|
|
struct FilesTransmitted: public interface::Event::Private
|
2014-09-18 23:47:05 +03:00
|
|
|
{
|
|
|
|
network::PeerInfo::Id recipient;
|
|
|
|
|
2014-09-19 02:54:36 +03:00
|
|
|
FilesTransmitted(const network::PeerInfo::Id &recipient): recipient(
|
2014-10-08 00:48:30 +03:00
|
|
|
recipient){}
|
2014-09-18 23:47:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Interface
|
|
|
|
{
|
2014-09-19 16:46:17 +03:00
|
|
|
virtual void update_file_content(const ss_ &name, const ss_ &content) = 0;
|
2014-09-18 23:47:05 +03:00
|
|
|
virtual void add_file_content(const ss_ &name, const ss_ &content) = 0;
|
2014-09-19 16:46:17 +03:00
|
|
|
virtual void add_file_path(const ss_ &name, const ss_ &path) = 0;
|
2014-09-18 23:47:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
inline bool access(interface::Server *server,
|
2014-10-08 00:48:30 +03:00
|
|
|
std::function<void(client_file::Interface*)> cb)
|
2014-09-18 23:47:05 +03:00
|
|
|
{
|
2014-10-06 16:43:27 +03:00
|
|
|
return server->access_module("client_file", [&](interface::Module *module){
|
2014-10-08 00:48:30 +03:00
|
|
|
cb((client_file::Interface*)module->check_interface());
|
|
|
|
});
|
2014-09-18 23:47:05 +03:00
|
|
|
}
|
|
|
|
}
|
2014-09-24 14:53:57 +03:00
|
|
|
// vim: set noet ts=4 sw=4:
|