Module creation, message routing
This commit is contained in:
parent
bc2dc9bf07
commit
c605b3ba93
14 changed files with 154 additions and 26 deletions
|
@ -4,17 +4,33 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "gloox/client.h"
|
||||
|
||||
#include "component/actor.h"
|
||||
|
||||
namespace Module {
|
||||
|
||||
class Module {
|
||||
protected:
|
||||
Module();
|
||||
public:
|
||||
typedef std::vector<std::string> Tokens;
|
||||
|
||||
virtual void message(const std::string& text) = 0;
|
||||
protected:
|
||||
Module(const std::shared_ptr<gloox::Client>& client);
|
||||
void sendMessage(const std::shared_ptr<Actor>& actor, const std::string& body);
|
||||
|
||||
public:
|
||||
virtual ~Module() noexcept;
|
||||
|
||||
static Tokens split(const std::string& string, const std::string& delimiter = " ");
|
||||
|
||||
virtual void message(const std::shared_ptr<Actor>& actor, const Tokens& args) = 0;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<gloox::Client> client;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue