本文整理汇总了C++中MessageSource::GetUser方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageSource::GetUser方法的具体用法?C++ MessageSource::GetUser怎么用?C++ MessageSource::GetUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageSource
的用法示例。
在下文中一共展示了MessageSource::GetUser方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
void Away::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
{
const Anope::string &msg = !params.empty() ? params[0] : "";
EventManager::Get()->Dispatch(&Event::UserAway::OnUserAway, source.GetUser(), msg);
if (!msg.empty())
Log(source.GetUser(), "away") << "is now away: " << msg;
else
Log(source.GetUser(), "away") << "is no longer away";
}
示例2: Run
/* :0MCAAAAAB CERTFP 4C62287BA6776A89CD4F8FF10A62FFB35E79319F51AF6C62C674984974FCCB1D */
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override
{
User *u = source.GetUser();
u->fingerprint = params[0];
Event::OnFingerprint(&Event::Fingerprint::OnFingerprint, u);
}
示例3: Run
/*
* <@po||ux> DukeP: RFC 2813, 4.2.1: the JOIN command on server-server links
* separates the modes ("o") with ASCII 7, not space. And you can't see ASCII 7.
*
* if a user joins a new channel, the ircd sends <channelname>\7<umode>
*/
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override
{
User *user = source.GetUser();
size_t pos = params[0].find('\7');
Anope::string channel, modes;
if (pos != Anope::string::npos)
{
channel = params[0].substr(0, pos);
modes = '+' + params[0].substr(pos+1, params[0].length()) + " " + user->nick;
}
else
{
channel = params[0];
}
std::vector<Anope::string> new_params;
new_params.push_back(channel);
Message::Join::Run(source, new_params);
if (!modes.empty())
{
Channel *c = Channel::Find(channel);
if (c)
c->SetModesInternal(source, modes);
}
}
示例4:
/* :0MCAAAAAB CERTFP 4C62287BA6776A89CD4F8FF10A62FFB35E79319F51AF6C62C674984974FCCB1D */
void hybrid::CertFP::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
{
User *u = source.GetUser();
u->fingerprint = params[0];
EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u);
}
示例5: OnChannelModeSet
EventReturn OnChannelModeSet(Channel *c, const MessageSource &source, ChannelMode *mode, const Anope::string ¶m) override
{
if (source.GetUser() && !source.GetBot() && Config->GetModule(this)->Get<bool>("smartjoin") && mode->name == "BAN" && c->ci && c->ci->GetBot() && c->FindUser(c->ci->GetBot()))
{
ServiceBot *bi = c->ci->GetBot();
Entry ban("BAN", param);
if (ban.Matches(bi))
c->RemoveMode(bi, "BAN", param);
}
return EVENT_CONTINUE;
}
示例6:
void Message::Stats::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
{
User *u = source.GetUser();
switch (params[0][0])
{
case 'l':
if (u->HasMode("OPER"))
{
IRCD->SendNumeric(211, source.GetSource(), "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime");
IRCD->SendNumeric(211, source.GetSource(), "%s %d %d %d %d %d %d %ld", Config->Uplinks[Anope::CurrentUplink].host.c_str(), UplinkSock->WriteBufferLen(), TotalWritten, -1, UplinkSock->ReadBufferLen(), TotalRead, -1, static_cast<long>(Anope::CurTime - Anope::StartTime));
}
IRCD->SendNumeric(219, source.GetSource(), "%c :End of /STATS report.", params[0][0]);
break;
case 'o':
case 'O':
/* Check whether the user is an operator */
if (!u->HasMode("OPER") && Config->GetBlock("options")->Get<bool>("hidestatso"))
IRCD->SendNumeric(219, source.GetSource(), "%c :End of /STATS report.", params[0][0]);
else
{
for (Oper *o : Serialize::GetObjects<Oper *>())
IRCD->SendNumeric(243, source.GetSource(), "O * * %s %s 0", o->GetName().c_str(), o->GetType()->GetName().replace_all_cs(" ", "_").c_str());
IRCD->SendNumeric(219, source.GetSource(), "%c :End of /STATS report.", params[0][0]);
}
break;
case 'u':
{
::Stats *s = Serialize::GetObject<::Stats *>();
long uptime = static_cast<long>(Anope::CurTime - Anope::StartTime);
IRCD->SendNumeric(242, source.GetSource(), ":Services up %d day%s, %02d:%02d:%02d", uptime / 86400, uptime / 86400 == 1 ? "" : "s", (uptime / 3600) % 24, (uptime / 60) % 60, uptime % 60);
IRCD->SendNumeric(250, source.GetSource(), ":Current users: %d (%d ops); maximum %d", UserListByNick.size(), OperCount, s ? s->GetMaxUserCount() : 0);
IRCD->SendNumeric(219, source.GetSource(), "%c :End of /STATS report.", params[0][0]);
break;
} /* case 'u' */
default:
IRCD->SendNumeric(219, source.GetSource(), "%c :End of /STATS report.", params[0][0]);
}
return;
}
示例7:
// Debug: Received: :00BAAAAAB ENCAP * LOGIN Adam
void ratbox::Encap::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
{
if (params[1] == "LOGIN" || params[1] == "SU")
{
User *u = source.GetUser();
NickServ::Account *nc = NickServ::FindAccount(params[2]);
if (!nc)
return;
u->Login(nc);
/* Sometimes a user connects, we send them the usual "this nickname is registered" mess (if
* their server isn't syncing) and then we receive this.. so tell them about it.
*/
if (u->server->IsSynced())
u->SendMessage(Config->GetClient("NickServ"), _("You have been logged in as \002%s\002."), nc->GetDisplay().c_str());
}
}
示例8: Run
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override
{
User *u = source.GetUser();
// In a burst, states that the source user is logged in as the account.
if (params[1] == "LOGIN" || params[1] == "SU")
{
NickServ::Account *nc = NickServ::FindAccount(params[2]);
if (!nc)
return;
u->Login(nc);
}
// Received: :42XAAAAAE ENCAP * CERTFP :3f122a9cc7811dbad3566bf2cec3009007c0868f
if (params[1] == "CERTFP")
{
u->fingerprint = params[2];
EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u);
}
/*
* Received: :42X ENCAP * SASL 42XAAAAAH * S PLAIN
* Received: :42X ENCAP * SASL 42XAAAAAC * D A
*
* Part of a SASL authentication exchange. The mode is 'C' to send some data
* (base64 encoded), or 'S' to end the exchange (data indicates type of
* termination: 'A' for abort, 'F' for authentication failure, 'S' for
* authentication success).
*
* Charybdis only accepts messages from SASL agents; these must have umode +S
*/
if (params[1] == "SASL" && SASL::sasl && params.size() >= 6)
{
SASL::Message m;
m.source = params[2];
m.target = params[3];
m.type = params[4];
m.data = params[5];
m.ext = params.size() > 6 ? params[6] : "";
SASL::sasl->ProcessMessage(m);
}
}