diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/process.cpp | 14 | ||||
-rw-r--r-- | src/protocol.cpp | 5 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/process.cpp b/src/process.cpp index eea5bcfe6..f045bc970 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -77,7 +77,19 @@ void Anope::Process(const Anope::string &buffer) else if (m->HasFlag(IRCDMessage::FLAG_REQUIRE_SERVER) && !source.empty() && !src.GetServer()) Log(LOG_DEBUG) << "unexpected non-server source " << source << " for " << command; else - m->Run(src, params, tags); + { + try + { + m->Run(src, params, tags); + } + catch (const ProtocolException &err) + { + IRCD->SendError(err.GetReason()); + Anope::QuitReason = "Protocol error: " + err.GetReason(); + Anope::Quitting = true; + Anope::ReturnValue = EXIT_FAILURE; + } + } } bool IRCDProto::Parse(const Anope::string &buffer, Anope::map<Anope::string> &tags, Anope::string &source, Anope::string &command, std::vector<Anope::string> ¶ms) diff --git a/src/protocol.cpp b/src/protocol.cpp index 4893173af..5699a2d48 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -86,6 +86,11 @@ Anope::string IRCDProto::SID_Retrieve() return current_sid; } +void IRCDProto::SendError(const Anope::string &reason) +{ + Uplink::Send("ERROR", reason); +} + void IRCDProto::SendKill(const MessageSource &source, const Anope::string &target, const Anope::string &reason) { Uplink::Send(source, "KILL", target, reason); |