Register independent module names, first readme
This commit is contained in:
parent
1bda854139
commit
0be7fe9bff
4 changed files with 46 additions and 4 deletions
|
@ -38,8 +38,16 @@ void Core::initialize(const std::shared_ptr<Connection>& cn) {
|
|||
void Core::setGroup(const std::string& jid, const std::string& group) {
|
||||
router.registerActor(jid, group);
|
||||
|
||||
std::map<std::string, std::string> actors = router.getActors();
|
||||
actors["default"] = router.getDefaultGroup();
|
||||
Shared::VC actors = router.getActors();
|
||||
std::string defaultGroup = router.getDefaultGroup();
|
||||
|
||||
for (Shared::VC::const_iterator itr = actors.begin(); itr != actors.end(); )
|
||||
if (itr->second == defaultGroup)
|
||||
itr = actors.erase(itr);
|
||||
else
|
||||
itr++;
|
||||
|
||||
actors["default"] = defaultGroup;
|
||||
config.setActors(actors);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,9 +42,11 @@ void Router::routeMessage(const std::string& sender, const std::string& body) {
|
|||
aItr = actors.emplace(sender, std::make_shared<Actor>(sender, defaultGroup)).first;
|
||||
|
||||
std::vector<std::string> args = Module::Module::split(body);
|
||||
Modules::iterator mItr = modules.find(args[0]);
|
||||
std::string moduleAlias = Module::Module::lower(args[0]);
|
||||
|
||||
Modules::iterator mItr = modules.find(moduleAlias);
|
||||
if (mItr == modules.end()) {
|
||||
debug("could not find module \"" + args[0] + "\" to handle message from " + sender);
|
||||
debug("could not find module \"" + moduleAlias + "\" to handle message from " + sender);
|
||||
return onMessageResult(Shared::unhandled, sender);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue