Преглед изворни кода

* Ported [2439] to 1.2.9

svn: 2594
Bryan Drewery пре 20 година
родитељ
комит
7262ceaf17

+ 1 - 0
doc/UPDATES

@@ -25,6 +25,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed an error with msg-* displaying as msg* in 'help set'. (seinfeld)
 * Setting 'manop-warn' was only being used for 'OP #chan' not 'OP' alone.
 * Fixed channel notices not being parsed.
+* Took out all punish/revenge code, it's been disabled since 1.2.7 anyway.
 
 1.2.8
 * Fixed [bot]* cmds depending on case of botnicks.

+ 0 - 14
misc/help.txt

@@ -368,16 +368,6 @@ See also: link
                               If the channel is +bitch, see stopnethack-mode 1
                             6 If the channel is -bitch, see stopnethack-mode 2
                               If the channel is +bitch, see stopnethack-mode 4
-        $brevenge-mode$b      This settings defines how the bot should punish
-                          bad users when revenging. There are four possible
-                          settings:
-                            0 Deop the user.
-                            1 Deop the user and give them the +d flag for the
-                              channel.
-                            2 Deop the user, give them the +d flag for the
-                              channel, and kick them.
-                            3 Deop the user, give them the +d flag for the
-                              channel, kick, and ban them.
         $bclosed-ban$b        Set this to 1 to ban users who join +closed 
                           channels. This is probably not needed though, as
                           +closed maintains +i.
@@ -468,10 +458,6 @@ See also: link
                        will see no reference to it over the botnet in any place.
         $bprotectops$b     Re-op a user with the +o flag if they get deopped?
                        DON'T USE THIS.
-        $brevenge$b        Remember people who deop/kick/ban the bot, valid ops,
-                       or friends and punish them? 
-        $brevengebot$b     This is similar to to the 'revenge' option, but it
-                       only triggers if a bot gets deopped, kicked or banned.
         $btake$b           Once a bot is opped, it will mass op all other bots
                        in the channel. After that, they will all attempt to 
                        mass deop in hopes 'taking' the channel. :)

+ 8 - 4
src/chan.h

@@ -168,7 +168,9 @@ struct chanset_t {
  */
   int idle_kick;
   int stopnethack_mode;
+#ifdef REVENGE
   int revenge_mode;
+#endif
   time_t ban_time;
   time_t invite_time;
   time_t exempt_time;
@@ -215,13 +217,13 @@ struct chanset_t {
 #define CHAN_TAKE 	    BIT5	/* When a bot gets opped, take the chan */
 #define CHAN_PROTECTOPS     BIT6	/* re-op any +o people who get deop'd */
 #define CHAN_BOTBITCH       BIT7        /* only let bots be opped? */
-#define CHAN_REVENGE        BIT8	/* get revenge on bad people          */
+#undef  CHAN_8              /*BIT8	 */
 #define CHAN_SECRET         BIT9	/* don't advertise channel on botnet  */
 #undef  CHAN_10		    /* BIT10        not used */
 #define CHAN_CYCLE          BIT11	/* cycle the channel if possible      */
 #define CHAN_INACTIVE       BIT12	/* no irc support for this channel */
 #define CHAN_VOICE          BIT13	/* a bot +y|y will voice *, except +q */
-#define CHAN_REVENGEBOT     BIT14	/* revenge on actions against the bot */
+#undef  CHAN_14             /* BIT14	 */
 #define CHAN_NODESYNCH      BIT15
 #define CHAN_FASTOP         BIT16	/* Bots will not use +o-b to op (no cookies) */ 
 #define CHAN_PRIVATE        BIT17	/* users need |o to access chan */ 
@@ -259,14 +261,12 @@ struct chanset_t *findchan_by_dname(const char *name);
 #define channel_botbitch(chan) (chan->status & CHAN_BOTBITCH)
 #define channel_nodesynch(chan) (chan->status & CHAN_NODESYNCH)
 #define channel_enforcebans(chan) (chan->status & CHAN_ENFORCEBANS)
-#define channel_revenge(chan) (chan->status & CHAN_REVENGE)
 #define channel_dynamicbans(chan) (chan->status & CHAN_DYNAMICBANS)
 #define channel_nouserbans(chan) (chan->status & CHAN_NOUSERBANS)
 #define channel_protectops(chan) (chan->status & CHAN_PROTECTOPS)
 #define channel_secret(chan) (chan->status & CHAN_SECRET)
 #define channel_cycle(chan) (chan->status & CHAN_CYCLE)
 #define channel_inactive(chan) (chan->status & CHAN_INACTIVE)
-#define channel_revengebot(chan) (chan->status & CHAN_REVENGEBOT)
 #define channel_dynamicexempts(chan) (chan->ircnet_status & CHAN_DYNAMICEXEMPTS)
 #define channel_nouserexempts(chan) (chan->ircnet_status & CHAN_NOUSEREXEMPTS)
 #define channel_dynamicinvites(chan) (chan->ircnet_status & CHAN_DYNAMICINVITES)
@@ -274,6 +274,10 @@ struct chanset_t *findchan_by_dname(const char *name);
 #define channel_juped(chan) (chan->status & CHAN_JUPED)
 #define channel_stop_cycle(chan) (chan->status & CHAN_STOP_CYCLE)
 
+#ifdef REVENGE
+#define channel_revenge(chan) (chan->status & CHAN_REVENGE)
+#define channel_revengebot(chan) (chan->status & CHAN_REVENGEBOT)
+#endif 
 
 #define channel_closed(chan) (chan->status & CHAN_CLOSED)
 #define channel_take(chan) (chan->status & CHAN_TAKE)

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

@@ -34,7 +34,7 @@
 static bool 			use_info = 1;
 static char 			glob_chanmode[64] = "nt";		/* Default chanmode (drummer,990731) */
 static int 			global_stopnethack_mode;
-static int 			global_revenge_mode = 3;
+//static int 			global_revenge_mode = 3;
 static int 			global_idle_kick;		/* Default idle-kick setting. */
 static time_t 			global_ban_time;
 static time_t			global_exempt_time;
@@ -823,10 +823,12 @@ void channels_report(int idx, int details)
 	  i += my_strcpy(s + i, "bitch ");
 	if (channel_protectops(chan))
 	  i += my_strcpy(s + i, "protectops ");
+/*
 	if (channel_revenge(chan))
 	  i += my_strcpy(s + i, "revenge ");
 	if (channel_revenge(chan))
 	  i += my_strcpy(s + i, "revengebot ");
+*/
 	if (channel_secret(chan))
 	  i += my_strcpy(s + i, "secret ");
 	if (channel_cycle(chan))
@@ -871,9 +873,11 @@ void channels_report(int idx, int details)
 	if (chan->stopnethack_mode)
 	  dprintf(idx, "      stopnethack-mode %d\n",
 		  chan->stopnethack_mode);
+/*
         if (chan->revenge_mode)
           dprintf(idx, "      revenge-mode %d\n",
                   chan->revenge_mode);
+*/
        dprintf(idx, "    Bans last %lu mins.\n", chan->ban_time);
        dprintf(idx, "    Exemptions last %lu mins.\n", chan->exempt_time);
        dprintf(idx, "    Invitations last %lu mins.\n", chan->invite_time);

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

@@ -1206,8 +1206,8 @@ static void cmd_chaninfo(int idx, char *par)
     SHOW_FLAG("nodesynch",	channel_nodesynch(chan));
     SHOW_FLAG("private",	channel_privchan(chan));
     SHOW_FLAG("protectops",	channel_protectops(chan));
-    SHOW_FLAG("revenge",	channel_revenge(chan));
-    SHOW_FLAG("revengebot",	channel_revengebot(chan));
+//    SHOW_FLAG("revenge",	channel_revenge(chan));
+//    SHOW_FLAG("revengebot",	channel_revengebot(chan));
     if (have_take)
       SHOW_FLAG("take",		channel_take(chan));
     SHOW_FLAG("voice",		channel_voice(chan));
@@ -1247,7 +1247,7 @@ static void cmd_chaninfo(int idx, char *par)
     SHOW_INT("Mdop: ", chan->mdop, P_STR, "Ignore");
     deflag = chan->mop;
     SHOW_INT("Mop: ", chan->mop, P_STR, "Ignore");
-    SHOW_INT("Revenge-mode: ", chan->revenge_mode, NULL, NULL);
+//    SHOW_INT("Revenge-mode: ", chan->revenge_mode, NULL, NULL);
     SHOW_INT("Stopnethack-mode: ", chan->stopnethack_mode, "", "Don't!");
     SHOW_INT("Voice-non-ident: ", chan->voice_non_ident, "Do!", "Don't!");
 

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

@@ -368,6 +368,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
 	return ERROR;
       }
       chan->stopnethack_mode = atoi(item[i]);
+/*
     } else if (!strcmp(item[i], "revenge-mode")) {
       i++;
       if (i >= items) {
@@ -376,6 +377,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
         return ERROR;
       }
       chan->revenge_mode = atoi(item[i]);
+*/
     } else if (!strcmp(item[i], "ban-time")) {
       i++;
       if (i >= items) {
@@ -580,6 +582,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
        this later */
     else if (!have_take && !strcmp(item[i], "+take")) ;
     else if (!have_take && !strcmp(item[i], "-take")) ;
+    else if (!strcmp(item[i], "revenge-mode")) ;
     else if (!strcmp(item[i], "+revenge")) ;
     else if (!strcmp(item[i], "-revenge")) ;
     else if (!strcmp(item[i], "+revengebot")) ;
@@ -829,7 +832,7 @@ int channel_add(char *result, char *newname, char *options)
     chan->flood_nick_thr = gfld_nick_thr;
     chan->flood_nick_time = gfld_nick_time;
     chan->stopnethack_mode = global_stopnethack_mode;
-    chan->revenge_mode = global_revenge_mode;
+//    chan->revenge_mode = global_revenge_mode;
     chan->idle_kick = global_idle_kick;
     chan->limitraise = 20;
     chan->ban_time = global_ban_time;

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

@@ -710,12 +710,12 @@ bool write_chans(FILE *f, int idx)
     if (lfprintf(f, "\
 + channel add %s { chanmode { %s } addedby %s addedts %lu idle-kick %d \
 bad-cookie %d manop %d mdop %d mop %d \
-limit %d stopnethack-mode %d revenge-mode %d flood-chan %d:%lu \
+limit %d stopnethack-mode %d flood-chan %d:%lu \
 flood-ctcp %d:%lu flood-join %d:%lu flood-kick %d:%lu flood-deop %d:%lu \
 flood-nick %d:%lu closed-ban %d closed-invite %d closed-private %d ban-time %lu \
 exempt-time %lu invite-time %lu voice-non-ident %d \
-%cenforcebans %cdynamicbans %cuserban %cbitch %cprotectops %crevenge \
-%crevengebot %cprivate %ccycle %cinactive %cdynamicexempts %cuserexempts \
+%cenforcebans %cdynamicbans %cuserban %cbitch %cprotectops \
+%cprivate %ccycle %cinactive %cdynamicexempts %cuserexempts \
 %cdynamicinvites %cuserinvites %cnodesynch %cclosed %cvoice \
 %cfastop %cautoop %cbotbitch %c%s}\n",
 	chan->dname,
@@ -733,7 +733,6 @@ exempt-time %lu invite-time %lu voice-non-ident %d \
 	chan->mop,
         chan->limitraise,
 	chan->stopnethack_mode,
-        chan->revenge_mode,
 	chan->flood_pub_thr, chan->flood_pub_time,
         chan->flood_ctcp_thr, chan->flood_ctcp_time,
         chan->flood_join_thr, chan->flood_join_time,
@@ -756,8 +755,6 @@ exempt-time %lu invite-time %lu voice-non-ident %d \
 	PLSMNS(!channel_nouserbans(chan)),
 	PLSMNS(channel_bitch(chan)),
 	PLSMNS(channel_protectops(chan)),
-	PLSMNS(channel_revenge(chan)),
-	PLSMNS(channel_revengebot(chan)),
 	PLSMNS(channel_privchan(chan)),
 	PLSMNS(channel_cycle(chan)),
         inactive,

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

@@ -2664,7 +2664,7 @@ static int gotkick(char *from, char *origmsg)
       simple_sprintf(s1, "%s!%s", m->nick, m->userhost);
       u2 = get_user_by_host(s1);
       set_handle_laston(chan->dname, u2, now);
-      maybe_revenge(chan, from, s1, REVENGE_KICK);
+//      maybe_revenge(chan, from, s1, REVENGE_KICK);
     } else {
       simple_sprintf(s1, "%s!*@could.not.loookup.hostname", nick);
     }

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

@@ -784,6 +784,7 @@ request_in(struct chanset_t *chan)
 }
 
 
+#ifdef REVENGE
 /* Contains the logic to decide wether we want to punish someone. Returns
  * true (1) if we want to, false (0) if not.
  */
@@ -965,6 +966,7 @@ maybe_revenge(struct chanset_t *chan, char *whobad, char *whovictim, int type)
   /* Haha! Do the vengeful thing ... */
   punish_badguy(chan, whobad, u, badnick, victimstr, mevictim, type);
 }
+#endif
 
 /* Set the key.
  */

+ 3 - 3
src/mod/irc.mod/irc.h

@@ -10,8 +10,8 @@
 
 enum { BC_NOCOOKIE = 1, BC_SLACK, BC_HASH };
 
-#define REVENGE_KICK 1		/* Kicked victim	*/
-#define REVENGE_DEOP 2		/* Took op		*/
+//#define REVENGE_KICK 1		/* Kicked victim	*/
+//#define REVENGE_DEOP 2		/* Took op		*/
 
 #define PRIO_DEOP 1
 #define PRIO_KICK 2
@@ -78,7 +78,7 @@ static bool do_op(char *, struct chanset_t *, time_t, bool);
 static void request_op(struct chanset_t *);
 static void request_in(struct chanset_t *);
 static void my_setkey(struct chanset_t *, char *);
-static void maybe_revenge(struct chanset_t *, char *, char *, int);
+//static void maybe_revenge(struct chanset_t *, char *, char *, int);
 static bool detect_chan_flood(char *, char *, char *, struct chanset_t *, int,
 			     char *);
 static void new_mask(masklist *, char *, char *);

+ 1 - 1
src/mod/irc.mod/mode.c

@@ -688,7 +688,7 @@ got_deop(struct chanset_t *chan, memberlist *m, memberlist *mv, char *isserver)
     char s[UHOSTLEN] = "";
 
     simple_sprintf(s, "%s!%s", mv->nick, mv->userhost);
-    maybe_revenge(chan, s1, s, REVENGE_DEOP);
+//    maybe_revenge(chan, s1, s, REVENGE_DEOP);
   }
 }
 

+ 1 - 1
src/set.c

@@ -27,7 +27,7 @@ char auth_key[51] = "";
 char auth_prefix[2] = "";
 int badprocess = DET_IGNORE;
 bool dccauth = 0;
-char *def_chanset = "+enforcebans +dynamicbans +userbans -bitch -protectops -revenge +cycle -inactive +userexempts -dynamicexempts +userinvites -dynamicinvites -revengebot -nodesynch -closed -take -voice -private -fastop";
+char *def_chanset = "+enforcebans +dynamicbans +userbans -bitch -protectops +cycle -inactive +userexempts -dynamicexempts +userinvites -dynamicinvites -nodesynch -closed -take -voice -private -fastop";
 int cloak_script = 0;
 rate_t close_threshold = { 0, 0 };
 int fight_threshold;