mirror of
https://github.com/anope/anope.git
synced 2026-06-26 00:46:37 +02:00
Send replies from fantasy commands back to the channel, this will be expanded on later
This commit is contained in:
+46
-5
@@ -8,6 +8,52 @@
|
||||
#include "services.h"
|
||||
#include "modules.h"
|
||||
|
||||
void CommandSource::Reply(LanguageString message, ...)
|
||||
{
|
||||
Anope::string m = GetString(this->u, message);
|
||||
|
||||
m = m.replace_all_cs("%S", this->owner->nick);
|
||||
|
||||
if (m.length() >= 4096)
|
||||
Log() << "Warning, language string " << message << " is longer than 4096 bytes";
|
||||
|
||||
va_list args;
|
||||
char buf[4096];
|
||||
va_start(args, message);
|
||||
vsnprintf(buf, sizeof(buf) - 1, m.c_str(), args);
|
||||
va_end(args);
|
||||
|
||||
sepstream sep(buf, '\n');
|
||||
Anope::string line;
|
||||
|
||||
while (sep.GetToken(line))
|
||||
this->Reply(line.empty() ? " " : line);
|
||||
}
|
||||
|
||||
void CommandSource::Reply(const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[BUFSIZE] = "";
|
||||
|
||||
if (message)
|
||||
{
|
||||
va_start(args, message);
|
||||
vsnprintf(buf, BUFSIZE - 1, message, args);
|
||||
|
||||
this->Reply(Anope::string(buf));
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandSource::Reply(const Anope::string &message)
|
||||
{
|
||||
if (this->fantasy && this->ci)
|
||||
ircdproto->SendPrivmsg(this->service, this->ci->name, message.c_str());
|
||||
else
|
||||
u->SendMessage(this->service->nick, message);
|
||||
}
|
||||
|
||||
Command::Command(const Anope::string &sname, size_t min_params, size_t max_params, const Anope::string &spermission) : MaxParams(max_params), MinParams(min_params), name(sname), permission(spermission)
|
||||
{
|
||||
this->module = NULL;
|
||||
@@ -20,11 +66,6 @@ Command::~Command()
|
||||
this->module->DelCommand(this->service, this);
|
||||
}
|
||||
|
||||
CommandReturn Command::Execute(User *u, const std::vector<Anope::string> &)
|
||||
{
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
void Command::OnServHelp(User *u) { }
|
||||
|
||||
bool Command::OnHelp(User *u, const Anope::string &subcommand) { return false; }
|
||||
|
||||
Reference in New Issue
Block a user