1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 09:03:14 +02:00

Added an arg to User::IsRecognized to check for NI_SECURE

This commit is contained in:
Adam
2010-05-28 18:27:22 -04:00
committed by Adam
parent c43666e344
commit 435c9116e9
3 changed files with 18 additions and 5 deletions
+2 -1
View File
@@ -188,9 +188,10 @@ class CoreExport User : public Extensible
virtual const bool IsIdentified(bool CheckNick = false) const;
/** Check if the user is recognized for their nick (on the nicks access list)
* @param CheckSecure Only returns true if the user has secure off
* @return true or false
*/
virtual const bool IsRecognized() const;
virtual const bool IsRecognized(bool CheckSecure = false) const;
/** Update the last usermask stored for a user, and check to see if they are recognized
*/
+2 -1
View File
@@ -52,6 +52,7 @@ class FakeUser : public User
NickCore *Account() const { return nc; }
const bool IsIdentified(bool) const { return nc ? true : false; }
const bool IsRecognized(bool) const { return true; }
} SQLUser;
class SQLTimer : public Timer
@@ -155,7 +156,7 @@ class DBMySQLExecute : public DBMySQL
~DBMySQLExecute()
{
TimerManager::DelTimer(_SQLTimer);
delete _SQLTimer;
}
};
+14 -3
View File
@@ -192,7 +192,7 @@ void User::SetRealname(const std::string &srealname)
this->realname = sstrdup(srealname.c_str());
NickAlias *na = findnick(this->nick);
if (na && (this->IsIdentified(true) || (!na->nc->HasFlag(NI_SECURE) && this->IsRecognized())))
if (na && (this->IsIdentified(true) || this->IsRecognized(true)))
{
if (na->last_realname)
delete [] na->last_realname;
@@ -477,10 +477,21 @@ const bool User::IsIdentified(bool CheckNick) const
}
/** Check if the user is recognized for their nick (on the nicks access list)
* @param CheckSecure Only returns true if the user has secure off
* @return true or false
*/
const bool User::IsRecognized() const
const bool User::IsRecognized(bool CheckSecure) const
{
if (CheckSecure && OnAccess)
{
NickAlias *na = findnick(this->nick);
if (!na || !na->nc->HasFlag(NI_SECURE))
{
return false;
}
}
return OnAccess;
}
@@ -497,7 +508,7 @@ void User::UpdateHost()
if (na)
OnAccess = is_on_access(this, na->nc);
if (na && (this->IsIdentified(true) || (!na->nc->HasFlag(NI_SECURE) && this->IsRecognized())))
if (na && (this->IsIdentified(true) || this->IsRecognized(true)))
{
if (na->last_usermask)
delete [] na->last_usermask;