1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 07:26:37 +02:00

Slight code cleanup in nickalias.cpp and nickcore.cpp.

This commit is contained in:
Naram Qashat
2010-07-30 13:15:35 -04:00
parent 527304ed2c
commit 174cc58a8d
2 changed files with 22 additions and 23 deletions
+9 -10
View File
@@ -6,7 +6,7 @@ NickRequest::NickRequest(const Anope::string &nickname)
if (nickname.empty())
throw CoreException("Empty nick passed to NickRequest constructor");
requested = lastmail = 0;
this->requested = this->lastmail = 0;
this->nick = nickname;
@@ -31,17 +31,17 @@ NickAlias::NickAlias(const Anope::string &nickname, NickCore *nickcore)
else if (!nickcore)
throw CoreException("Empty nickcore passed to NickAlias constructor");
time_registered = last_seen = 0;
this->time_registered = this->last_seen = 0;
this->nick = nickname;
this->nc = nickcore;
nc->aliases.push_back(this);
this->nc->aliases.push_back(this);
NickAliasList[this->nick] = this;
for (std::list<std::pair<Anope::string, Anope::string> >::iterator it = Config.Opers.begin(), it_end = Config.Opers.end(); it != it_end; ++it)
{
if (nc->ot)
if (this->nc->ot)
break;
if (!this->nick.equals_ci(it->first))
continue;
@@ -52,8 +52,8 @@ NickAlias::NickAlias(const Anope::string &nickname, NickCore *nickcore)
if (ot->GetName().equals_ci(it->second))
{
Alog() << "Tied oper " << nc->display << " to type " << ot->GetName();
nc->ot = ot;
Alog() << "Tied oper " << this->nc->display << " to type " << ot->GetName();
this->nc->ot = ot;
break;
}
}
@@ -64,13 +64,12 @@ NickAlias::NickAlias(const Anope::string &nickname, NickCore *nickcore)
*/
NickAlias::~NickAlias()
{
User *u = NULL;
FOREACH_MOD(I_OnDelNick, OnDelNick(this));
/* Second thing to do: look for an user using the alias
* being deleted, and make appropriate changes */
if ((u = finduser(this->nick)) && u->Account())
User *u = finduser(this->nick);
if (u && u->Account())
{
ircdproto->SendAccountLogout(u, u->Account());
u->RemoveMode(NickServ, UMODE_REGISTERED);
@@ -84,7 +83,7 @@ NickAlias::~NickAlias()
/* Next: see if our core is still useful. */
std::list<NickAlias *>::iterator it = std::find(this->nc->aliases.begin(), this->nc->aliases.end(), this);
if (it != this->nc->aliases.end())
nc->aliases.erase(it);
this->nc->aliases.erase(it);
if (this->nc->aliases.empty())
{
delete this->nc;
+13 -13
View File
@@ -9,16 +9,16 @@ NickCore::NickCore(const Anope::string &coredisplay)
if (coredisplay.empty())
throw CoreException("Empty display passed to NickCore constructor");
ot = NULL;
language = channelcount = 0;
lastmail = 0;
this->ot = NULL;
this->language = this->channelcount = 0;
this->lastmail = 0;
this->display = coredisplay;
/* Set default nick core flags */
for (size_t t = NI_BEGIN + 1; t != NI_END; ++t)
if (Config.NSDefFlags.HasFlag(static_cast<NickCoreFlag>(t)))
SetFlag(static_cast<NickCoreFlag>(t));
this->SetFlag(static_cast<NickCoreFlag>(t));
NickCoreList[this->display] = this;
}
@@ -91,21 +91,21 @@ bool NickCore::HasPriv(const Anope::string &privstr) const
void NickCore::AddAccess(const Anope::string &entry)
{
access.push_back(entry);
this->access.push_back(entry);
FOREACH_MOD(I_OnNickAddAccess, OnNickAddAccess(this, entry));
}
Anope::string NickCore::GetAccess(unsigned entry) const
{
if (access.empty() || entry >= access.size())
if (this->access.empty() || entry >= this->access.size())
return "";
return access[entry];
return this->access[entry];
}
bool NickCore::FindAccess(const Anope::string &entry)
{
for (unsigned i = 0, end = access.size(); i < end; ++i)
if (access[i] == entry)
for (unsigned i = 0, end = this->access.size(); i < end; ++i)
if (this->access[i] == entry)
return true;
return false;
@@ -113,11 +113,11 @@ bool NickCore::FindAccess(const Anope::string &entry)
void NickCore::EraseAccess(const Anope::string &entry)
{
for (unsigned i = 0, end = access.size(); i < end; ++i)
if (access[i] == entry)
for (unsigned i = 0, end = this->access.size(); i < end; ++i)
if (this->access[i] == entry)
{
FOREACH_MOD(I_OnNickEraseAccess, OnNickEraseAccess(this, entry));
access.erase(access.begin() + i);
this->access.erase(this->access.begin() + i);
break;
}
}
@@ -125,5 +125,5 @@ void NickCore::EraseAccess(const Anope::string &entry)
void NickCore::ClearAccess()
{
FOREACH_MOD(I_OnNickClearAccess, OnNickClearAccess(this));
access.clear();
this->access.clear();
}