diff options
| author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-03-23 21:05:29 +0000 |
|---|---|---|
| committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-03-23 21:05:29 +0000 |
| commit | b3eeb815b6e01456b0c987305454bc9b5a5f5a14 (patch) | |
| tree | f3832a89e3a123fe4c57223bf1b18294be9f0edd /include | |
| parent | da43e02228dfddc921946a94ae3790a35559b1d5 (diff) | |
Replace manually allocated array for NickCore's access list with an std::vector, cleans up the code and provides a more sane interface, also fixes bug #1023 in the process.
Also add missing help for NS ACCESS.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2201 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'include')
| -rw-r--r-- | include/account.h | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/include/account.h b/include/account.h index 01758ebb7..43e82fb8e 100644 --- a/include/account.h +++ b/include/account.h @@ -55,8 +55,7 @@ class CoreExport NickCore : public Extensible char *url; /* URL associated to the nick */ uint32 flags; /* See NI_* below */ uint16 language; /* Language selected by nickname owner (LANG_*) */ - uint16 accesscount; /* # of entries */ - char **access; /* Array of strings */ + std::vector<std::string> access; /* Access list, vector of strings */ MemoInfo memos; uint16 channelcount; /* Number of channels currently registered */ @@ -77,5 +76,45 @@ class CoreExport NickCore : public Extensible * @return True if this opertype has the specified priv, false otherwise. */ bool HasPriv(const std::string &privstr) const; + + /** Add an entry to the nick's access list + * + * @param entry The nick!ident@host entry to add to the access list + * + * Adds a new entry into the access list. + */ + void AddAccess(const std::string &entry); + + /** Get an entry from the nick's access list by index + * + * @param entry Index in the access list vector to retrieve + * @return The access list entry of the given index if within bounds, an empty string if the vector is empty or the index is out of bounds + * + * Retrieves an entry from the access list corresponding to the given index. + */ + std::string GetAccess(unsigned entry); + + /** Find an entry in the nick's access list + * + * @param entry The nick!ident@host entry to search for + * @return True if the entry is found in the access list, false otherwise + * + * Search for an entry within the access list. + */ + bool FindAccess(const std::string &entry); + + /** Erase an entry from the nick's access list + * + * @param entry The nick!ident@host entry to remove + * + * Removes the specified access list entry from the access list. + */ + void EraseAccess(const std::string &entry); + + /** Clears the entire nick's access list + * + * Deletes all the memory allocated in the access list vector and then clears the vector. + */ + void ClearAccess(); }; |
