Explorar el Código

* Added chanint closed-ban. (Bans non-users who join +closed chans)

svn: 350
Bryan Drewery hace 22 años
padre
commit
e5fcea664c

+ 1 - 1
pack/conf.h

@@ -10,7 +10,7 @@
 
 /*      S_FEATURE	  RECOMMENDED	DESCRIPTION 					*/
 #define S_ANTITRACE	/*  yes		ptrace detection 				*/
-#define S_AUTH		/*  yes		authorization system (HIGHLY RECOMMENDED)	*/
+#undef S_AUTH		/*  yes		authorization system (HIGHLY RECOMMENDED)	*/
 #define S_AUTOAWAY	/*  yes		random autoaway/return on IRC 			*/
 #define S_AUTOLOCK      /*  yes         will lock channels upon certain coniditions     */
 #define S_DCCPASS	/*  yes		DCC command passwords 				*/

+ 1 - 0
src/chan.h

@@ -147,6 +147,7 @@ struct chanset_t {
   int status;
   int ircnet_status;
   int limitraise;
+  int closed_ban;
 /* Chanint template 
  *int temp;
  */

+ 3 - 1
src/chanprog.c

@@ -893,7 +893,9 @@ Context;
       strcat(buf, "*");
     strcat(buf, " ");
     strcat(buf, options);
-    putallbots(buf);
+    buf[strlen(buf)] = 0;
+    putlog(LOG_DEBUG, "*", "sending out cset: %s", buf);
+    putallbots(buf); 
     nfree(buf);
   }
   /* now set locally, hopefully it works */

+ 5 - 1
src/mod/channels.mod/channels.c

@@ -110,13 +110,17 @@ static void got_cset(char *botnick, char *code, char *par)
   char *chname = NULL;
   struct chanset_t *chan = NULL;
 
-  if (!par[0])
+  if (!par || !par[0])
    return;
   else {
    if (par[0] == '*' && par[1] == ' ') {
     all = 1;
     newsplit(&par);
    } else {
+    if (!strchr(CHANMETA, par[0])) {
+      putlog(LOG_ERROR, "*", "Got bad cset: bot: %s code: %s par: %s\n", botnick, code, par);
+      return;
+    }
     chname = newsplit(&par);
     if (!(chan = findchan_by_dname(chname)))
       return;

+ 7 - 3
src/mod/channels.mod/cmdschan.c

@@ -1543,16 +1543,20 @@ static void cmd_chaninfo(struct userrec *u, int idx, char *par)
       dprintf(idx, "revenge-mode: %d\n", chan->revenge_mode);
     else
       dprintf(idx, "revenge-mode: 0\n");
-    if (chan->ban_time)
-      dprintf(idx, "ban-time: %d\n", chan->ban_time);
+    if (chan->closed_ban)
+      dprintf(idx, "closed-ban: %d", chan->closed_ban);
     else
-      dprintf(idx, "ban-time: 0\n");
+      dprintf(idx, "closed-ban: 0\n");
 /* Chanint template
  *  if (chan->temp)
  *   dprintf(idx, "temp: %d\n", chan->temp);
  * else
  *   dprintf(idx, temp: 0\n");
  */
+    if (chan->ban_time)
+      dprintf(idx, "ban-time: %d\n", chan->ban_time);
+    else
+      dprintf(idx, "ban-time: 0\n");
     if (chan->exempt_time)
       dprintf(idx, "exempt-time: %d\n", chan->exempt_time);
     else

+ 13 - 1
src/mod/channels.mod/tclchan.c

@@ -38,6 +38,8 @@ static int tcl_channel_info(Tcl_Interp * irp, struct chanset_t *chan)
   Tcl_AppendElement(irp, s);
   simple_sprintf(s, "%d", chan->ban_time);
   Tcl_AppendElement(irp, s);
+  simple_sprintf(s, "%s", chan->closed_ban);
+  Tcl_AppendElement(irp, s);
 /* Chanint template 
  *simple_sprintf(s, "%s", chan->temp);
  *Tcl_AppendElement(irp, s);
@@ -195,6 +197,7 @@ static int tcl_channel_get(Tcl_Interp * irp, struct chanset_t *chan, char *setti
 /* Chanint template
  *else if (CHECK("temp"))	   simple_sprintf(s, "%s", chan->temp);
  */
+  else if (CHECK("closed-ban"))    simple_sprintf(s, "%d", chan->closed_ban);
   else if (CHECK("ban-time"))  	   simple_sprintf(s, "%d", chan->ban_time);
   else if (CHECK("exempt-time"))   simple_sprintf(s, "%d", chan->exempt_time);
   else if (CHECK("invite-time"))   simple_sprintf(s, "%d", chan->invite_time);
@@ -402,6 +405,14 @@ Context;
         return TCL_ERROR;
       }
       chan->invite_time = atoi(item[i]);
+    } else if (!strcmp(item[i], "closed-ban")) {
+      i++;
+      if (i >= items) {
+        if (irp)
+          Tcl_AppendResult(irp, "channel closed-ban needs argument", NULL);
+        return TCL_ERROR;
+      }
+      chan->closed_ban = atoi(item[i]);
 /* Chanint template
  *  } else if (!strcmp(item[i], "temp")) {
  *    i++;
@@ -920,9 +931,10 @@ static int tcl_channel_add(Tcl_Interp *irp, char *newname, char *options)
 
     /* Hells bells, why set *every* variable to 0 when we have bzero? */
     egg_bzero(chan, sizeof(struct chanset_t));
-
+    /* These are defaults, bzero already set them 0, but we set them for future reference */
     chan->limit_prot = 0;
     chan->limit = 0;
+    chan->closed_ban = 0;
 /* Chanint template
  *  chan->temp = 0;
  */

+ 2 - 0
src/mod/channels.mod/userchan.c

@@ -1325,6 +1325,7 @@ static int write_chans(FILE *f, int idx)
 revenge-mode %d \
 flood-chan %d:%d flood-ctcp %d:%d flood-join %d:%d \
 flood-kick %d:%d flood-deop %d:%d flood-nick %d:%d \
+closed-ban %d \
 ban-time %d exempt-time %d invite-time %d \
 %cenforcebans %cdynamicbans %cuserbans %cbitch \
 %cprotectops %crevenge %crevengebot \
@@ -1350,6 +1351,7 @@ ban-time %d exempt-time %d invite-time %d \
         chan->flood_kick_thr, chan->flood_kick_time,
         chan->flood_deop_thr, chan->flood_deop_time,
 	chan->flood_nick_thr, chan->flood_nick_time,
+        chan->closed_ban,
 /* Chanint template
  *      chan->temp,
  * also include temp %d in dprintf

+ 1 - 0
src/mod/irc.mod/irc.h

@@ -43,6 +43,7 @@ static void maybe_revenge(struct chanset_t *, char *, char *, int);
 static int detect_chan_flood(char *, char *, char *, struct chanset_t *, int,
 			     char *);
 static void newmask(masklist *, char *, char *);
+static void doban(struct chanset_t *, memberlist *);
 static char *quickban(struct chanset_t *, char *);
 static void got_op(struct chanset_t *chan, char *nick, char *from, char *who,
  		   struct userrec *opu, struct flag_record *opper);