]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Optimisation of optimisation :P ty w00tie
[user/henk/code/inspircd.git] / src / modules.cpp
index fa1c9e7bdfbd4effe74713e1768a7b2cd2afba78..a267662dfdd0abd16d321f09cc7d7effa9620195 100644 (file)
@@ -391,6 +391,34 @@ 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)
+{
+       int target = 0;
+       for (chan_hash::iterator n = chanlist.begin(); n != chanlist.end(); n++, target++)
+       {
+               if (index == target)
+                       return n->second;
+       }
+       return NULL;
+}
+
+void Server::AddTimer(InspTimer* T)
+{
+       ::AddTimer(T);
+}
+
 void Server::SendOpers(std::string s)
 {
        WriteOpers("%s",s.c_str());
@@ -458,9 +486,9 @@ bool Server::IsUlined(std::string server)
        return is_uline(server.c_str());
 }
 
-void Server::CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user)
+bool Server::CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user)
 {
-       ServerInstance->Parser->CallHandler(commandname,parameters,pcnt,user);
+       return ServerInstance->Parser->CallHandler(commandname,parameters,pcnt,user);
 }
 
 bool Server::IsValidModuleCommand(std::string commandname, int pcnt, userrec* user)
@@ -507,7 +535,7 @@ void Server::SendTo(userrec* Source, userrec* Dest, std::string s)
        if (!Source)
        {
                // if source is NULL, then the message originates from the local server
-               Write(Dest->fd,":%s %s",this->GetServerName().c_str(),s.c_str());
+               WriteServ_NoFormat(Dest->fd,s.c_str());
        }
        else
        {