- return -1;
-}
-
-
-/* load a module .. */
-static int
-mo_modload(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
-{
- char *m_bn;
-
- if(!IsOperAdmin(source_p))
- {
- sendto_one(source_p, form_str(ERR_NOPRIVS),
- me.name, source_p->name, "admin");
- return 0;
- }
-
- m_bn = rb_basename(parv[1]);
-
- if(findmodule_byname(m_bn) != -1)
- {
- sendto_one_notice(source_p, ":Module %s is already loaded", m_bn);
- rb_free(m_bn);
- return 0;
- }
-
- load_one_module(parv[1], 0);
-
- rb_free(m_bn);
-
- return 0;
-}
-
-
-/* unload a module .. */
-static int
-mo_modunload(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
-{
- char *m_bn;
- int modindex;
-
- if(!IsOperAdmin(source_p))
- {
- sendto_one(source_p, form_str(ERR_NOPRIVS),
- me.name, source_p->name, "admin");
- return 0;
- }
-
- m_bn = rb_basename(parv[1]);
-
- if((modindex = findmodule_byname(m_bn)) == -1)
- {
- sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
- rb_free(m_bn);
- return 0;
- }
-
- if(modlist[modindex]->core == 1)
- {
- sendto_one_notice(source_p, ":Module %s is a core module and may not be unloaded", m_bn);
- rb_free(m_bn);
- return 0;
- }
-
- if(unload_one_module(m_bn, 1) == -1)
- {
- sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
- }
-
- rb_free(m_bn);
- return 0;
-}
-
-/* unload and load in one! */
-static int
-mo_modreload(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
-{
- char *m_bn;
- int modindex;
- int check_core;
-
- if(!IsOperAdmin(source_p))
- {
- sendto_one(source_p, form_str(ERR_NOPRIVS),
- me.name, source_p->name, "admin");
- return 0;
- }
-
- m_bn = rb_basename(parv[1]);
-
- if((modindex = findmodule_byname(m_bn)) == -1)
- {
- sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
- rb_free(m_bn);
- return 0;
- }
-
- check_core = modlist[modindex]->core;
-
- if(unload_one_module(m_bn, 1) == -1)
- {
- sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
- rb_free(m_bn);
- return 0;
- }
-
- if((load_one_module(m_bn, check_core) == -1) && check_core)
- {
- sendto_realops_snomask(SNO_GENERAL, L_ALL,
- "Error reloading core module: %s: terminating ircd", m_bn);
- ilog(L_MAIN, "Error loading core module %s: terminating ircd", m_bn);
- exit(0);
- }
-
- rb_free(m_bn);
- return 0;
-}
-
-/* list modules .. */
-static int
-mo_modlist(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
-{
- int i;
-
- if(!IsOperAdmin(source_p))
- {
- sendto_one(source_p, form_str(ERR_NOPRIVS),
- me.name, source_p->name, "admin");
- return 0;
- }
-
- for (i = 0; i < num_mods; i++)
- {
- if(parc > 1)
- {
- if(match(parv[1], modlist[i]->name))
- {
- sendto_one(source_p, form_str(RPL_MODLIST),
- me.name, source_p->name,
- modlist[i]->name,
- (unsigned long)(uintptr_t)modlist[i]->address,
- modlist[i]->version, modlist[i]->core ? "(core)" : "");
- }
- }
- else
- {
- sendto_one(source_p, form_str(RPL_MODLIST),
- me.name, source_p->name, modlist[i]->name,
- (unsigned long)(uintptr_t)modlist[i]->address,
- modlist[i]->version,
- modlist[i]->core ? "(core)" : "");
- }
- }
-
- sendto_one(source_p, form_str(RPL_ENDOFMODLIST), me.name, source_p->name);
- return 0;
-}
-
-/* unload and reload all modules */
-static int
-mo_modrestart(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
-{
- int modnum;
-
- if(!IsOperAdmin(source_p))
- {
- sendto_one(source_p, form_str(ERR_NOPRIVS),
- me.name, source_p->name, "admin");
- return 0;
- }
-
- sendto_one_notice(source_p, ":Reloading all modules");
-
- modnum = num_mods;
- while (num_mods)
- unload_one_module(modlist[0]->name, 0);