本文整理汇总了C++中nickserv::Nick类的典型用法代码示例。如果您正苦于以下问题:C++ Nick类的具体用法?C++ Nick怎么用?C++ Nick使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Nick类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCheckAuthentication
void OnCheckAuthentication(User *, NickServ::IdentifyRequest *req) override
{
NickServ::Nick *na = NickServ::FindNick(req->GetAccount());
if (na == NULL)
return;
NickServ::Account *nc = na->GetAccount();
size_t pos = nc->GetPassword().find(':');
if (pos == Anope::string::npos)
return;
Anope::string hash_method(nc->GetPassword().begin(), nc->GetPassword().begin() + pos);
if (!hash_method.equals_cs("oldmd5"))
return;
Anope::string buf;
this->OnEncrypt(req->GetPassword(), buf);
if (nc->GetPassword().equals_cs(buf))
{
/* if we are NOT the first module in the list,
* we want to re-encrypt the pass with the new encryption
*/
if (ModuleManager::FindFirstOf(ENCRYPTION) != this)
{
Anope::string p;
Anope::Encrypt(req->GetPassword(), p);
nc->SetPassword(p);
}
req->Success(this);
}
}
示例2: rsend_notify
static void rsend_notify(CommandSource &source, MemoServ::MemoInfo *mi, MemoServ::Memo *m, const Anope::string &targ)
{
/* Only send receipt if memos are allowed */
if (MemoServ::service && !Anope::ReadOnly)
{
/* Get nick alias for sender */
NickServ::Nick *na = NickServ::FindNick(m->GetSender());
if (!na)
return;
/* Get nick core for sender */
NickServ::Account *nc = na->GetAccount();
if (!nc)
return;
/* Text of the memo varies if the recipient was a
nick or channel */
Anope::string text = Anope::printf(Language::Translate(na->GetAccount(), _("\002[auto-memo]\002 The memo you sent to \002%s\002 has been viewed.")), targ.c_str());
/* Send notification */
MemoServ::service->Send(source.GetNick(), m->GetSender(), text, true);
/* Notify recipient of the memo that a notification has
been sent to the sender */
source.Reply(_("A notification memo has been sent to \002{0}\002 informing him/her you have read his/her memo."), nc->GetDisplay());
}
/* Remove receipt flag from the original memo */
m->SetReceipt(false);
}
示例3: IsIdentified
bool User::IsIdentified(bool check_nick) const
{
if (check_nick && this->nc)
{
NickServ::Nick *na = NickServ::FindNick(nick);
return na && na->GetAccount() == *this->nc;
}
return this->nc ? true : false;
}
示例4: IsRecognized
bool User::IsRecognized(bool check_secure) const
{
if (check_secure && on_access)
{
NickServ::Nick *na = NickServ::FindNick(nick);
if (!na || na->GetAccount()->HasFieldS("NS_SECURE"))
return false;
}
return on_access;
}
示例5: ChangeNick
void User::ChangeNick(const Anope::string &newnick, time_t ts)
{
/* Sanity check to make sure we don't segfault */
if (newnick.empty())
throw CoreException("User::ChangeNick() got a bad argument");
this->super_admin = false;
Log(this, "nick") << "(" << this->realname << ") changed nick to " << newnick;
Anope::string old = this->nick;
this->timestamp = ts;
if (this->nick.equals_ci(newnick))
this->nick = newnick;
else
{
NickServ::Nick *old_na = NickServ::FindNick(this->nick);
if (old_na && (this->IsIdentified(true) || this->IsRecognized()))
old_na->SetLastSeen(Anope::CurTime);
UserListByNick.erase(this->nick);
this->nick = newnick;
User* &other = UserListByNick[this->nick];
if (other)
{
CollideKill(this, "Nick collision");
CollideKill(other, "Nick collision");
return;
}
other = this;
on_access = false;
if (NickServ::service)
{
NickServ::Nick *na = NickServ::service->FindNick(this->nick);
if (na)
{
on_access = na->GetAccount()->IsOnAccess(this);
if (na->GetAccount() == this->Account())
{
na->SetLastSeen(Anope::CurTime);
this->UpdateHost();
}
}
}
}
EventManager::Get()->Dispatch(&Event::UserNickChange::OnUserNickChange, this, old);
}
示例6: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &nick = !params.empty() ? params[0] : "";
NickServ::Account *nc;
if (!nick.empty() && source.IsServicesOper())
{
NickServ::Nick *na = NickServ::FindNick(nick);
if (!na)
{
source.Reply(_("\002{0}\002 isn't registered."), nick);
return;
}
nc = na->GetAccount();
}
else
nc = source.GetAccount();
ListFormatter list(source.GetAccount());
list.AddColumn(_("Nick")).AddColumn(_("Expires"));
time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire", "21d"),
unconfirmed_expire = Config->GetModule("nickserv")->Get<time_t>("unconfirmedexpire", "1d");
for (NickServ::Nick *na2 : nc->GetRefs<NickServ::Nick *>())
{
Anope::string expires;
if (na2->HasFieldS("NS_NO_EXPIRE"))
expires = _("Does not expire");
else if (!nickserv_expire || Anope::NoExpire)
;
else if (na2->GetAccount()->HasFieldS("UNCONFIRMED") && unconfirmed_expire)
expires = Anope::strftime(na2->GetTimeRegistered() + unconfirmed_expire, source.GetAccount());
else
expires = Anope::strftime(na2->GetLastSeen() + nickserv_expire, source.GetAccount());
ListFormatter::ListEntry entry;
entry["Nick"] = na2->GetNick();
entry["Expires"] = expires;
list.AddEntry(entry);
}
source.Reply(nc != source.GetAccount() ? _("List of nicknames in the group of \002%s\002:") : _("List of nicknames in your group:"), nc->GetDisplay().c_str());
std::vector<Anope::string> replies;
list.Process(replies);
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
source.Reply(_("%d nickname(s) in the group."), replies.size());
}
示例7: OnSuccess
void OnSuccess(NickServ::IdentifyRequest *) override
{
if (!source.GetUser() || source.GetUser()->nick != nick || !target)
return;
User *u = source.GetUser();
NickServ::Nick *na = NickServ::FindNick(nick);
/* If the nick is already registered, drop it. */
if (na)
{
EventManager::Get()->Dispatch(&Event::ChangeCoreDisplay::OnChangeCoreDisplay, na->GetAccount(), u->nick);
delete na;
}
na = Serialize::New<NickServ::Nick *>();
na->SetNick(nick);
na->SetAccount(target->GetAccount());
na->SetLastUsermask(u->GetIdent() + "@" + u->GetDisplayedHost());
na->SetLastRealname(u->realname);
na->SetLastSeen(Anope::CurTime);
na->SetTimeRegistered(Anope::CurTime);
u->Login(target->GetAccount());
EventManager::Get()->Dispatch(&Event::NickGroup::OnNickGroup, u, target);
Log(LOG_COMMAND, source, cmd) << "to make " << nick << " join group of " << target->GetNick() << " (" << target->GetAccount()->GetDisplay() << ") (email: " << (!target->GetAccount()->GetEmail().empty() ? target->GetAccount()->GetEmail() : "none") << ")";
source.Reply(_("You are now in the group of \002{0}\002."), target->GetNick());
u->lastnickreg = Anope::CurTime;
}
示例8: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &cmd = params[0];
Anope::string nick, mask;
if (cmd.equals_ci("LIST"))
nick = params.size() > 1 ? params[1] : "";
else
{
nick = params.size() == 3 ? params[1] : "";
mask = params.size() > 1 ? params[params.size() - 1] : "";
}
NickServ::Account *nc;
if (!nick.empty() && source.HasPriv("nickserv/access"))
{
NickServ::Nick *na = NickServ::FindNick(nick);
if (na == NULL)
{
source.Reply(_("\002{0}\002 isn't registered."), nick);
return;
}
if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->GetAccount() && na->GetAccount()->IsServicesOper() && !cmd.equals_ci("LIST"))
{
source.Reply(_("You may view but not modify the access list of other Services Operators."));
return;
}
nc = na->GetAccount();
}
else
nc = source.nc;
if (!mask.empty() && (mask.find('@') == Anope::string::npos || mask.find('!') != Anope::string::npos))
{
source.Reply(_("Mask must be in the form \037user\[email protected]\037host\037."));
source.Reply(_("\002%s%s HELP %s\002 for more information."), Config->StrictPrivmsg, source.service->nick, source.command); // XXX
}
else if (cmd.equals_ci("LIST"))
return this->DoList(source, nc, mask);
else if (nc->HasFieldS("NS_SUSPENDED"))
source.Reply(_("\002{0}\002 is suspended."), nc->GetDisplay());
else if (cmd.equals_ci("ADD"))
return this->DoAdd(source, nc, mask);
else if (cmd.equals_ci("DEL"))
return this->DoDel(source, nc, mask);
else
this->OnSyntaxError(source, "");
}
示例9: SetRealname
void User::SetRealname(const Anope::string &srealname)
{
if (srealname.empty())
throw CoreException("realname empty in SetRealname");
this->realname = srealname;
//XXX event
NickServ::Nick *na = NickServ::FindNick(this->nick);
if (na && (this->IsIdentified(true) || this->IsRecognized()))
na->SetLastRealname(srealname);
Log(this, "realname") << "changed realname to " << srealname;
}
示例10:
// :42X UID Adam 1 1348535644 +aow Adam 192.168.0.5 192.168.0.5 42XAAAAAB 0 192.168.0.5 :Adam
void plexus::UID::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
{
/* An IP of 0 means the user is spoofed */
Anope::string ip = params[6];
if (ip == "0")
ip.clear();
time_t ts;
try
{
ts = convertTo<time_t>(params[2]);
}
catch (const ConvertException &)
{
ts = Anope::CurTime;
}
NickServ::Nick *na = NULL;
try
{
if (params[8].is_pos_number_only() && convertTo<time_t>(params[8]) == ts)
na = NickServ::FindNick(params[0]);
}
catch (const ConvertException &) { }
if (params[8] != "0" && !na)
na = NickServ::FindNick(params[8]);
User::OnIntroduce(params[0], params[4], params[9], params[5], ip, source.GetServer(), params[10], ts, params[3], params[7], na ? na->GetAccount() : NULL);
}
示例11: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
User *u = source.GetUser();
NickServ::Nick *na = NickServ::FindNick(u->nick);
if (!na || !na->HasVhost() || na->GetAccount() != source.GetAccount())
{
source.Reply(_("There is no vhost assigned to this nickname."));
return;
}
u->vhost.clear();
IRCD->SendVhostDel(u);
Log(LOG_COMMAND, source, this) << "to disable their vhost";
source.Reply(_("Your vhost was removed and the normal cloaking restored."));
}
示例12: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &cmd = params[0];
Anope::string nick, certfp;
if (cmd.equals_ci("LIST"))
nick = params.size() > 1 ? params[1] : "";
else
{
nick = params.size() == 3 ? params[1] : "";
certfp = params.size() > 1 ? params[params.size() - 1] : "";
}
NickServ::Account *nc;
if (!nick.empty() && source.HasPriv("nickserv/access"))
{
NickServ::Nick *na = NickServ::FindNick(nick);
if (na == NULL)
{
source.Reply(_("\002{0}\002 isn't registered."), nick);
return;
}
if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->GetAccount() && na->GetAccount()->IsServicesOper() && !cmd.equals_ci("LIST"))
{
source.Reply(_("You may view, but not modify, the certificate list of other Services Operators."));
return;
}
nc = na->GetAccount();
}
else
nc = source.nc;
if (cmd.equals_ci("LIST"))
return this->DoList(source, nc);
else if (nc->HasFieldS("NS_SUSPENDED"))
source.Reply(_("\002{0}\002 is suspended."), nc->GetDisplay());
else if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode."));
else if (cmd.equals_ci("ADD"))
return this->DoAdd(source, nc, certfp);
else if (cmd.equals_ci("DEL"))
return this->DoDel(source, nc, certfp);
else
this->OnSyntaxError(source, "");
}
示例13:
/* :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);
}
示例14: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &cmd = params[0];
Anope::string nick, param, param2;
if (cmd.equals_ci("LIST"))
nick = params.size() > 1 ? params[1] : "";
else
nick = (params.size() > 2 && IRCD->IsChannelValid(params[2])) ? params[1] : "";
NickServ::Account *nc;
if (!nick.empty() && !source.HasCommand("nickserv/ajoin"))
{
NickServ::Nick *na = NickServ::FindNick(nick);
if (na == NULL)
{
source.Reply(_("\002{0}\002 isn't registered."), nick);
return;
}
nc = na->GetAccount();
param = params.size() > 2 ? params[2] : "";
param2 = params.size() > 3 ? params[3] : "";
}
else
{
nc = source.nc;
param = params.size() > 1 ? params[1] : "";
param2 = params.size() > 2 ? params[2] : "";
}
if (cmd.equals_ci("LIST"))
return this->DoList(source, nc);
else if (nc->HasFieldS("NS_SUSPENDED"))
source.Reply(_("\002{0}\002 isn't registered."), nc->GetDisplay());
else if (param.empty())
this->OnSyntaxError(source, "");
else if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode."));
else if (cmd.equals_ci("ADD"))
return this->DoAdd(source, nc, param, param2);
else if (cmd.equals_ci("DEL"))
return this->DoDel(source, nc, param);
else
this->OnSyntaxError(source, "");
}
示例15: 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);
}