Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Sun, 16 Apr 2000 05:12:02 +0000 (05:12 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Sun, 16 Apr 2000 05:12:02 +0000 (05:12 +0000)
Log message:

make jupe_add() use a flags argument; add flags arguments (and pass
appropriate values) to jupe/gline_activate/deactivate for future expansion
(local activations and deactivations for global glines)

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@183 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/gline.h
include/jupe.h
ircd/gline.c
ircd/jupe.c
ircd/m_gline.c
ircd/m_jupe.c

index 9f43dd7c7f4403e202ea88a2b14531fd4493eca3..074c5ca2d1636eaac8c84750f028fbc326e89405 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2000-04-16  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/gline.c: add flags argument to gline_activate and
+       gline_deactivate for future expansion
+
+       * ircd/m_gline.c: pass flags to gline_activate and
+       gline_deactivate
+
+       * include/gline.h: add flags argument to gline_activate and
+       gline_deactivate
+
+       * ircd/jupe.c: add flags argument to jupe_activate and
+       jupe_deactivate for future expansion
+
+       * include/jupe.h: add flags argument to jupe_activate and
+       jupe_deactivate
+
+       * ircd/m_jupe.c: pass a flags argument to jupe_add instead of
+       local, active; pass flags to jupe_activate and jupe_deactivate
+
+       * include/gline.h: remove dead code
+
        * ircd/gline.c: make gline expire times relative to CurrentTime,
        since that should be monotonically increasing, instead of
        TStime(), which can be set backwards, and which can therefore
 #
 # ChangeLog for ircu2.10.11
 #
-# $Id: ChangeLog,v 1.90 2000-04-16 04:30:42 kev Exp $
+# $Id: ChangeLog,v 1.91 2000-04-16 05:12:01 kev Exp $
 #
 # Insert new changes at beginning of the change list.
 #
index 88f16e3a0d3a1245c398c71abe5c0820b00b28eb..7763063eadc4320054674ebb940bd3384e0c0c67 100644 (file)
@@ -70,9 +70,11 @@ extern int gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
                     char *reason, time_t expire, time_t lastmod,
                     unsigned int flags);
 extern int gline_activate(struct Client *cptr, struct Client *sptr,
-                         struct Gline *gline, time_t lastmod);
+                         struct Gline *gline, time_t lastmod,
+                         unsigned int flags);
 extern int gline_deactivate(struct Client *cptr, struct Client *sptr,
-                           struct Gline *gline, time_t lastmod);
+                           struct Gline *gline, time_t lastmod,
+                           unsigned int flags);
 extern struct Gline *gline_find(char *userhost, unsigned int flags);
 extern struct Gline *gline_lookup(struct Client *cptr);
 extern void gline_free(struct Gline *gline);
@@ -81,29 +83,4 @@ extern int gline_resend(struct Client *cptr, struct Gline *gline);
 extern int gline_list(struct Client *sptr, char *userhost);
 extern void gline_stats(struct Client *sptr);
 
-#if 0 /* forget it! */
-#define SetActive(g)        ((g)->gl_flags |= GLINE_ACTIVE)
-#define ClearActive(g)      ((g)->gl_flags &= ~GLINE_ACTIVE)
-#define SetGlineIsIpMask(g) ((g)->gl_flags |= GLINE_IPMASK)
-#define SetGlineIsLocal(g)  ((g)->gl_flags |= GLINE_LOCAL)
-
-extern struct Gline* GlobalGlineList;
-extern struct Gline* BadChanGlineList;
-
-extern void gline_remove_expired(time_t now);
-
-extern void add_gline(struct Client *sptr, int ip_mask,
-                      char *host, char *comment, char *user,
-                      time_t expire, int local);
-extern struct Gline* make_gline(int is_ipmask, char *host, char *reason,
-                                char *name, time_t expire);
-extern struct Gline* find_gline(struct Client *cptr, struct Gline **pgline);
-extern void free_gline(struct Gline *gline, struct Gline *prev);
-
-#ifdef BADCHAN
-extern int bad_channel(const char* name);
-extern void bad_channel_remove_expired(time_t now);
-#endif
-#endif /* 0 */
-
 #endif /* INCLUDED_gline_h */
index 5c0cf7a9e87cd8144b5e7fd58da6a4801d2536fe..4aeda46fd942611e9f1c8a9c5c48fe093c410c78 100644 (file)
@@ -56,12 +56,14 @@ struct Jupe {
 #define JupeLastMod(j)         ((j)->ju_lastmod)
 
 extern int jupe_add(struct Client *cptr, struct Client *sptr, char *server,
-                   char *reason, time_t expire, time_t lastmod, int local,
-                   int active);
+                   char *reason, time_t expire, time_t lastmod,
+                   unsigned int flags);
 extern int jupe_activate(struct Client *cptr, struct Client *sptr,
-                        struct Jupe *jupe, time_t lastmod);
+                        struct Jupe *jupe, time_t lastmod,
+                        unsigned int flags);
 extern int jupe_deactivate(struct Client *cptr, struct Client *sptr,
-                          struct Jupe *jupe, time_t lastmod);
+                          struct Jupe *jupe, time_t lastmod,
+                          unsigned int flags);
 extern struct Jupe* jupe_find(char *server);
 extern void jupe_free(struct Jupe *jupe);
 extern void jupe_burst(struct Client *cptr);
index 3ebc8ea21fd1e7fbca9dae3213305f99e3d62af2..f1ea9c26996a0e849c88009925c5cdbddb56cc6d 100644 (file)
@@ -242,7 +242,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
 
 int
 gline_activate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
-              time_t lastmod)
+              time_t lastmod, unsigned int flags)
 {
   assert(0 != gline);
   assert(!GlineIsLocal(gline));
@@ -288,7 +288,7 @@ gline_activate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
 
 int
 gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
-                time_t lastmod)
+                time_t lastmod, unsigned int flags)
 {
   assert(0 != gline);
 
index ae2d7c8321535bba4d6c64a86cb0ee45731208ab..61db6cb897d68d8137bf610435bac1ca4ca35865 100644 (file)
@@ -97,10 +97,9 @@ propagate_jupe(struct Client *cptr, struct Client *sptr, struct Jupe *jupe)
 
 int
 jupe_add(struct Client *cptr, struct Client *sptr, char *server, char *reason,
-        time_t expire, time_t lastmod, int local, int active)
+        time_t expire, time_t lastmod, unsigned int flags)
 {
   struct Jupe *ajupe;
-  unsigned int flags = 0;
 
   assert(0 != server);
   assert(0 != reason);
@@ -121,25 +120,22 @@ jupe_add(struct Client *cptr, struct Client *sptr, char *server, char *reason,
     sendto_op_mask(SNO_NETWORK, "%s adding %sJUPE for %s, expiring at "
                   TIME_T_FMT ": %s",
                   IsServer(sptr) ? sptr->name : sptr->user->server->name,
-                  local ? "local " : "", server, expire + TSoffset, reason);
+                  flags & JUPE_LOCAL ? "local " : "", server,
+                  expire + TSoffset, reason);
 
 #ifdef JPATH
   if (IsServer(sptr))
     write_log(JPATH, TIME_T_FMT " %s adding %sJUPE for %s, expiring at "
              TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             local ? "local " : "", server, expire + TSoffset, reason);
+             flags & JUPE_LOCAL ? "local " : "", server, expire + TSoffset,
+             reason);
   else
     write_log(JPATH, TIME_T_FMT, " %s!%s@%s adding %sJUPE for %s, expiring at "
              TIME_T_FMT ": %s\n", TStime(), sptr->name, sptr->user->username,
-             sptr->user->host, local ? "local " : "", server,
+             sptr->user->host, flags & JUPE_LOCAL ? "local " : "", server,
              expire + TSoffset, reason);
 #endif /* JPATH */
 
-  if (active) /* compute initial flags */
-    flags |= JUPE_ACTIVE;
-  if (local)
-    flags |= JUPE_LOCAL;
-
   /* make the jupe */
   ajupe = make_jupe(server, reason, expire, lastmod, flags);
 
@@ -150,7 +146,7 @@ jupe_add(struct Client *cptr, struct Client *sptr, char *server, char *reason,
 
 int
 jupe_activate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
-             time_t lastmod)
+             time_t lastmod, unsigned int flags)
 {
   assert(0 != jupe);
   assert(!JupeIsLocal(jupe));
@@ -187,7 +183,7 @@ jupe_activate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
 
 int
 jupe_deactivate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
-               time_t lastmod)
+               time_t lastmod, unsigned int flags)
 {
   assert(0 != jupe);
 
index 7d1c69535dcccf8025ab48dfe59c2b6d3e3fb22c..6c5251667f379a3030bb60d4d22d7494387a1c68 100644 (file)
@@ -180,9 +180,9 @@ ms_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
       gline_free(agline);
     else if (!lastmod || GlineLastMod(agline) < lastmod) { /* new mod */
       if (flags & GLINE_ACTIVE)
-       return gline_activate(cptr, sptr, agline, lastmod);
+       return gline_activate(cptr, sptr, agline, lastmod, flags);
       else
-       return gline_deactivate(cptr, sptr, agline, lastmod);
+       return gline_deactivate(cptr, sptr, agline, lastmod, flags);
     } else if (GlineLastMod(agline) == lastmod)
       return 0;
     else
@@ -281,10 +281,10 @@ mo_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     else {
       if (flags & GLINE_ACTIVE)
        return gline_activate(cptr, sptr, agline,
-                             GlineLastMod(agline) ? TStime() : 0);
+                             GlineLastMod(agline) ? TStime() : 0, flags);
       else
        return gline_deactivate(cptr, sptr, agline,
-                               GlineLastMod(agline) ? TStime() : 0);
+                               GlineLastMod(agline) ? TStime() : 0, flags);
     }
   }
 
index fb606d9dc6317f35204a1852c871485d48573b43..3dbfba51bcd6772671d131e06433e8d91bd0a5df 100644 (file)
@@ -125,7 +125,7 @@ int ms_jupe(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   struct Client *acptr = 0;
   struct Jupe *ajupe;
-  int local = 0, active = 1;
+  unsigned int flags = 0;
   time_t expire_off, lastmod;
   char *server = parv[2], *target = parv[1], *reason = parv[5];
 
@@ -142,14 +142,13 @@ int ms_jupe(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       return 0;
     }
 
-    local = 1;
+    flags |= JUPE_LOCAL;
   }
 
-  if (*server == '-') {
-    active = 0;
+  if (*server == '-')
     server++;
-  else if (*server == '+') {
-    active = 1;
+  else if (*server == '+') {
+    flags |= JUPE_ACTIVE;
     server++;
   }
 
@@ -159,21 +158,20 @@ int ms_jupe(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   ajupe = jupe_find(server);
 
   if (ajupe) {
-    if (JupeIsLocal(ajupe) && !local) /* global jupes override local ones */
+    if (JupeIsLocal(ajupe) && !(flags & JUPE_LOCAL)) /* global over local */
       jupe_free(ajupe);
     else if (JupeLastMod(ajupe) < lastmod) { /* new modification */
-      if (active)
-       return jupe_activate(cptr, sptr, ajupe, lastmod);
+      if (flags & JUPE_ACTIVE)
+       return jupe_activate(cptr, sptr, ajupe, lastmod, flags);
       else
-       return jupe_deactivate(cptr, sptr, ajupe, lastmod);
+       return jupe_deactivate(cptr, sptr, ajupe, lastmod, flags);
     } else if (JupeLastMod(ajupe) == lastmod) /* no changes */
       return 0;
     else
       return jupe_resend(cptr, ajupe); /* other server desynched WRT jupes */
   }
 
-  return jupe_add(cptr, sptr, server, reason, expire_off, lastmod, local,
-                 active);
+  return jupe_add(cptr, sptr, server, reason, expire_off, lastmod, flags);
 }
 
 /*
@@ -194,7 +192,7 @@ int mo_jupe(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   struct Client *acptr = 0;
   struct Jupe *ajupe;
-  int local = 0, active = 1;
+  unsigned int flags = 0;
   time_t expire_off;
   char *server = parv[1], *target = parv[2], *reason = parv[4];
 
@@ -202,12 +200,11 @@ int mo_jupe(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     return jupe_list(sptr, 0);
 
   if (*server == '+') {
-    active = 1;
+    flags |= JUPE_ACTIVE;
     server++;
-  } else if (*server == '-') {
-    active = 0;
+  } else if (*server == '-')
     server++;
-  else
+  else
     return jupe_list(sptr, server);
 
   if (parc < 5)
@@ -222,11 +219,12 @@ int mo_jupe(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
        return send_error_to_client(sptr, ERR_NOPRIVILEGES);
 
       sendcmdto_one(acptr, CMD_JUPE, sptr, "%C %c%s %s %Tu :%s", acptr,
-                   active ? '+' : '-', server, parv[3], TStime(), reason);
+                   flags & JUPE_ACTIVE ? '+' : '-', server, parv[3],
+                   TStime(), reason);
       return 0;
     }
 
-    local = 1;
+    flags |= JUPE_LOCAL;
   } else if (!IsOper(sptr))
     return send_error_to_client(sptr, ERR_NOPRIVILEGES);
 
@@ -235,18 +233,17 @@ int mo_jupe(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   ajupe = jupe_find(server);
 
   if (ajupe) {
-    if (JupeIsLocal(ajupe) && !local) /* global jupes override local ones */
+    if (JupeIsLocal(ajupe) && !(flags & JUPE_LOCAL)) /* global over local */
       jupe_free(ajupe);
     else {
-      if (active)
-       return jupe_activate(cptr, sptr, ajupe, TStime());
+      if (flags & JUPE_ACTIVE)
+       return jupe_activate(cptr, sptr, ajupe, TStime(), flags);
       else
-       return jupe_deactivate(cptr, sptr, ajupe, TStime());
+       return jupe_deactivate(cptr, sptr, ajupe, TStime(), flags);
     }
   }
 
-  return jupe_add(cptr, sptr, server, reason, expire_off, TStime(), local,
-                 active);
+  return jupe_add(cptr, sptr, server, reason, expire_off, TStime(), flags);
 }
 #endif /* CONFIG_OPERCMDS */