Explorar o código

* Added chanint closed_private

svn: 808
Bryan Drewery %!s(int64=22) %!d(string=hai) anos
pai
achega
180924de74

+ 1 - 0
doc/UPDATES

@@ -11,6 +11,7 @@ This is a summary of ChangeLog basically.
 8.Cleaned up some code here and there (small fixes).
 9.With +nomop set in a chan, a mass op will trigger enforce_bitch() now, regardless of +bitch.
 10.Now all bots check for promisc.
+11.Added chanint: closed-private. Will set +p in +closed chans.
 
 1.1.3
 1.Fixed a very fatal bug with channel ctcps.

+ 4 - 0
misc/help.txt

@@ -376,6 +376,10 @@ See also: link
         %bclosed-ban%b        Set this to 1 to ban users who join +closed 
                           channels. This is probably not needed though, as
                           +closed maintains +i.
+        %bclosed-private%b    If a channel is set +closed, the bots will
+                          enforce +p as well. The point is to notice the chan
+                          and bots when an /invite is done. This is useful in 
+                          seeing when a shell is hijacked ;)
         %bban-time%b          Set here how long temporary bans will last (in
                           minutes). If you set this setting to 0, the bot will
                           never remove them.

+ 1 - 0
src/chan.h

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

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

@@ -697,8 +697,11 @@ void channels_report(int idx, int details)
       if (!s[0])
 	strcpy(s, MISC_LURKING);
       get_mode_protect(chan, s2);
-      if (channel_closed(chan))
+      if (channel_closed(chan)) {
         strcat(s2, "i");
+        if (chan->closed_private)
+          strcat(s2, "p");
+      }
 
       if (shouldjoin(chan)) {
 	if (channel_active(chan)) {

+ 1 - 0
src/mod/channels.mod/cmdschan.c

@@ -1717,6 +1717,7 @@ static void cmd_chaninfo(struct userrec *u, int idx, char *par)
     dprintf(idx, "Channel settings:\n");
     SHOW_INT("Ban-time: ", chan->ban_time, NULL, "Forever");
     SHOW_INT("Closed-ban: ", chan->closed_ban, NULL, "Don't!");
+    SHOW_INT("Closed-Private", chan->closed_private, NULL, "Don't!");
     SHOW_INT("Exempt-time: ", chan->exempt_time, NULL, "Forever");
     SHOW_INT("Idle Kick after (idle-kick): ", chan->idle_kick, "", "Don't!");
     SHOW_INT("Invite-time: ", chan->invite_time, NULL, "Forever");

+ 9 - 0
src/mod/channels.mod/tclchan.c

@@ -388,6 +388,14 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
         return ERROR;
       }
       chan->closed_ban = atoi(item[i]);
+    } else if (!strcmp(item[i], "closed-private")) {
+      i++;
+      if (i >= items) {
+        if (result)
+          sprintf(result, "channel closed-private needs argument");
+        return ERROR;
+      }
+      chan->closed_private = atoi(item[i]);
 /* Chanint template
  *  } else if (!strcmp(item[i], "temp")) {
  *    i++;
@@ -761,6 +769,7 @@ int channel_add(char *result, char *newname, char *options)
     chan->limit_prot = 0;
     chan->limit = 0;
     chan->closed_ban = 0;
+    chan->closed_private = 0;
 /* Chanint template
  *  chan->temp = 0;
  */

+ 6 - 5
src/mod/channels.mod/userchan.c

@@ -1275,11 +1275,11 @@ int write_chans(FILE *f, int idx)
 + channel add %s { chanmode %s addedby %s addedts %lu idle-kick %d \
 limit %d stopnethack-mode %d 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 %cprivate %ccycle %cinactive %cdynamicexempts %cuserexempts \
-%cdynamicinvites %cuserinvites %cnodesynch %cclosed %ctake %cmanop %cvoice \
-%cfastop }\n",
+flood-nick %d:%d closed-ban %d closed-private %d ban-time %d \
+exempt-time %d invite-time %d %cenforcebans %cdynamicbans %cuserbans \
+%cbitch %cprotectops %crevenge %crevengebot %cprivate %ccycle \
+%cinactive %cdynamicexempts %cuserexempts %cdynamicinvites %cuserinvites \
+%cnodesynch %cclosed %ctake %cmanop %cvoice %cfastop }\n",
 	chan->dname,
 	w,
         chan->added_by,
@@ -1304,6 +1304,7 @@ flood-nick %d:%d closed-ban %d ban-time %d exempt-time %d invite-time %d \
  * also include temp %d in dprintf
  */
         chan->ban_time,
+        chan->closed_private,
         chan->exempt_time,
         chan->invite_time,
  	PLSMNS(channel_enforcebans(chan)),

+ 2 - 2
src/mod/irc.mod/chan.c

@@ -992,8 +992,8 @@ void enforce_closed(struct chanset_t *chan) {
   if (!chan || !me_op(chan)) return;
   if (!(chan->channel.mode & CHANINV))
     strcat(buf, "i");
-/*  if (!(chan->channel.mode & CHANPRIV))
-    strcat(buf, "p"); */
+  if (chan->closed_private && !(chan->channel.mode & CHANPRIV))
+    strcat(buf, "p"); 
   if (buf && buf[0])
     dprintf(DP_MODE, STR("MODE %s +%s\n"), chan->name, buf);
   priority_do(chan, 0, PRIO_KICK);