Răsfoiți Sursa

Remove old revenge code (#40)

Bryan Drewery 14 ani în urmă
părinte
comite
72f3b830b9

+ 0 - 9
src/chan.h

@@ -189,9 +189,6 @@ struct chanset_t {
  *int temp;
  */
   int flood_exempt_mode;
-#ifdef REVENGE
-  int revenge_mode;
-#endif
   interval_t ban_time;
   interval_t invite_time;
   interval_t exempt_time;
@@ -304,12 +301,6 @@ struct chanset_t *findchan_by_dname(const char *name);
 #define channel_cycle(chan) (chan->status & CHAN_CYCLE)
 #define channel_inactive(chan) (chan->status & CHAN_INACTIVE)
 
-
-#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)
 #define channel_voice(chan) (chan->status & CHAN_VOICE)

+ 0 - 1
src/chanprog.c

@@ -22,7 +22,6 @@
  * chanprog.c -- handles:
  *   rmspace()
  *   maintaining the server list
- *   revenge punishment
  *   timers, utimers
  *   telling the current programmed settings
  *   initializing a lot of stuff and loading the tcl scripts

+ 0 - 11
src/mod/channels.mod/chanmisc.c

@@ -398,16 +398,6 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item,
       key.trim();
       set_fish_key(chan->dname, key);
       strlcpy(chan->fish_key, key.c_str(), sizeof(chan->fish_key));
-/*
-    } else if (!strcmp(item[i], "revenge-mode")) {
-      i++;
-      if (i >= items) {
-        if (result)
-          strlcpy(result, "channel revenge-mode needs argument", RESULT_LEN);
-        return ERROR;
-      }
-      chan->revenge_mode = atoi(item[i]);
-*/
     } else if (!strcmp(item[i], "ban-time")) {
       i++;
       if (i >= items) {
@@ -1040,7 +1030,6 @@ int channel_add(char *result, const char *newname, char *options, bool isdefault
     chan->flood_nick_time = gfld_nick_time;
     chan->flood_mjoin_thr = 6;
     chan->flood_mjoin_time = 1;
-//    chan->revenge_mode = global_revenge_mode;
     chan->limitraise = 20;
     chan->ban_time = global_ban_time;
     chan->exempt_time = global_exempt_time;

+ 0 - 12
src/mod/channels.mod/channels.c

@@ -54,7 +54,6 @@
 
 static bool 			use_info = 1;
 static char 			glob_chanmode[64] = "nt";		/* Default chanmode (drummer,990731) */
-//static int 			global_revenge_mode = 3;
 static interval_t 			global_ban_time;
 static interval_t			global_exempt_time;
 static interval_t 			global_invite_time;
@@ -840,12 +839,6 @@ void channels_report(int idx, int details)
 	  i += my_strcpy(s + i, "userbans ");
 	if (channel_bitch(chan))
 	  i += my_strcpy(s + i, "bitch ");
-/*
-	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))
@@ -896,11 +889,6 @@ void channels_report(int idx, int details)
 	dprintf(idx, "      Options: %s\n", s);
         if (chan->limitraise)
           dprintf(idx, "      Raising limit +%d every 2 minutes\n", chan->limitraise);
-/*
-        if (chan->revenge_mode)
-          dprintf(idx, "      revenge-mode %d\n",
-                  chan->revenge_mode);
-*/
        dprintf(idx, "    Bans last %d mins.\n", chan->ban_time);
        dprintf(idx, "    Exemptions last %d mins.\n", chan->exempt_time);
        dprintf(idx, "    Invitations last %d mins.\n", chan->invite_time);

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

@@ -1208,8 +1208,6 @@ static void cmd_chaninfo(int idx, char *par)
     SHOW_FLAG("private",	channel_privchan(chan));
     SHOW_FLAG("protect",	channel_protect(chan));
     SHOW_FLAG("rbl",		channel_rbl(chan));
-//    SHOW_FLAG("revengebot",	channel_revengebot(chan));
-//    SHOW_FLAG("revenge",	channel_revenge(chan));
     if (HAVE_TAKE)
       SHOW_FLAG("take",		channel_take(chan));
     SHOW_FLAG("voice",		channel_voice(chan));
@@ -1254,7 +1252,6 @@ 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("Protect-backup: ", chan->protect_backup, "Do!", "Don't!");
     SHOW_INT("Voice-non-ident: ", chan->voice_non_ident, "Do!", "Don't!");
 

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

@@ -1029,189 +1029,6 @@ request_in(struct chanset_t *chan)
   putlog(LOG_GETIN, "*", "Requested help to join %s", chan->dname);
 }
 
-
-#ifdef REVENGE
-/* Contains the logic to decide wether we want to punish someone. Returns
- * true (1) if we want to, false (0) if not.
- */
-static bool
-want_to_revenge(struct chanset_t *chan, struct userrec *u,
-                struct userrec *u2, char *badnick, char *victimstr, bool mevictim)
-{
-  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0 };
-
-  /* Do not take revenge upon ourselves. */
-  if (match_my_nick(badnick))
-    return 0;
-
-  get_user_flagrec(u, &fr, chan->dname, chan);
-
-  /* Kickee didn't kick themself? */
-  if (rfc_casecmp(badnick, victimstr)) {
-    /* They kicked me? */
-    if (mevictim) {
-      /* ... and I'm allowed to take revenge? <snicker> */
-      if (channel_revengebot(chan))
-        return 1;
-      /* Do we revenge for our users ... and do we actually know the victim? */
-    } else if (channel_revenge(chan) && u2) {
-      struct flag_record fr2 = { FR_GLOBAL | FR_CHAN, 0, 0, 0 };
-
-      get_user_flagrec(u2, &fr2, chan->dname, chan);
-      /* Protecting friends? */
-      /* Protecting ops? */
-      if ((channel_protectops(chan) && chk_op(fr2, chan)))
-        return 1;
-    }
-  }
-  return 0;
-}
-
-/* Dependant on revenge_mode, punish the offender.
- */
-static void
-punish_badguy(struct chanset_t *chan, char *whobad,
-              struct userrec *u, char *badnick, char *victimstr, bool mevictim, int type)
-{
-  memberlist *m = ismember(chan, badnick);
-
-  if (!m)
-    return;
-
-  char reason[1024] = "", ct[81] = "", *kick_msg = NULL;
-  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0 };
-
-  get_user_flagrec(u, &fr, chan->dname, chan);
-
-  /* Get current time into a string */
-  strftime(ct, sizeof ct, "%d %b %Z", gmtime(&now));
-
-  /* Put together log and kick messages */
-  reason[0] = 0;
-  switch (type) {
-    case REVENGE_KICK:
-      kick_msg = "don't kick my friends, bud";
-      simple_snprintf(reason, sizeof(reason), "kicked %s off %s", victimstr, chan->dname);
-      break;
-    case REVENGE_DEOP:
-      simple_snprintf(reason, sizeof(reason), "deopped %s on %s", victimstr, chan->dname);
-      kick_msg = "don't deop my friends, bud";
-      break;
-    default:
-      kick_msg = "revenge!";
-  }
-  putlog(LOG_MISC, chan->dname, "Punishing %s (%s)", badnick, reason);
-
-  /* Set the offender +d */
-  if ((chan->revenge_mode > 0) &&
-      /* ... unless there's no more to do */
-      !(chan_deop(fr) || glob_deop(fr))) {
-    char s[UHOSTLEN], s1[UHOSTLEN];
-    memberlist *mx = NULL;
-
-    /* Removing op */
-    if (chk_op(fr, chan)) {
-      fr.match = FR_CHAN;
-      if (chan_op(fr)) {
-        fr.chan &= ~USER_OP;
-      } else {
-        fr.chan |= USER_DEOP;
-      }
-      set_user_flagrec(u, &fr, chan->dname);
-      putlog(LOG_MISC, "*", "No longer opping %s[%s] (%s)", u->handle, whobad, reason);
-    }
-    /* ... or just setting to deop */
-    else if (u) {
-      /* In the user list already, cool :) */
-      fr.match = FR_CHAN;
-      fr.chan |= USER_DEOP;
-      set_user_flagrec(u, &fr, chan->dname);
-      simple_snprintf(s, sizeof(s), "(%s) %s", ct, reason);
-      putlog(LOG_MISC, "*", "Now deopping %s[%s] (%s)", u->handle, whobad, s);
-    }
-    /* ... or creating new user and setting that to deop */
-    else {
-      strlcpy(s1, whobad, sizeof(s1));
-      maskhost(s1, s);
-      strlcpy(s1, badnick, sizeof(s1));
-      /* If that handle exists use "badX" (where X is an increasing number)
-       * instead.
-       */
-      while (get_user_by_handle(userlist, s1)) {
-        if (!strncmp(s1, "bad", 3)) {
-          int i;
-
-          i = atoi(s1 + 3);
-          simple_snprintf(s1 + 3, sizeof(s1) - 3, "%d", i + 1);
-        } else
-          strlcpy(s1, "bad1", sizeof(s1));   /* Start with '1' */
-      }
-      userlist = adduser(userlist, s1, s, "-", 0, 0);
-      fr.match = FR_CHAN;
-      fr.chan = USER_DEOP;
-      u = get_user_by_handle(userlist, s1);
-      if ((mx = ismember(chan, badnick)))
-        mx->user = u;
-      set_user_flagrec(u, &fr, chan->dname);
-      simple_snprintf(s, sizeof(s), "(%s) %s (%s)", ct, reason, whobad);
-      set_user(&USERENTRY_COMMENT, u, (void *) s);
-      putlog(LOG_MISC, "*", "Now deopping %s (%s)", whobad, reason);
-    }
-  }
-
-  /* Always try to deop the offender */
-  if (!mevictim)
-    add_mode(chan, '-', 'o', badnick);
-  /* Ban. Should be done before kicking. */
-  if (chan->revenge_mode > 2) {
-    char s[UHOSTLEN] = "", s1[UHOSTLEN] = "";
-
-    splitnick(&whobad);
-    maskhost(whobad, s1);
-    simple_snprintf(s, sizeof(s), "(%s) %s", ct, reason);
-    u_addmask('b', chan, s1, conf.bot->nick, s, now + (60 * chan->ban_time), 0);
-    if (!mevictim && me_op(chan)) {
-      add_mode(chan, '+', 'b', s1);
-      flush_mode(chan, QUICK);
-    }
-  }
-  /* Kick the offender */
-  if ((chan->revenge_mode > 1) && !chan_sentkick(m) &&
-      /* ... and can I actually do anything about it? */
-      me_op(chan) && !mevictim) {
-    dprintf(DP_MODE, "KICK %s %s :%s%s\n", chan->name, m->nick, bankickprefix, response(RES_MEAN));
-    m->flags |= SENTKICK;
-  }
-}
-
-/* Punishes bad guys under certain circumstances using methods as defined
- * by the revenge_mode flag.
- */
-static void
-maybe_revenge(struct chanset_t *chan, char *whobad, char *whovictim, int type)
-{
-  if (!chan || (type < 0))
-    return;
-
-  /* Get info about offender */
-  struct userrec *u = get_user_by_host(whobad), *u2 = NULL;
-  char *badnick = splitnick(&whobad), *victimstr = NULL;
-  bool mevictim;
-
-  /* Get info about victim */
-  u2 = get_user_by_host(whovictim);
-  victimstr = splitnick(&whovictim);
-  mevictim = match_my_nick(victimstr);
-
-  /* Do we want to revenge? */
-  if (!want_to_revenge(chan, u, u2, badnick, victimstr, mevictim))
-    return;                     /* No, leave them alone ... */
-
-  /* Haha! Do the vengeful thing ... */
-  punish_badguy(chan, whobad, u, badnick, victimstr, mevictim, type);
-}
-#endif
-
 /* Set the key.
  */
 void

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

@@ -11,9 +11,6 @@
 
 enum { BC_NOCOOKIE = 1, BC_SLACK, BC_HASH, BC_COUNTER };
 
-//#define REVENGE_KICK 1		/* Kicked victim	*/
-//#define REVENGE_DEOP 2		/* Took op		*/
-
 #define PRIO_DEOP 1
 #define PRIO_KICK 2
 
@@ -85,7 +82,6 @@ static void do_protect(struct chanset_t* chan, const char* reason);
 static bool do_op(char *, struct chanset_t *, bool, bool);
 static void request_op(struct chanset_t *);
 static void request_in(struct chanset_t *);
-//static void maybe_revenge(struct chanset_t *, char *, char *, int);
 static bool detect_chan_flood(char *, char *, char *, struct chanset_t *, int,
 			     char *);
 static bool new_mask(masklist *, char *, char *);