本文整理汇总了C++中Reference::Account方法的典型用法代码示例。如果您正苦于以下问题:C++ Reference::Account方法的具体用法?C++ Reference::Account怎么用?C++ Reference::Account使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reference
的用法示例。
在下文中一共展示了Reference::Account方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Deoper
void Deoper()
{
Oper *oper = user->Account()->GetOper();
if (oper != nullptr)
{
oper->Delete();
Log(this->owner) << "Removed services operator from " << user->nick << " (" << user->Account()->GetDisplay() << ")";
user->RemoveMode(Config->GetClient("OperServ"), "OPER"); // Probably not set, just incase
}
}
示例2: OnResult
void OnResult(const SQL::Result &r) override
{
SQLOperResultDeleter d(this);
if (!user || !user->Account() || r.Rows() == 0)
return;
Anope::string opertype;
try
{
opertype = r.Get(0, "opertype");
}
catch (const SQL::Exception &)
{
return;
}
Log(LOG_DEBUG) << "m_sql_oper: Got result for " << user->nick << ", opertype " << opertype;
Anope::string modes;
try
{
modes = r.Get(0, "modes");
}
catch (const SQL::Exception &) { }
ServiceBot *OperServ = Config->GetClient("OperServ");
if (opertype.empty())
{
if (user->Account() && user->Account()->o && dynamic_cast<SQLOper *>(user->Account()->o))
{
delete user->Account()->o;
user->Account()->o = NULL;
Log(this->owner) << "m_sql_oper: Removed services operator from " << user->nick << " (" << user->Account()->GetDisplay() << ")";
user->RemoveMode(OperServ, "OPER"); // Probably not set, just incase
}
return;
}
OperType *ot = OperType::Find(opertype);
if (ot == NULL)
{
Log(this->owner) << "m_sql_oper: Oper " << user->nick << " has type " << opertype << ", but this opertype does not exist?";
return;
}
if (!user->Account()->o || user->Account()->o->ot != ot)
{
Log(this->owner) << "m_sql_oper: Tieing oper " << user->nick << " to type " << opertype;
user->Account()->o = new SQLOper(user->Account()->GetDisplay(), ot);
}
if (!user->HasMode("OPER"))
{
IRCD->SendOper(user);
if (!modes.empty())
user->SetModes(OperServ, "%s", modes.c_str());
}
}
示例3: OnResult
void OnResult(const SQL::Result &r) override
{
SQLOperResultDeleter d(this);
if (!user || !user->Account())
return;
if (r.Rows() == 0)
{
Log(LogType::DEBUG) << "m_sql_oper: Got 0 rows for " << user->nick;
Deoper();
return;
}
Anope::string opertype;
try
{
opertype = r.Get(0, "opertype");
}
catch (const SQL::Exception &)
{
Log(this->owner) << "Expected column named \"opertype\" but one was not found";
return;
}
Log(LogType::DEBUG) << "m_sql_oper: Got result for " << user->nick << ", opertype " << opertype;
Anope::string modes;
try
{
modes = r.Get(0, "modes");
}
catch (const SQL::Exception &) { }
ServiceBot *OperServ = Config->GetClient("OperServ");
if (opertype.empty())
{
Deoper();
return;
}
OperType *ot = OperType::Find(opertype);
if (ot == NULL)
{
Log(this->owner) << "m_sql_oper: Oper " << user->nick << " has type " << opertype << ", but this opertype does not exist?";
return;
}
Oper *oper = user->Account()->GetOper();
if (oper == nullptr || oper->GetType() != ot)
{
Log(this->owner) << "m_sql_oper: Tieing oper " << user->nick << " to type " << opertype;
if (oper)
oper->Delete();
oper = Serialize::New<Oper *>();
oper->SetName(user->Account()->GetDisplay());
oper->SetType(ot);
user->Account()->SetOper(oper);
}
if (!user->HasMode("OPER"))
{
IRCD->SendOper(user);
if (!modes.empty())
user->SetModes(OperServ, "%s", modes.c_str());
}
}