本文整理汇总了C++中CommandSource::Reply方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandSource::Reply方法的具体用法?C++ CommandSource::Reply怎么用?C++ CommandSource::Reply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandSource
的用法示例。
在下文中一共展示了CommandSource::Reply方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &chan = params[0];
const Anope::string &nick = params[1];
const Anope::string &s = params[2];
Channel *c;
User *u2;
if (!(c = Channel::Find(chan)))
{
source.Reply(_("Channel \002%s\002 doesn't exist."), chan);
return;
}
if (c->bouncy_modes)
{
source.Reply(_("Services is unable to change modes. Are your servers' U:lines configured correctly?"));
return;
}
if (!(u2 = User::Find(nick, true)))
{
source.Reply(_("\002{0}\002 isn't currently online."), nick);
return;
}
if (!c->Kick(source.service, u2, "%s (%s)", source.GetNick().c_str(), s.c_str()))
{
source.Reply(_("Access denied."));
return;
}
Log(LOG_ADMIN, source, this) << "on " << u2->nick << " in " << c->name << " (" << s << ")";
}
示例2: DoRead
static void DoRead(CommandSource &source, MemoServ::MemoInfo *mi, ChanServ::Channel *ci, unsigned index)
{
MemoServ::Memo *m = mi->GetMemo(index);
if (!m)
return;
if (ci)
source.Reply(_("Memo \002{0}\002 from \002{1}\002 (\002{2}\002)."), index + 1, m->GetSender(), Anope::strftime(m->GetTime(), source.GetAccount()));
else
source.Reply(_("Memo \002{0}\002 from \002{1}\002 (\002{2}\002)."), index + 1, m->GetSender(), Anope::strftime(m->GetTime(), source.GetAccount()));
ServiceBot *bi;
Anope::string cmd;
if (Command::FindCommandFromService("memoserv/del", bi, cmd))
{
if (ci)
source.Reply(_("To delete, use \002{0}{1} {2} {3} {4}\002"), Config->StrictPrivmsg, bi->nick, cmd, ci->GetName(), index + 1);
else
source.Reply(_("To delete, use \002{0}{1} {2} {3}\002"), Config->StrictPrivmsg, bi->nick, cmd, index + 1);
}
source.Reply(m->GetText());
m->SetUnread(false);
/* Check if a receipt notification was requested */
if (m->GetReceipt())
rsend_notify(source, mi, m, ci ? ci->GetName() : source.GetNick());
}
示例3: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
if (Anope::ReadOnly)
{
source.Reply(_("Services are in read-only mode."));
return;
}
const Anope::string &nick = params[0];
NickServ::Nick *na = NickServ::FindNick(nick);
if (!na)
{
source.Reply(_("\002{0}\002 isn't registered."), nick);
return;
}
HostRequest *req = na->GetExt<HostRequest>("hostrequest");
if (!req)
{
source.Reply(_("\002{0}\002 does not have a pending vhost request."), na->GetNick());
return;
}
na->SetVhost(req->GetIdent(), req->GetHost(), source.GetNick(), req->GetTime());
EventManager::Get()->Dispatch(&Event::SetVhost::OnSetVhost, na);
if (Config->GetModule(this->GetOwner())->Get<bool>("memouser") && memoserv)
memoserv->Send(source.service->nick, na->GetNick(), _("[auto memo] Your requested vHost has been approved."), true);
source.Reply(_("Vhost for \002{0}\002 has been activated."), na->GetNick());
Log(LOG_COMMAND, source, this) << "for " << na->GetNick() << " for vhost " << (!req->GetIdent().empty() ? req->GetIdent() + "@" : "") << req->GetHost();
req->Delete();
}
示例4: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms)
{
User *u = source.u;
NickAlias *na = findnick(u->nick);
if (na && u->Account() == na->nc && na->hostinfo.HasVhost())
{
if (!na->hostinfo.GetIdent().empty())
source.Reply(_("Your vhost of \002%s\[email protected]\002%s\002 is now activated."), na->hostinfo.GetIdent().c_str(), na->hostinfo.GetHost().c_str());
else
source.Reply(_("Your vhost of \002%s\002 is now activated."), na->hostinfo.GetHost().c_str());
Log(LOG_COMMAND, u, this) << "to enable their vhost of " << (!na->hostinfo.GetIdent().empty() ? na->hostinfo.GetIdent() + "@" : "") << na->hostinfo.GetHost();
ircdproto->SendVhost(u, na->hostinfo.GetIdent(), na->hostinfo.GetHost());
if (ircd->vhost)
u->vhost = na->hostinfo.GetHost();
if (ircd->vident)
{
if (!na->hostinfo.GetIdent().empty())
u->SetVIdent(na->hostinfo.GetIdent());
}
u->UpdateHost();
}
else
source.Reply(HOST_NOT_ASSIGNED);
return;
}
示例5: DoSetReadOnly
void DoSetReadOnly(CommandSource &source, const std::vector<Anope::string> ¶ms)
{
const Anope::string &setting = params.size() > 1 ? params[1] : "";
if (setting.empty())
{
this->OnSyntaxError(source, "READONLY");
return;
}
if (setting.equals_ci("ON"))
{
Anope::ReadOnly = true;
Log(LOG_ADMIN, source, this) << "READONLY ON";
source.Reply(_("Services are now in \002read-only\002 mode."));
}
else if (setting.equals_ci("OFF"))
{
Anope::ReadOnly = false;
Log(LOG_ADMIN, source, this) << "READONLY OFF";
source.Reply(_("Services are now in \002read-write\002 mode."));
}
else
source.Reply(_("Setting for READONLY must be \002ON\002 or \002OFF\002."));
return;
}
示例6: DoList
void DoList(CommandSource &source, ChannelInfo *ci)
{
EntryMessageList *messages = ci->GetExt<EntryMessageList *>("cs_entrymsg");
if (messages == NULL)
{
source.Reply(_("Entry message list for \002%s\002 is empty."), ci->name.c_str());
return;
}
source.Reply(_("Entry message list for \002%s\002:"), ci->name.c_str());
ListFormatter list;
list.addColumn("Number").addColumn("Creator").addColumn("Created").addColumn("Message");
for (unsigned i = 0; i < messages->size(); ++i)
{
EntryMsg &msg = messages->at(i);
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
entry["Creator"] = msg.creator;
entry["Created"] = do_strftime(msg.when);
entry["Message"] = msg.message;
list.addEntry(entry);
}
std::vector<Anope::string> replies;
list.Process(replies);
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
source.Reply(_("End of entry message list."));
}
示例7: Run
void Run(CommandSource &source, const Flux::vector ¶ms)
{
Flux::string chan = params[1];
User *u = source.u;
if(!u->IsOwner())
{
source.Reply(ACCESS_DENIED);
Log(u) << "attempted to make bot part " << chan;
return;
}
if(!IsValidChannel(chan))
source.Reply(CHANNEL_X_INVALID, chan.c_str());
else
{
Channel *c = findchannel(chan);
if(c)
c->SendPart();
else
source.Reply("I am not in channel \2%s\2", chan.c_str());
Log(u) << "made the bot part " << chan;
}
}
示例8: OnHelp
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
source.Reply(_("Configures bot kickers."
" Use of this command requires the \002SET\002 privilege on \037channel\037.\n"
"\n"
"Available kickers:"));
Anope::string this_name = source.command;
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
{
const Anope::string &c_name = it->first;
const CommandInfo &info = it->second;
if (c_name.find_ci(this_name + " ") == 0)
{
ServiceReference<Command> command("Command", info.name);
if (command)
{
source.command = c_name;
command->OnServHelp(source);
}
}
}
CommandInfo *help = source.service->FindCommand("generic/help");
if (help)
source.Reply(_("See \002{0}{1} {2} {3} \037option\037\002 for more information on a specific option."),
Config->StrictPrivmsg, source.service->nick, help->cname, this_name);
return true;
}
示例9: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms)
{
User *u = source.u;
const Anope::string &nick = !params.empty() ? params[0] : u->nick;
NickAlias *na = findnick(nick);
spacesepstream sep(nick);
Anope::string nickbuf;
while (sep.GetToken(nickbuf))
{
User *u2 = finduser(nickbuf);
if (!u2) /* Nick is not online */
source.Reply(_("STATUS %s %d %s"), nickbuf.c_str(), 0, "");
else if (u2->IsIdentified() && na && na->nc == u2->Account()) /* Nick is identified */
source.Reply(_("STATUS %s %d %s"), nickbuf.c_str(), 3, u2->Account()->display.c_str());
else if (u2->IsRecognized()) /* Nick is recognised, but NOT identified */
source.Reply(_("STATUS %s %d %s"), nickbuf.c_str(), 2, u2->Account() ? u2->Account()->display.c_str() : "");
else if (!na) /* Nick is online, but NOT a registered */
source.Reply(_("STATUS %s %d %s"), nickbuf.c_str(), 0, "");
else
/* Nick is not identified for the nick, but they could be logged into an account,
* so we tell the user about it
*/
source.Reply(_("STATUS %s %d %s"), nickbuf.c_str(), 1, u2->Account() ? u2->Account()->display.c_str() : "");
}
return;
}
示例10: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms)
{
const Anope::string &password = params[0];
Oper *o = source.u->Account()->o;
if (o == NULL)
source.Reply(_("No oper block for your nick."));
else if (o->password.empty())
source.Reply(_("Your oper block doesn't require logging in."));
else if (source.u->HasExt("os_login_password_correct"))
source.Reply(_("You are already identified."));
else if (o->password != password)
{
source.Reply(PASSWORD_INCORRECT);
bad_password(source.u);
}
else
{
Log(LOG_ADMIN, source.u, this) << "and successfully identified to " << source.owner->nick;
source.u->Extend("os_login_password_correct", NULL);
source.Reply(_("Password accepted."));
}
return;
}
示例11: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &chan = params[0];
const Anope::string &value = params[1];
if (Anope::ReadOnly)
{
source.Reply(_("Services are in read-only mode."));
return;
}
ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci == NULL)
{
source.Reply(_("Channel \002{0}\002 isn't registered."), chan);
return;
}
if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
}
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets";
ci->SetS<bool>("BS_GREET", true);
source.Reply(_("Greet mode for \002{0}\002 is now \002on\002."), ci->GetName());
}
示例12: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
User *u = source.GetUser();
Oper *o = source.nc->o;
if (o == NULL)
{
source.Reply(_("No oper block for your nick."));
return;
}
if (o->GetPassword().empty())
{
source.Reply(_("Your oper block doesn't require logging in."));
return;
}
if (!u->HasExtOK("os_login"))
{
source.Reply(_("You are not identified."));
return;
}
Log(LOG_ADMIN, source, this);
u->ShrinkOK<bool>("os_login");
source.Reply(_("You have been logged out."));
}
示例13: OnHelp
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Causes Services to save all databases and then shut down."));
return true;
}
示例14: DoDel
void DoDel(CommandSource &source, ChannelInfo *ci, const Anope::string &message)
{
EntryMessageList *messages = ci->GetExt<EntryMessageList *>("cs_entrymsg");
if (!message.is_pos_number_only())
source.Reply(("Entry message \002%s\002 not found on channel \002%s\002."), message.c_str(), ci->name.c_str());
else if (messages != NULL)
{
try
{
unsigned i = convertTo<unsigned>(message);
if (i > 0 && i <= messages->size())
{
messages->erase(messages->begin() + i - 1);
if (messages->empty())
ci->Shrink("cs_entrymsg");
source.Reply(_("Entry message \002%i\002 for \002%s\002 deleted."), i, ci->name.c_str());
}
else
throw ConvertException();
}
catch (const ConvertException &)
{
source.Reply(_("Entry message \002%s\002 not found on channel \002%s\002."), message.c_str(), ci->name.c_str());
}
}
else
source.Reply(_("Entry message list for \002%s\002 is empty."), ci->name.c_str());
}
示例15: DoDel
void DoDel(CommandSource &source, const std::vector<Anope::string> ¶ms)
{
const Anope::string &mask = params.size() > 1 ? params[1] : "";
if (mask.empty())
{
this->OnSyntaxError(source, "DEL");
return;
}
if (isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos)
{
ExceptionDelCallback list(source, mask);
list.Process();
}
else
{
unsigned i = 0, end = session_service->GetExceptions().size();
for (; i < end; ++i)
if (mask.equals_ci(session_service->GetExceptions()[i]->mask))
{
ExceptionDelCallback::DoDel(source, i);
source.Reply(_("\002%s\002 deleted from session-limit exception list."), mask.c_str());
break;
}
if (i == end)
source.Reply(_("\002%s\002 not found on session-limit exception list."), mask.c_str());
}
if (readonly)
source.Reply(READ_ONLY_MODE);
return;
}