summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-22 18:56:25 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-22 18:56:25 +0000
commit39ca58c38ce96a37586d5cef381e321709be3326 (patch)
tree9d5dbc479927cd54a744cc283b0ce4dd7c37a43a
parent03a85ddeaf120bd7234089f9f5333d7895f96deb (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
-rw-r--r--include/modules.h4
-rw-r--r--src/modules.cpp22
2 files changed, 26 insertions, 0 deletions
diff --git a/include/modules.h b/include/modules.h
index a0b6adba7..8c37a8cc2 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1739,6 +1739,10 @@ class Server : public classbase
virtual void DelSocket(InspSocket* sock);
virtual void RehashServer();
+
+ virtual long GetChannelCount();
+
+ virtual chanrec* GetChannelIndex(long index);
};
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());