31 lines
725 B
C++
31 lines
725 B
C++
|
// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
|
||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||
|
|
||
|
#include "router.h"
|
||
|
|
||
|
Router::Router():
|
||
|
actors(),
|
||
|
defaultGroup("Stranger")
|
||
|
{}
|
||
|
|
||
|
void Router::registerModule(const std::string& key, const std::shared_ptr<Module::Module>& module) {
|
||
|
modules[key] = module;
|
||
|
}
|
||
|
|
||
|
|
||
|
void Router::registerActor(const std::string& key, const std::string& group) {
|
||
|
if (key == "default") {
|
||
|
defaultGroup = group;
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
Actors::iterator act = actors.find(key);
|
||
|
if (act == actors.end())
|
||
|
actors.emplace(key, group);
|
||
|
else
|
||
|
act->second.setGroup(group);
|
||
|
}
|
||
|
|
||
|
void Router::routeMessage(const std::string& sender, const std::string& body) {
|
||
|
}
|