summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-03-12 21:57:06 +0000
committerSadie Powell <sadie@witchery.services>2024-03-12 21:57:06 +0000
commit11edba04feea242a320b06cb45fb892fb500bd1e (patch)
tree45fc9371d11bacc03d4af0abe3304daa988b14b4 /src
parent22ba54b00dbeef1a7ab14c5d22a7360b47c29a40 (diff)
Add command handlers for encap commands on InspIRCd.
Diffstat (limited to 'src')
-rw-r--r--src/process.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/process.cpp b/src/process.cpp
index f045bc970..bb31358c8 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -54,28 +54,31 @@ void Anope::Process(const Anope::string &buffer)
}
}
- static const Anope::string proto_name = ModuleManager::FindFirstOf(PROTOCOL) ? ModuleManager::FindFirstOf(PROTOCOL)->name : "";
-
MessageSource src(source);
-
EventReturn MOD_RESULT;
FOREACH_RESULT(OnMessage, MOD_RESULT, (src, command, params, tags));
if (MOD_RESULT == EVENT_STOP)
return;
+ ProcessInternal(src, command, params, tags);
+}
+
+void Anope::ProcessInternal(MessageSource &src, const Anope::string &command, const std::vector<Anope::string> &params, const Anope::map<Anope::string> & tags)
+{
+ static const Anope::string proto_name = ModuleManager::FindFirstOf(PROTOCOL) ? ModuleManager::FindFirstOf(PROTOCOL)->name : "";
ServiceReference<IRCDMessage> m("IRCDMessage", proto_name + "/" + command.lower());
if (!m)
{
- Log(LOG_DEBUG) << "unknown message from server (" << buffer << ")";
+ Log(LOG_DEBUG) << "unknown message from server: " << command;
return;
}
if (m->HasFlag(IRCDMessage::FLAG_SOFT_LIMIT) ? (params.size() < m->GetParamCount()) : (params.size() != m->GetParamCount()))
Log(LOG_DEBUG) << "invalid parameters for " << command << ": " << params.size() << " != " << m->GetParamCount();
else if (m->HasFlag(IRCDMessage::FLAG_REQUIRE_USER) && !src.GetUser())
- Log(LOG_DEBUG) << "unexpected non-user source " << source << " for " << command;
- else if (m->HasFlag(IRCDMessage::FLAG_REQUIRE_SERVER) && !source.empty() && !src.GetServer())
- Log(LOG_DEBUG) << "unexpected non-server source " << source << " for " << command;
+ Log(LOG_DEBUG) << "unexpected non-user source " << src.GetSource() << " for " << command;
+ else if (m->HasFlag(IRCDMessage::FLAG_REQUIRE_SERVER) && !src.GetSource().empty() && !src.GetServer())
+ Log(LOG_DEBUG) << "unexpected non-server source " << src.GetSource() << " for " << command;
else
{
try