mirror of
https://github.com/anope/anope.git
synced 2026-06-28 16:36:39 +02:00
Store the source message identifier in CommandSource.
This commit is contained in:
+4
-2
@@ -61,15 +61,17 @@ public:
|
||||
/* Where the reply should go */
|
||||
CommandReply *reply;
|
||||
/* Channel the command was executed on (fantasy) */
|
||||
Reference<Channel> c;
|
||||
Reference<Channel> c = nullptr;
|
||||
/* The service this command is on */
|
||||
Reference<BotInfo> service;
|
||||
/* The actual name of the command being executed */
|
||||
Anope::string command;
|
||||
/* The permission of the command being executed */
|
||||
Anope::string permission;
|
||||
/* The unique identifier of the executing message. */
|
||||
Anope::string msgid;
|
||||
|
||||
CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply, BotInfo *bi);
|
||||
CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply, BotInfo *bi, const Anope::string &m = "");
|
||||
|
||||
const Anope::string &GetNick() const;
|
||||
User *GetUser();
|
||||
|
||||
+6
-1
@@ -175,7 +175,12 @@ public:
|
||||
if (params.size() < cmd->min_params)
|
||||
return;
|
||||
|
||||
CommandSource source(u->nick, u, u->Account(), u, c->ci->bi);
|
||||
Anope::string msgid;
|
||||
auto iter = tags.find("msgid");
|
||||
if (iter != tags.end())
|
||||
msgid = iter->second;
|
||||
|
||||
CommandSource source(u->nick, u, u->Account(), u, c->ci->bi, msgid);
|
||||
source.c = c;
|
||||
source.command = it->first;
|
||||
source.permission = info.permission;
|
||||
|
||||
+6
-1
@@ -228,7 +228,12 @@ void BotInfo::OnMessage(User *u, const Anope::string &message, const Anope::map<
|
||||
if (this->commands.empty())
|
||||
return;
|
||||
|
||||
CommandSource source(u->nick, u, u->Account(), u, this);
|
||||
Anope::string msgid;
|
||||
auto iter = tags.find("msgid");
|
||||
if (iter != tags.end())
|
||||
msgid = iter->second;
|
||||
|
||||
CommandSource source(u->nick, u, u->Account(), u, this, msgid);
|
||||
Command::Run(source, message);
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -17,8 +17,13 @@
|
||||
#include "regchannel.h"
|
||||
#include "channels.h"
|
||||
|
||||
CommandSource::CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *r, BotInfo *bi) : nick(n), u(user), nc(core), reply(r),
|
||||
c(NULL), service(bi)
|
||||
CommandSource::CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *r, BotInfo *bi, const Anope::string &m)
|
||||
: nick(n)
|
||||
, u(user)
|
||||
, nc(core)
|
||||
, reply(r)
|
||||
, service(bi)
|
||||
, msgid(m)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user