本文整理汇总了C++中XLine::SetID方法的典型用法代码示例。如果您正苦于以下问题:C++ XLine::SetID方法的具体用法?C++ XLine::SetID怎么用?C++ XLine::SetID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XLine
的用法示例。
在下文中一共展示了XLine::SetID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLookupComplete
void OnLookupComplete(const Query *record) override
{
if (!user || user->Quitting())
return;
const ResourceRecord &ans_record = record->answers[0];
// Replies should be in 127.0.0.0/8
if (ans_record.rdata.find("127.") != 0)
return;
sockaddrs sresult;
sresult.pton(AF_INET, ans_record.rdata);
int result = sresult.sa4.sin_addr.s_addr >> 24;
Blacklist::Reply *reply = blacklist.Find(result);
if (!blacklist.replies.empty() && !reply)
return;
if (reply && reply->allow_account && user->Account())
return;
Anope::string reason = this->blacklist.reason, addr = user->ip.addr();
reason = reason.replace_all_cs("%n", user->nick);
reason = reason.replace_all_cs("%u", user->GetIdent());
reason = reason.replace_all_cs("%g", user->realname);
reason = reason.replace_all_cs("%h", user->host);
reason = reason.replace_all_cs("%i", addr);
reason = reason.replace_all_cs("%r", reply ? reply->reason : "");
reason = reason.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<Anope::string>("networkname"));
ServiceBot *OperServ = Config->GetClient("OperServ");
creator->logger.Category("dnsbl").Bot(OperServ).Log(_("{0} ({1}) appears in {2}"), user->GetMask(), addr, this->blacklist.name);
XLine *x = Serialize::New<XLine *>();
x->SetMask("*@" + addr);
x->SetBy(OperServ ? OperServ->nick : "m_dnsbl");
x->SetCreated(Anope::CurTime);
x->SetExpires(Anope::CurTime + this->blacklist.bantime);
x->SetReason(reason);
x->SetID(XLineManager::GenerateUID());
if (this->add_to_akill && akills)
{
akills->AddXLine(x);
akills->Send(NULL, x);
}
else
{
IRCD->Send<messages::Akill>(nullptr, x);
delete x;
}
}
示例2: SendAkill
void SendAkill(User *u, XLine *x) override
{
if (x->IsRegex() || x->HasNickOrReal())
{
if (!u)
{
/*
* No user (this akill was just added), and contains nick and/or realname.
* Find users that match and ban them.
*/
for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
if (x->GetManager()->Check(it->second, x))
this->SendAkill(it->second, x);
return;
}
XLine *old = x;
if (old->GetManager()->HasEntry("*@" + u->host))
return;
/* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */
XLine *xl = Serialize::New<XLine *>();
xl->SetMask("*@" + u->host);
xl->SetBy(old->GetBy());
xl->SetExpires(old->GetExpires());
xl->SetReason(old->GetReason());
xl->SetID(old->GetID());
old->GetManager()->AddXLine(xl);
x = xl;
Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#"
<< u->realname << " matches " << old->GetMask();
}
/* Calculate the time left before this would expire, capping it at 2 days */
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
Uplink::Send(Config->GetClient("OperServ"), "KLINE", timeleft, x->GetUser(), x->GetHost(), x->GetReason());
}