static void 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; } check_core = modlist[modindex]->core; if(unload_one_module(m_bn, true) == false) { sendto_one_notice(source_p, ":Module %s is not loaded", m_bn); rb_free(m_bn); return; } if((load_one_module(m_bn, modlist[modindex]->origin, check_core) == false) && 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); }
static void do_modunload(struct Client *source_p, const char *module) { int modindex; 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; } if(modlist[modindex]->core) { sendto_one_notice(source_p, ":Module %s is a core module and may not be unloaded", m_bn); rb_free(m_bn); return; } if(unload_one_module(m_bn, true) == false) sendto_one_notice(source_p, ":Module %s is not loaded", m_bn); rb_free(m_bn); }
/*! \brief UNLOAD subcommand handler * Attempts to unload a module, throwing an error if * the module could not be found * \param source_p Pointer to client issuing the command * \param arg Additional argument which might be needed by this handler */ static void module_unload(struct Client *source_p, const char *arg) { const char *m_bn = NULL; const struct module *modp = NULL; if ((modp = findmodule_byname((m_bn = libio_basename(arg)))) == NULL) { sendto_one_notice(source_p, &me, ":Module %s is not loaded", m_bn); return; } if (modp->flags & MODULE_FLAG_CORE) { sendto_one_notice(source_p, &me, ":Module %s is a core module and may not be unloaded", m_bn); return; } if (modp->flags & MODULE_FLAG_NOUNLOAD) { sendto_one_notice(source_p, &me, ":Module %s is a resident module and may not be unloaded", m_bn); return; } if (unload_one_module(m_bn, 1) == -1) sendto_one_notice(source_p, &me, ":Module %s is not loaded", m_bn); }
/*! \brief LOAD subcommand handler * Attempts to load a module, throwing an error if * the module has already been loaded * \param source_p Pointer to client issuing the command * \param arg Additional argument which might be needed by this handler */ static void module_load(struct Client *source_p, const char *arg) { const char *m_bn = NULL; if (findmodule_byname((m_bn = libio_basename(arg)))) { sendto_one_notice(source_p, &me, ":Module %s is already loaded", m_bn); return; } load_one_module(arg); }
static void do_modload(struct Client *source_p, const char *module) { char *m_bn = rb_basename(module); int origin; if(findmodule_byname(m_bn) != -1) { sendto_one_notice(source_p, ":Module %s is already loaded", m_bn); rb_free(m_bn); return; } origin = strcmp(module, m_bn) == 0 ? MAPI_ORIGIN_CORE : MAPI_ORIGIN_EXTENSION; load_one_module(module, origin, false); rb_free(m_bn); }