summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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());