本文整理汇总了C++中MessageSource类的典型用法代码示例。如果您正苦于以下问题:C++ MessageSource类的具体用法?C++ MessageSource怎么用?C++ MessageSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MessageSource类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例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
/*
* :42X EUID DukePyrolator 1 1353240577 +Zi ~jens erft-5d80b00b.pool.mediaWays.net 93.128.176.11 42XAAAAAD * * :jens
* :<SID> EUID <NICK> <HOPS> <TS> +<UMODE> <USERNAME> <VHOST> <IP> <UID> <REALHOST> <ACCOUNT> :<GECOS>
* 0 1 2 3 4 5 6 7 8 9 10
*
* Introduces a user. The hostname field is now always the visible host.
* The realhost field is * if the real host is equal to the visible host.
* The account field is * if the login is not set.
* Note that even if both new fields are *, an EUID command still carries more
* information than a UID command (namely that real host is visible host and the
* user is not logged in with services). Hence a NICK or UID command received
* from a remote server should not be sent in EUID form to other servers.
*/
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override
{
NickServ::Nick *na = NULL;
if (params[9] != "*")
na = NickServ::FindNick(params[9]);
User::OnIntroduce(params[0], params[4], params[8], params[5], params[6], source.GetServer(), params[10], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime, params[3], params[7], na ? na->GetAccount() : NULL);
}
示例4: Run
void Quit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
{
const Anope::string &reason = params[0];
User *user = source.GetUser();
Log(user, "quit") << "quit (Reason: " << (!reason.empty() ? reason : "no reason") << ")";
user->Quit(reason);
}
示例5: assert
void MessageEditorListCtrl::_Commit()
{
MessageSource *source = const_cast<MessageSource*>(_GetSource());
if (source)
{
assert((_sourceType == MessageSourceType::Verbs || _sourceType == MessageSourceType::Talkers) && "Other types should go through components.");
source->Commit();
if (_pDoc)
{
// Send out notification. Be lazy and just say "all message files".
auto hint = WrapHint(MessageChangeHint::AllMessageFiles);
_pDoc->UpdateAllViewsAndNonViews(nullptr, 0, &hint);
}
// Notify the class browser. I'd rather have this functionality here than in the MessageSource.
// An even better way would be to have a thread that is monitoring certain files.
SCIClassBrowser &browser = *appState->GetResourceMap().GetClassBrowser();
browser.TriggerReloadScript(source->GetBackingFile().c_str());
}
}
示例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: KillInternal
void User::KillInternal(const MessageSource &source, const Anope::string &reason)
{
if (this->quit)
{
Log(LOG_DEBUG) << "Duplicate quit for " << this->nick;
return;
}
Log(this, "killed") << "was killed by " << source.GetName() << " (Reason: " << reason << ")";
this->Quit(reason);
}
示例8: Run
/*
* NICK - NEW
* Received: :dev.anope.de NICK DukeP_ 1 ~DukePyro ip-2-201-236-154.web.vodafone.de 1 + :DukePyrolator
* Parameters: <nickname> <hopcount> <username> <host> <servertoken> <umode> :<realname>
* source = server
* params[0] = nick
* params[1] = hopcount
* params[2] = username/ident
* params[3] = host
* params[4] = servertoken
* params[5] = modes
* params[6] = info
*
* NICK - change
* Received: :DukeP_ NICK :test2
* source = oldnick
* params[0] = newnick
*
*/
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override
{
if (params.size() == 1)
{
// we have a nickchange
source.GetUser()->ChangeNick(params[0]);
}
else if (params.size() == 7)
{
// a new user is connecting to the network
Server *s = Server::Find(params[4]);
if (s == NULL)
{
Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[4] << "?";
return;
}
User::OnIntroduce(params[0], params[2], params[3], "", "", s, params[6], Anope::CurTime, params[5], "", NULL);
Log(LOG_DEBUG) << "Registered nick \"" << params[0] << "\" on server " << s->GetName() << ".";
}
else
{
Log(LOG_DEBUG) << "Received NICK with invalid number of parameters. source = " << source.GetName() << "params[0] = " << params[0] << "params.size() = " << params.size();
}
}
示例9:
/* :0MC UID Steve 1 1350157102 +oi ~steve resolved.host 10.0.0.1 0MCAAAAAB Steve :Mining all the time */
void hybrid::UID::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
{
Anope::string ip = params[6];
if (ip == "0") /* Can be 0 for spoofed clients */
ip.clear();
NickServ::Nick *na = NULL;
if (params[8] != "0" && params[8] != "*")
na = NickServ::FindNick(params[8]);
/* Source is always the server */
User::OnIntroduce(params[0], params[4], params[5], "",
ip, source.GetServer(),
params[9], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : 0,
params[3], params[7], na ? na->GetAccount() : NULL);
}
示例10: SendTopic
void SendTopic(const MessageSource &source, Channel *c) override
{
ServiceBot *bi = source.GetBot();
bool needjoin = c->FindUser(bi) == NULL;
if (needjoin)
{
ChannelStatus status;
status.AddMode('o');
bi->Join(c, &status);
}
IRCDProto::SendTopic(source, c);
if (needjoin)
bi->Part(c);
}
示例11:
// 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());
}
}
示例12: SJoin
void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users)
{
bool created;
Channel *c = Channel::FindOrCreate(chan, created, ts ? ts : Anope::CurTime);
bool keep_their_modes = true;
if (created)
c->syncing = true;
/* Some IRCds do not include a TS */
else if (!ts)
;
/* Our creation time is newer than what the server gave us, so reset the channel to the older time */
else if (c->creation_time > ts)
{
c->creation_time = ts;
c->Reset();
}
/* Their TS is newer, don't accept any modes from them */
else if (ts > c->creation_time)
keep_their_modes = false;
/* Update the modes for the channel */
if (keep_their_modes && !modes.empty())
/* If we are syncing, mlock is checked later in Channel::Sync. It is important to not check it here
* so that Channel::SetCorrectModes can correctly detect the presence of channel mode +r.
*/
c->SetModesInternal(source, modes, ts, !c->syncing);
for (std::list<SJoinUser>::const_iterator it = users.begin(), it_end = users.end(); it != it_end; ++it)
{
const ChannelStatus &status = it->first;
User *u = it->second;
keep_their_modes = ts <= c->creation_time; // OnJoinChannel can call modules which can modify this channel's ts
if (c->FindUser(u))
continue;
/* Add the user to the channel */
c->JoinUser(u, keep_their_modes ? &status : NULL);
/* Check if the user is allowed to join */
if (c->CheckKick(u))
continue;
/* Set whatever modes the user should have, and remove any that
* they aren't allowed to have (secureops etc).
*/
c->SetCorrectModes(u, true);
EventManager::Get()->Dispatch(&Event::JoinChannel::OnJoinChannel, u, c);
}
/* Channel is done syncing */
if (c->syncing)
{
/* Sync the channel (mode lock, topic, etc) */
/* the channel is synced when the netmerge is complete */
Server *src = source.GetServer() ? source.GetServer() : Me;
if (src && src->IsSynced())
{
c->Sync();
if (c->CheckDelete())
delete c;
}
}
}
示例13: Kill
void User::Kill(const MessageSource &source, const Anope::string &reason)
{
Anope::string real_reason = source.GetName() + " (" + reason + ")";
IRCD->SendSVSKill(source, this, "%s", real_reason.c_str());
}