From 39ca58c38ce96a37586d5cef381e321709be3326 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 22 Feb 2006 18:56:25 +0000 Subject: Added m_safelist helper functions GetChannelCount and GetChannelIndex git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3287 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') 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()); -- cgit v1.2.3