fix oper tag

This commit is contained in:
Eric Mertens 2025-01-26 19:43:17 -08:00
parent a49389d508
commit cc06429a69
2 changed files with 8 additions and 10 deletions

10
bot.cpp
View File

@ -6,9 +6,7 @@ auto Bot::start(std::shared_ptr<Client> self) -> std::shared_ptr<Bot>
{ {
const auto thread = std::make_shared<Bot>(std::move(self)); const auto thread = std::make_shared<Bot>(std::move(self));
auto &connection = *thread->self_->get_connection(); thread->self_->get_connection()->sig_ircmsg.connect([thread](const auto cmd, auto &msg) {
connection.sig_ircmsg.connect([thread](auto cmd, auto &msg) {
thread->on_ircmsg(cmd, msg); thread->on_ircmsg(cmd, msg);
}); });
@ -25,7 +23,7 @@ auto Bot::process_command(std::string_view message, const IrcMsg &msg) -> void
message = message.substr(1); // discard the prefix message = message.substr(1); // discard the prefix
auto cmdend = message.find(' '); auto cmdend = message.find(' ');
std::string_view command = std::string_view command =
cmdend == message.npos ? message : message.substr(0, cmdend); cmdend == message.npos ? message : message.substr(0, cmdend);
@ -40,7 +38,7 @@ auto Bot::process_command(std::string_view message, const IrcMsg &msg) -> void
{ {
account = value; account = value;
} }
else if (key == "operator") else if (key == "solanum.chat/oper")
{ {
oper = value; oper = value;
} }
@ -56,7 +54,7 @@ auto Bot::process_command(std::string_view message, const IrcMsg &msg) -> void
}); });
} }
auto Bot::on_ircmsg(IrcCommand cmd, const IrcMsg &msg) -> void auto Bot::on_ircmsg(const IrcCommand cmd, const IrcMsg &msg) -> void
{ {
if (cmd == IrcCommand::PRIVMSG) if (cmd == IrcCommand::PRIVMSG)
{ {

View File

@ -30,14 +30,14 @@ class Registration : public std::enable_shared_from_this<Registration>
public: public:
Registration( Registration(
Connection &connection_, Connection &,
const Settings &, const Settings &,
std::shared_ptr<Client> self std::shared_ptr<Client>
); );
static auto start( static auto start(
Connection &connection, Connection &,
const Settings &, const Settings &,
std::shared_ptr<Client> self std::shared_ptr<Client>
) -> std::shared_ptr<Registration>; ) -> std::shared_ptr<Registration>;
}; };