]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/modules.c
libcharybdis includes gone.
[irc/rqf/shadowircd.git] / src / modules.c
index d03eae11276fbf819c94795a5e7352f639ff82e3..78a795b7e45297a403f0989af8ce50539825c541 100644 (file)
@@ -21,7 +21,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: modules.c 1509 2006-05-28 02:35:58Z nenolod $
+ *  $Id: modules.c 3161 2007-01-25 07:23:01Z nenolod $
  */
 
 #include "stdinc.h"
@@ -38,8 +38,6 @@
 #include "parse.h"
 #include "ircd_defs.h"
 #include "irc_string.h"
-#include "memory.h"
-#include "tools.h"
 #include "sprintf_irc.h"
 
 
@@ -80,7 +78,7 @@ static const char *core_module_table[] = {
 int num_mods = 0;
 int max_mods = MODS_INCREMENT;
 
-static dlink_list mod_paths;
+static rb_dlink_list mod_paths;
 
 static int mo_modload(struct Client *, struct Client *, int, const char **);
 static int mo_modlist(struct Client *, struct Client *, int, const char **);
@@ -138,10 +136,10 @@ modules_init(void)
 static struct module_path *
 mod_find_path(const char *path)
 {
-       dlink_node *ptr;
+       rb_dlink_node *ptr;
        struct module_path *mpath;
 
-       DLINK_FOREACH(ptr, mod_paths.head)
+       RB_DLINK_FOREACH(ptr, mod_paths.head)
        {
                mpath = ptr->data;
 
@@ -169,7 +167,7 @@ mod_add_path(const char *path)
        pathst = MyMalloc(sizeof(struct module_path));
 
        strcpy(pathst->path, path);
-       dlinkAddAlloc(pathst, &mod_paths);
+       rb_dlinkAddAlloc(pathst, &mod_paths);
 }
 
 /* mod_clear_paths()
@@ -181,12 +179,12 @@ mod_add_path(const char *path)
 void
 mod_clear_paths(void)
 {
-       dlink_node *ptr, *next_ptr;
+       rb_dlink_node *ptr, *next_ptr;
 
-       DLINK_FOREACH_SAFE(ptr, next_ptr, mod_paths.head)
+       RB_DLINK_FOREACH_SAFE(ptr, next_ptr, mod_paths.head)
        {
                MyFree(ptr->data);
-               free_dlink_node(ptr);
+               free_rb_dlink_node(ptr);
        }
 
        mod_paths.head = mod_paths.tail = NULL;
@@ -267,7 +265,7 @@ load_all_modules(int warn)
                len = strlen(ldirent->d_name);
                if((len > 3) && !strcmp(ldirent->d_name+len-3, SHARED_SUFFIX))
                 {
-                       (void) ircsnprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name);
+                       (void) rb_snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name);
                        (void) load_a_module(module_fq_name, warn, 0);
                 }
 
@@ -290,7 +288,7 @@ load_core_modules(int warn)
 
        for (i = 0; core_module_table[i]; i++)
        {
-               ircsnprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH,
+               rb_snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH,
                            core_module_table[i], SHARED_SUFFIX);
 
                if(load_a_module(module_name, warn, 1) == -1)
@@ -313,7 +311,7 @@ int
 load_one_module(const char *path, int coremodule)
 {
        char modpath[MAXPATHLEN];
-       dlink_node *pathst;
+       rb_dlink_node *pathst;
        struct module_path *mpath;
 
        struct stat statbuf;
@@ -321,11 +319,11 @@ load_one_module(const char *path, int coremodule)
        if (server_state_foreground == 1)
                inotice("loading module %s ...", path); 
 
-       DLINK_FOREACH(pathst, mod_paths.head)
+       RB_DLINK_FOREACH(pathst, mod_paths.head)
        {
                mpath = pathst->data;
 
-               ircsnprintf(modpath, sizeof(modpath), "%s/%s", mpath->path, path);
+               rb_snprintf(modpath, sizeof(modpath), "%s/%s", mpath->path, path);
                if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL))
                {
                        if(stat(modpath, &statbuf) == 0)
@@ -365,9 +363,7 @@ mo_modload(struct Client *client_p, struct Client *source_p, int parc, const cha
 
        if(findmodule_byname(m_bn) != -1)
        {
-               sendto_one(source_p,
-                          ":%s NOTICE %s :Module %s is already loaded",
-                          me.name, source_p->name, m_bn);
+               sendto_one_notice(source_p, ":Module %s is already loaded", m_bn);
                MyFree(m_bn);
                return 0;
        }
@@ -398,26 +394,23 @@ mo_modunload(struct Client *client_p, struct Client *source_p, int parc, const c
 
        if((modindex = findmodule_byname(m_bn)) == -1)
        {
-               sendto_one(source_p,
-                          ":%s NOTICE %s :Module %s is not loaded", me.name, source_p->name, m_bn);
+               sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
                MyFree(m_bn);
                return 0;
        }
 
        if(modlist[modindex]->core == 1)
        {
-               sendto_one(source_p,
-                          ":%s NOTICE %s :Module %s is a core module and may not be unloaded",
-                          me.name, source_p->name, m_bn);
+               sendto_one_notice(source_p, ":Module %s is a core module and may not be unloaded", m_bn);
                MyFree(m_bn);
                return 0;
        }
 
        if(unload_one_module(m_bn, 1) == -1)
        {
-               sendto_one(source_p,
-                          ":%s NOTICE %s :Module %s is not loaded", me.name, source_p->name, m_bn);
+               sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
        }
+
        MyFree(m_bn);
        return 0;
 }
@@ -441,8 +434,7 @@ mo_modreload(struct Client *client_p, struct Client *source_p, int parc, const c
 
        if((modindex = findmodule_byname(m_bn)) == -1)
        {
-               sendto_one(source_p,
-                          ":%s NOTICE %s :Module %s is not loaded", me.name, source_p->name, m_bn);
+               sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
                MyFree(m_bn);
                return 0;
        }
@@ -451,8 +443,7 @@ mo_modreload(struct Client *client_p, struct Client *source_p, int parc, const c
 
        if(unload_one_module(m_bn, 1) == -1)
        {
-               sendto_one(source_p,
-                          ":%s NOTICE %s :Module %s is not loaded", me.name, source_p->name, m_bn);
+               sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
                MyFree(m_bn);
                return 0;
        }
@@ -521,7 +512,7 @@ mo_modrestart(struct Client *client_p, struct Client *source_p, int parc, const
                return 0;
        }
 
-       sendto_one(source_p, ":%s NOTICE %s :Reloading all modules", me.name, parv[0]);
+       sendto_one_notice(source_p, ":Reloading all modules");
 
        modnum = num_mods;
        while (num_mods)