]> jfr.im git - solanum.git/blobdiff - src/bandbi.c
Merge pull request #53 from ShadowNinja/clarify_U+R
[solanum.git] / src / bandbi.c
index 4de44225306518a1c57e9b24f649b0d093867c9d..8b05b0f076d1d72cf4af8ba7b9f0b7b0c82c403e 100644 (file)
@@ -46,6 +46,7 @@
 #include "send.h"
 #include "ircd.h"
 #include "msg.h"       /* XXX: MAXPARA */
+#include "operhash.h"
 
 static char bandb_add_letter[LAST_BANDB_TYPE] = {
        'K', 'D', 'X', 'R'
@@ -81,10 +82,10 @@ start_bandb(void)
        const char *suffix = "";
 #endif
 
-       rb_setenv("BANDB_DPATH", ConfigFileEntry.dpath, 1);
+       rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1);
        if(bandb_path == NULL)
        {
-               rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", BINPATH, suffix);
+               rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix);
 
                if(access(fullpath, X_OK) == -1)
                {
@@ -94,8 +95,8 @@ start_bandb(void)
                        if(access(fullpath, X_OK) == -1)
                        {
                                ilog(L_MAIN,
-                                    "Unable to execute bandb in %s or %s/bin",
-                                    BINPATH, ConfigFileEntry.dpath);
+                                    "Unable to execute bandb%s in %s or %s/bin",
+                                    suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath);
                                return 0;
                        }
                }
@@ -121,6 +122,9 @@ void
 bandb_add(bandb_type type, struct Client *source_p, const char *mask1,
          const char *mask2, const char *reason, const char *oper_reason, int perm)
 {
+       if(bandb_helper == NULL)
+               return;
+
        static char buf[BUFSIZE];
 
        rb_snprintf(buf, sizeof(buf), "%c %s ", bandb_add_letter[type], mask1);
@@ -144,6 +148,9 @@ static char bandb_del_letter[LAST_BANDB_TYPE] = {
 void
 bandb_del(bandb_type type, const char *mask1, const char *mask2)
 {
+       if(bandb_helper == NULL)
+               return;
+
        static char buf[BUFSIZE];
 
        buf[0] = '\0';
@@ -170,8 +177,7 @@ bandb_handle_ban(char *parv[], int parc)
                aconf->user = rb_strdup(parv[para++]);
 
        aconf->host = rb_strdup(parv[para++]);
-       /* We do not have the 'oper' field yet. */
-       para++;
+       aconf->info.oper = operhash_add(parv[para++]);
 
        switch (parv[0][0])
        {
@@ -384,7 +390,7 @@ bandb_handle_failure(rb_helper *helper, char **parv, int parc)
 {
        if(server_state_foreground)
                fprintf(stderr, "bandb - bandb failure: %s\n", parv[1]);
-       
+
        ilog(L_MAIN, "bandb - bandb failure: %s", parv[1]);
        sendto_realops_snomask(SNO_GENERAL, L_ALL, "bandb - bandb failure: %s", parv[1]);
        exit(1);