diff --git a/include/users.h b/include/users.h index 135e115ef..880827c73 100644 --- a/include/users.h +++ b/include/users.h @@ -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 */ diff --git a/src/modules/mysql/db_mysql_execute.cpp b/src/modules/mysql/db_mysql_execute.cpp index 4e4e859cb..572dd2917 100644 --- a/src/modules/mysql/db_mysql_execute.cpp +++ b/src/modules/mysql/db_mysql_execute.cpp @@ -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; } }; diff --git a/src/users.cpp b/src/users.cpp index 3e367ef47..b01862479 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -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;