本文整理汇总了C++中nickserv::Nick类的典型用法代码示例。如果您正苦于以下问题:C++ Nick类的具体用法?C++ Nick怎么用?C++ Nick使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Nick类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:dream1986,项目名称:anope,代码行数:30,代码来源:old.cpp
示例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);
}
开发者ID:bonnedav,项目名称:anope,代码行数:32,代码来源:read.cpp
示例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;
}
开发者ID:dream1986,项目名称:anope,代码行数:10,代码来源:users.cpp
示例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;
}
开发者ID:dream1986,项目名称:anope,代码行数:12,代码来源:users.cpp
示例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);
}
开发者ID:dream1986,项目名称:anope,代码行数:52,代码来源:users.cpp
示例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());
}
开发者ID:SaberUK,项目名称:anope,代码行数:50,代码来源:group.cpp
示例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;
}
开发者ID:SaberUK,项目名称:anope,代码行数:31,代码来源:group.cpp
示例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, "");
}
开发者ID:bonnedav,项目名称:anope,代码行数:50,代码来源:access.cpp
示例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;
}
开发者ID:dream1986,项目名称:anope,代码行数:15,代码来源:users.cpp
示例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);
}
开发者ID:Robby-,项目名称:anope,代码行数:30,代码来源:plexus.cpp
示例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."));
}
开发者ID:bonnedav,项目名称:anope,代码行数:16,代码来源:off.cpp
示例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, "");
}
开发者ID:carriercomm,项目名称:anope,代码行数:47,代码来源:cert.cpp
示例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);
}
开发者ID:SaberUK,项目名称:anope,代码行数:18,代码来源:hybrid.cpp
示例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, "");
}
开发者ID:SaberUK,项目名称:anope,代码行数:46,代码来源:ajoin.cpp
示例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);
}
开发者ID:dream1986,项目名称:anope,代码行数:21,代码来源:charybdis.cpp
示例16: OnPreCommand
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override
{
if (command->name == "nickserv/confirm" && params.size() > 1)
{
if (Anope::ReadOnly)
{
source.Reply(_("Services are in read-only mode."));
return EVENT_STOP;
}
NickServ::Nick *na = NickServ::FindNick(params[0]);
ResetInfo *ri = na ? reset.Get(na->GetAccount()) : NULL;
if (na && ri)
{
NickServ::Account *nc = na->GetAccount();
const Anope::string &passcode = params[1];
if (ri->time < Anope::CurTime - 3600)
{
reset.Unset(nc);
source.Reply(_("Your password reset request has expired."));
}
else if (passcode.equals_cs(ri->code))
{
reset.Unset(nc);
nc->UnsetS<bool>("UNCONFIRMED");
Log(LOG_COMMAND, source, &commandnsresetpass) << "confirmed RESETPASS to forcefully identify as " << na->GetNick();
if (source.GetUser())
{
source.GetUser()->Identify(na);
source.Reply(_("You are now identified for \002{0}\002. Change your password now."), na->GetAccount()->GetDisplay());
}
}
else
return EVENT_CONTINUE;
return EVENT_STOP;
}
}
return EVENT_CONTINUE;
}
开发者ID:carriercomm,项目名称:anope,代码行数:44,代码来源:resetpass.cpp
示例17: UpdateHost
void User::UpdateHost()
{
if (this->host.empty())
return;
//XXX event
NickServ::Nick *na = NickServ::FindNick(this->nick);
on_access = false;
if (na)
on_access = na->GetAccount()->IsOnAccess(this);
if (na && (this->IsIdentified(true) || this->IsRecognized()))
{
Anope::string last_usermask = this->GetIdent() + "@" + this->GetDisplayedHost();
Anope::string last_realhost = this->GetIdent() + "@" + this->host;
na->SetLastUsermask(last_usermask);
na->SetLastRealhost(last_realhost);
}
}
开发者ID:dream1986,项目名称:anope,代码行数:19,代码来源:users.cpp
示例18: OnFingerprint
void OnFingerprint(User *u) override
{
ServiceBot *NickServ = Config->GetClient("NickServ");
if (!NickServ || u->IsIdentified())
return;
NickServ::Account *nc = cs.FindAccountFromCert(u->fingerprint);
if (!nc || nc->HasFieldS("NS_SUSPENDED"))
return;
NickServ::Nick *na = NickServ::FindNick(u->nick);
if (na && na->GetAccount() == nc)
u->Identify(na);
else
u->Login(nc);
u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified to \002%s\002."), nc->GetDisplay().c_str());
Log(NickServ) << u->GetMask() << " automatically identified for account " << nc->GetDisplay() << " via SSL certificate fingerprint";
}
开发者ID:carriercomm,项目名称:anope,代码行数:19,代码来源:cert.cpp
示例19: DoCommand
void DoCommand(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request)
{
Anope::string service = request.data.size() > 0 ? request.data[0] : "";
Anope::string user = request.data.size() > 1 ? request.data[1] : "";
Anope::string command = request.data.size() > 2 ? request.data[2] : "";
if (service.empty() || user.empty() || command.empty())
request.reply("error", "Invalid parameters");
else
{
ServiceBot *bi = ServiceBot::Find(service, true);
if (!bi)
request.reply("error", "Invalid service");
else
{
request.reply("result", "Success");
NickServ::Nick *na = NickServ::FindNick(user);
Anope::string out;
struct XMLRPCommandReply : CommandReply
{
Anope::string &str;
XMLRPCommandReply(Anope::string &s) : str(s) { }
void SendMessage(const MessageSource &, const Anope::string &msg) override
{
str += msg + "\n";
};
}
reply(out);
CommandSource source(user, NULL, na ? na->GetAccount() : NULL, &reply, bi);
Command::Run(source, command);
if (!out.empty())
request.reply("return", iface->Sanitize(out));
}
}
}
开发者ID:SaberUK,项目名称:anope,代码行数:42,代码来源:xmlrpc_main.cpp
示例20: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &nick = params[0];
const Anope::string &pass = params.size() > 1 ? params[1] : "";
User *user = User::Find(nick, true);
if (user && source.GetUser() == user)
{
source.Reply(_("You can't %s yourself!"), source.command.lower().c_str());
return;
}
NickServ::Nick *na = NickServ::FindNick(nick);
if (!na)
{
source.Reply(_("\002{0}\002 isn't registered."), nick);
return;
}
if (na->GetAccount()->HasFieldS("NS_SUSPENDED"))
{
source.Reply(_("\002{0}\002 is suspended."), na->GetNick());
return;
}
bool ok = false;
if (source.GetAccount() == na->GetAccount())
ok = true;
else if (!na->GetAccount()->HasFieldS("NS_SECURE") && source.GetUser() && na->GetAccount()->IsOnAccess(source.GetUser()))
ok = true;
if (certservice && source.GetUser() && certservice->Matches(source.GetUser(), na->GetAccount()))
ok = true;
if (ok == false && !pass.empty())
{
NickServ::IdentifyRequest *req = NickServ::service->CreateIdentifyRequest(new NSRecoverRequestListener(source, this, na->GetNick(), pass), owner, na->GetNick(), pass);
Event::OnCheckAuthentication(&Event::CheckAuthentication::OnCheckAuthentication, source.GetUser(), req);
req->Dispatch();
}
else
{
NSRecoverRequestListener req(source, this, na->GetNick(), pass);
if (ok)
req.OnSuccess(nullptr);
else
req.OnFail(nullptr);
}
}
开发者ID:bonnedav,项目名称:anope,代码行数:52,代码来源:recover.cpp
注:本文中的nickserv::Nick类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论