]> jfr.im git - solanum.git/blobdiff - modules/core/m_modules.c
Remove shared blocks
[solanum.git] / modules / core / m_modules.c
index ecc54b2d0601f767ad2c23256913838c3293af32..51f453a09e345aabbda59410c71740645b9cd9c5 100644 (file)
@@ -54,6 +54,7 @@ static void do_modreload(struct Client *, const char *);
 static void do_modlist(struct Client *, const char *);
 static void do_modrestart(struct Client *);
 
+extern void modules_do_reload(void *); /* end of ircd/modules.c */
 extern void modules_do_restart(void *); /* end of ircd/modules.c */
 
 struct Message modload_msgtab = {
@@ -110,13 +111,6 @@ mo_modload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
 static void
 me_modload(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;
-       }
-
        do_modload(source_p, parv[1]);
 }
 
@@ -146,13 +140,6 @@ mo_modunload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
 static void
 me_modunload(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;
-       }
-
        do_modunload(source_p, parv[1]);
 }
 
@@ -181,13 +168,6 @@ mo_modreload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
 static void
 me_modreload(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;
-       }
-
        do_modreload(source_p, parv[1]);
 }
 
@@ -216,13 +196,6 @@ mo_modlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
 static void
 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;
-       }
-
        do_modlist(source_p, parv[1]);
 }
 
@@ -251,13 +224,6 @@ mo_modrestart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *s
 static void
 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;
-       }
-
        do_modrestart(source_p);
 }
 
@@ -317,39 +283,10 @@ do_modunload(struct Client *source_p, const char *module)
 static void
 do_modreload(struct Client *source_p, const char *module)
 {
-       struct module *mod;
-       int check_core;
-       char *m_bn = rb_basename(module);
-
-       if((mod = findmodule_byname(m_bn)) == NULL)
-       {
-               sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
-               rb_free(m_bn);
-               return;
-       }
-
-       check_core = mod->core;
-
-       mod_remember_clicaps();
-
-       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, mod->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);
-       }
-
-       mod_notify_clicaps();
-
-       rb_free(m_bn);
+       struct modreload *info = rb_malloc(sizeof *info);
+       strcpy(info->module, module);
+       strcpy(info->id, source_p->id);
+       rb_event_addonce("modules_do_reload", modules_do_reload, info, 1);
 }
 
 static void