-static int
-do_modreload(struct Client *source_p, const char *module)
-{
- int modindex;
- int check_core;
- char *m_bn = rb_basename(module);
-
- 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_NETWIDE,
- "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 MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
-{
- if(!IsOperAdmin(source_p))
- {
- sendto_one(source_p, form_str(ERR_NOPRIVS),
- me.name, source_p->name, "admin");
- return 0;
- }
-
- if(parc > 2)
- {
- sendto_match_servs(source_p, parv[2], CAP_ENCAP, NOCAPS,
- "ENCAP %s MODLIST %s", parv[2], parv[1]);
- if (match(parv[2], me.name) == 0)
- return 0;
- }
-
- return do_modlist(source_p, parc > 1 ? parv[1] : 0);
-}
-
-static int
-me_modlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
-{
- if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
- {
- sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
- "to load modules on this server.");
- return 0;
- }
-
- return do_modlist(source_p, parv[1]);
-}
-
-static int
-do_modlist(struct Client *source_p, const char *pattern)
-{
- int i;
-
- for (i = 0; i < num_mods; i++)
- {
- if(pattern)
- {
- if(match(pattern, 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 MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
-{
- if(!IsOperAdmin(source_p))
- {
- sendto_one(source_p, form_str(ERR_NOPRIVS),
- me.name, source_p->name, "admin");
- return 0;
- }
-
- if(parc > 1)
- {
- sendto_match_servs(source_p, parv[1], CAP_ENCAP, NOCAPS,
- "ENCAP %s MODRESTART", parv[1]);
- if (match(parv[1], me.name) == 0)
- return 0;
- }
-
- return do_modrestart(source_p);
-}
-
-static int
-me_modrestart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
-{
- if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
- {
- sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
- "to load modules on this server.");
- return 0;
- }
-
- return do_modrestart(source_p);
-}
-
-static int
-do_modrestart(struct Client *source_p)
-{
- int modnum;
-
- sendto_one_notice(source_p, ":Reloading all modules");
-
- modnum = num_mods;
- while (num_mods)
- unload_one_module(modlist[0]->name, 0);
-
- load_all_modules(0);
- load_core_modules(0);
- rehash(0);
-
- sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
- "Module Restart: %d modules unloaded, %d modules loaded",
- modnum, num_mods);
- ilog(L_MAIN, "Module Restart: %d modules unloaded, %d modules loaded", modnum, num_mods);
- return 0;
-}
-
-
-static void increase_modlist(void);
-
-#define MODS_INCREMENT 10
-