]> jfr.im git - solanum.git/blobdiff - ircd/hostmask.c
Refactor clear_out_address_conf*
[solanum.git] / ircd / hostmask.c
index 67d26b51c7d74e68a408820c89bb3d01a41602d8..1a154130d24a63d6383fc88a3cfd1172cb4225e1 100644 (file)
@@ -631,7 +631,7 @@ delete_one_address_conf(const char *address, struct ConfItem *aconf)
  *               them, otherwise sets them as illegal.
  */
 void
-clear_out_address_conf(void)
+clear_out_address_conf(enum aconf_category clear_type)
 {
        int i;
        struct AddressRec **store_next;
@@ -642,44 +642,17 @@ clear_out_address_conf(void)
                store_next = &atable[i];
                for (arec = atable[i]; arec; arec = arecn)
                {
+                       enum aconf_category cur_type;
                        arecn = arec->next;
-                       /* We keep the temporary K-lines and destroy the
-                        * permanent ones, just to be confusing :) -A1kmm */
-                       if(arec->aconf->flags & CONF_FLAGS_TEMPORARY ||
-                          (arec->type != CONF_CLIENT && arec->type != CONF_EXEMPTDLINE && arec->type != CONF_SECURE))
-                       {
-                               *store_next = arec;
-                               store_next = &arec->next;
-                       }
-                       else
-                       {
-                               arec->aconf->status |= CONF_ILLEGAL;
-                               if(!arec->aconf->clients)
-                                       free_conf(arec->aconf);
-                               rb_free(arec);
-                       }
-               }
-               *store_next = NULL;
-       }
-}
 
-void
-clear_out_address_conf_bans(void)
-{
-       int i;
-       struct AddressRec **store_next;
-       struct AddressRec *arec, *arecn;
+                       if (arec->type == CONF_CLIENT || arec->type == CONF_EXEMPTDLINE || arec->type == CONF_SECURE)
+                               cur_type = AC_CONFIG;
+                       else
+                               cur_type = AC_BANDB;
 
-       for (i = 0; i < ATABLE_SIZE; i++)
-       {
-               store_next = &atable[i];
-               for (arec = atable[i]; arec; arec = arecn)
-               {
-                       arecn = arec->next;
                        /* We keep the temporary K-lines and destroy the
                         * permanent ones, just to be confusing :) -A1kmm */
-                       if(arec->aconf->flags & CONF_FLAGS_TEMPORARY ||
-                          (arec->type == CONF_CLIENT || arec->type == CONF_EXEMPTDLINE || arec->type == CONF_SECURE))
+                       if (arec->aconf->flags & CONF_FLAGS_TEMPORARY || cur_type != clear_type)
                        {
                                *store_next = arec;
                                store_next = &arec->next;
@@ -696,7 +669,6 @@ clear_out_address_conf_bans(void)
        }
 }
 
-
 /*
  * show_iline_prefix()
  *