summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/modules/rpc.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/include/modules/rpc.h b/include/modules/rpc.h
index 7171b73a8..76ecf3542 100644
--- a/include/modules/rpc.h
+++ b/include/modules/rpc.h
@@ -13,16 +13,32 @@
class RPCRequest final
{
private:
+ std::optional<std::pair<int64_t, Anope::string>> error;
std::map<Anope::string, Anope::string> replies;
public:
Anope::string name;
Anope::string id;
std::deque<Anope::string> data;
- HTTPReply &r;
+ HTTPReply &reply;
+
+ RPCRequest(HTTPReply &r)
+ : reply(r)
+ {
+ }
+
+ inline void Error(uint64_t errcode, const Anope::string &errstr)
+ {
+ this->error.emplace(errcode, errstr);
+ }
+
+ inline void Reply(const Anope::string &dname, const Anope::string &ddata)
+ {
+ this->replies.emplace(dname, ddata);
+ }
+
+ inline const auto &GetError() { return this->error; }
- RPCRequest(HTTPReply &_r) : r(_r) { }
- inline void Reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.emplace(dname, ddata); }
inline const auto &GetReplies() { return this->replies; }
};