diff options
Diffstat (limited to 'src/nickcore.cpp')
-rw-r--r-- | src/nickcore.cpp | 104 |
1 files changed, 70 insertions, 34 deletions
diff --git a/src/nickcore.cpp b/src/nickcore.cpp index af4680f45..6dadc9217 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -1,34 +1,70 @@ -#include "services.h"
-
-NickCore::NickCore()
-{
- next = prev = NULL;
- display = email = greet = url = NULL;
- ot = NULL;
- pass[0] = '\0';
- icq = flags = 0;
- language = accesscount = channelcount = 0;
- lastmail = 0;
-}
-
-bool NickCore::HasCommand(const std::string &cmdstr) const
-{
- if (!this->ot)
- {
- // No opertype.
- return false;
- }
-
- return this->ot->HasCommand(cmdstr);
-}
-
-bool NickCore::HasPriv(const std::string &privstr) const
-{
- if (!this->ot)
- {
- // No opertype.
- return false;
- }
-
- return this->ot->HasPriv(privstr);
-}
+#include "services.h" + +NickCore::NickCore() +{ + next = prev = NULL; + display = email = greet = url = NULL; + ot = NULL; + pass[0] = '\0'; + icq = flags = 0; + language = channelcount = 0; + lastmail = 0; +} + +bool NickCore::HasCommand(const std::string &cmdstr) const +{ + if (!this->ot) + { + // No opertype. + return false; + } + + return this->ot->HasCommand(cmdstr); +} + +bool NickCore::HasPriv(const std::string &privstr) const +{ + if (!this->ot) + { + // No opertype. + return false; + } + + return this->ot->HasPriv(privstr); +} + +void NickCore::AddAccess(const std::string &entry) +{ + access.push_back(entry); +} + +std::string NickCore::GetAccess(unsigned entry) +{ + if (access.empty() || entry >= access.size()) + return ""; + return access[entry]; +} + +bool NickCore::FindAccess(const std::string &entry) +{ + for (unsigned i = 0; i < access.size(); ++i) + if (access[i] == entry) + return true; + + return false; +} + +void NickCore::EraseAccess(const std::string &entry) +{ + for (unsigned i = 0; i < access.size(); ++i) + if (access[i] == entry) + { + access.erase(access.begin() + i); + break; + } +} + +void NickCore::ClearAccess() +{ + access.clear(); +} |