diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-05-06 17:09:32 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-05-06 18:54:24 +0200 |
commit | 25a1ba71e3cf4250489291f688423963aa603498 (patch) | |
tree | fb1e23060b810237316f4cde6524c0b1a66d5d0e /include/erebos/message.h | |
parent | 07f61b1ad6363cd471b7dab3f94c3160636fd6a0 (diff) |
Server and services configuration using separate objects
Diffstat (limited to 'include/erebos/message.h')
-rw-r--r-- | include/erebos/message.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/include/erebos/message.h b/include/erebos/message.h index 70a11bc..436c0ed 100644 --- a/include/erebos/message.h +++ b/include/erebos/message.h @@ -74,21 +74,30 @@ private: class DirectMessageService : public Service { public: - DirectMessageService(); + using ThreadWatcher = std::function<void(const DirectMessageThread &, ssize_t, ssize_t)>; + + class Config + { + public: + Config & onUpdate(ThreadWatcher); + + private: + friend class DirectMessageService; + vector<ThreadWatcher> watchers; + }; + + DirectMessageService(Config &&, const Server &); virtual ~DirectMessageService(); UUID uuid() const override; void handle(Context &) override; - typedef std::function<void(const DirectMessageThread &, ssize_t, ssize_t)> ThreadWatcher; - void onUpdate(ThreadWatcher); DirectMessageThread thread(const Identity &); DirectMessage send(const Identity &, const Peer &, const std::string &); private: - struct Priv; - unique_ptr<Priv> p; + const Config config; }; } |