}
}
+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());
void Server::AddCommand(command_t *f)
{
- ServerInstance->Parser->CreateCommand(f);
+ if (!ServerInstance->Parser->CreateCommand(f))
+ {
+ ModuleException err("Command "+std::string(f->command)+" already exists.");
+ throw (err);
+ }
}
void Server::SendMode(char **parameters, int pcnt, userrec *user)
{
if (type == MT_SERVER)
{
- log(DEBUG,"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion");
+ ModuleException e("Modes of type MT_SERVER are reserved for future expansion");
+ throw(e);
return false;
}
if (((params_when_on>0) || (params_when_off>0)) && (type == MT_CLIENT))
{
- log(DEBUG,"*** API ERROR *** Parameters on MT_CLIENT modes are not supported");
+ ModuleException e("Parameters on MT_CLIENT modes are not supported");
+ throw(e);
return false;
}
if ((params_when_on>1) || (params_when_off>1))
{
- log(DEBUG,"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported");
+ ModuleException e("More than one parameter for an MT_CHANNEL mode is not yet supported");
+ throw(e);
return false;
}
return DoAddExtendedMode(modechar,type,requires_oper,params_when_on,params_when_off);
}
else
{
- log(DEBUG,"*** API ERROR *** Muppet modechar detected.");
+ ModuleException e("Muppet modechar detected.");
+ throw(e);
}
return false;
}