diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-22 18:56:25 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-22 18:56:25 +0000 |
commit | 39ca58c38ce96a37586d5cef381e321709be3326 (patch) | |
tree | 9d5dbc479927cd54a744cc283b0ce4dd7c37a43a /src | |
parent | 03a85ddeaf120bd7234089f9f5333d7895f96deb (diff) |
Added m_safelist helper functions GetChannelCount and GetChannelIndex
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3287 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index fa1c9e7bd..266556dac 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -391,6 +391,28 @@ void Server::DelSocket(InspSocket* sock) } } +long Server::GetChannelCount() +{ + return (long)chanlist.size(); +} + +/* This is ugly, yes, but hash_map's arent designed to be + * addressed in this manner, and this is a bit of a kludge. + * Luckily its a specialist function and rarely used by + * many modules (in fact, it was specially created to make + * m_safelist possible, initially). + */ + +chanrec* Server::GetChannelIndex(long index) +{ + for (chan_hash::iterator n = chanlist.begin(); n != chanlist.end(); n++, target++) + { + if (index == target) + return n->second; + } + return NULL; +} + void Server::SendOpers(std::string s) { WriteOpers("%s",s.c_str()); |