Procházet zdrojové kódy

* Added bool var 'voice-non-ident' which can be used to not voice non-idented clients with +voice.

svn: 2201
Bryan Drewery před 21 roky
rodič
revize
685339f330
6 změnil soubory, kde provedl 24 přidání a 5 odebrání
  1. 1 0
      doc/UPDATES
  2. 3 0
      misc/help.txt
  3. 14 2
      src/mod/irc.mod/irc.c
  4. 3 2
      src/mod/irc.mod/mode.c
  5. 2 0
      src/set.c
  6. 1 1
      src/set.h

+ 1 - 0
doc/UPDATES

@@ -60,6 +60,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Added rate vars 'flood-msg' and 'flood-ctcp' to control how quickly a bot ignores on flood.
 * Added rate vars 'flood-msg' and 'flood-ctcp' to control how quickly a bot ignores on flood.
 * Added rate var 'flood-g' which will set +g for 60 seconds after this many msgs:sec has been detected. (#74)
 * Added rate var 'flood-g' which will set +g for 60 seconds after this many msgs:sec has been detected. (#74)
 * Added bool var 'mean-kicks' which enables offensive/mean kick msgs.
 * Added bool var 'mean-kicks' which enables offensive/mean kick msgs.
+* Added bool var 'voice-non-ident' which can be used to not voice non-idented clients with +voice.
 * Optimized WHO parsing more to alieviate some cpu usage in large chans
 * Optimized WHO parsing more to alieviate some cpu usage in large chans
 * Binary writing is now a bit faster as the hash is calculated on the fly now.
 * Binary writing is now a bit faster as the hash is calculated on the fly now.
 * Rewrote how logs are shared over botnet, now uses much less bw and resources. (#31)
 * Rewrote how logs are shared over botnet, now uses much less bw and resources. (#31)

+ 3 - 0
misc/help.txt

@@ -1546,6 +1546,9 @@ See also: reload, backup
                           1=plain bitchx, 2=crackrock, 3=neonapple, 4=tunnelvision, 
                           1=plain bitchx, 2=crackrock, 3=neonapple, 4=tunnelvision, 
                           5=argon, 6=evolver, 7=prevail 8=cypress 9=mIRC
                           5=argon, 6=evolver, 7=prevail 8=cypress 9=mIRC
  
  
+[B]  $bvoice-non-ident$b  If channel is +voice, clients without an ident will be voiced.
+                          Set to 0 to not voice clients without ident.
+ 
 See also: botset
 See also: botset
 ::sha1
 ::sha1
 ###  $bsha1$b <string>
 ###  $bsha1$b <string>

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

@@ -72,6 +72,18 @@ static bool include_lk = 1;      /* For correct calculation
 #include "cmdsirc.c"
 #include "cmdsirc.c"
 #include "msgcmds.c"
 #include "msgcmds.c"
 
 
+static int
+voice_ok(memberlist *m)
+{
+  if (m->flags & EVOICE)
+    return 0;
+
+  if (m->userhost[0] && !voice_non_ident && m->userhost[0] == '~')
+    return 0;
+
+  return 1;
+}
+
 static void
 static void
 detect_autokick(char *nick, char *uhost, struct chanset_t *chan, char *msg)
 detect_autokick(char *nick, char *uhost, struct chanset_t *chan, char *msg)
 {
 {
@@ -1318,7 +1330,7 @@ check_expired_chanstuff(struct chanset_t *chan)
             if (m->user) {
             if (m->user) {
               get_user_flagrec(m->user, &fr, chan->dname);
               get_user_flagrec(m->user, &fr, chan->dname);
               if (!glob_bot(fr)) {
               if (!glob_bot(fr)) {
-                if (!(m->flags & EVOICE) && !privchan(fr, chan, PRIV_VOICE) &&
+                if (!privchan(fr, chan, PRIV_VOICE) &&
                    ((channel_voice(chan) && !chk_devoice(fr)) ||
                    ((channel_voice(chan) && !chk_devoice(fr)) ||
                    (!channel_voice(chan) && chk_voice(fr, chan)))) {
                    (!channel_voice(chan) && chk_voice(fr, chan)))) {
                   add_mode(chan, '+', 'v', m->nick);
                   add_mode(chan, '+', 'v', m->nick);
@@ -1326,7 +1338,7 @@ check_expired_chanstuff(struct chanset_t *chan)
                   add_mode(chan, '-', 'v', m->nick);
                   add_mode(chan, '-', 'v', m->nick);
                 }
                 }
               }
               }
-            } else if (!m->user && !(m->flags & EVOICE) && channel_voice(chan)) {
+            } else if (!m->user && channel_voice(chan) && voice_ok(m)) {
               add_mode(chan, '+', 'v', m->nick);
               add_mode(chan, '+', 'v', m->nick);
             }
             }
           }
           }

+ 3 - 2
src/mod/irc.mod/mode.c

@@ -1376,8 +1376,9 @@ gotmode(char *from, char *msg)
                     /* if they arent +v|v and VOICER is m+ then EVOICE them */
                     /* if they arent +v|v and VOICER is m+ then EVOICE them */
                   } else {
                   } else {
 /* FIXME: same thing here */
 /* FIXME: same thing here */
-                    if (!match_my_nick(nick) && channel_voice(chan) && (glob_master(user) || chan_master(user) || glob_bot(user))
-                       && strcmp(nick, mparam)) {
+                    if (!match_my_nick(nick) && channel_voice(chan) && 
+                       (glob_master(user) || chan_master(user) || glob_bot(user)) && 
+                       rfc_casecmp(nick, mparam)) {
                       /* if the user is not +q set them norEVOICE. */
                       /* if the user is not +q set them norEVOICE. */
                       if (!chan_quiet(victim) && !(mv->flags & EVOICE)) {
                       if (!chan_quiet(victim) && !(mv->flags & EVOICE)) {
                         putlog(LOG_DEBUG, "@", "Giving EVOICE flag to: %s (%s)", mv->nick, chan->dname);
                         putlog(LOG_DEBUG, "@", "Giving EVOICE flag to: %s (%s)", mv->nick, chan->dname);

+ 2 - 0
src/set.c

@@ -47,6 +47,7 @@ char process_list[1024] = "";
 int promisc = DET_WARN;
 int promisc = DET_WARN;
 int trace = DET_WARN;
 int trace = DET_WARN;
 bool offensive_bans = 1;
 bool offensive_bans = 1;
+bool voice_non_ident = 1;
 
 
 static variable_t vars[] = {
 static variable_t vars[] = {
  {"alias",		alias,			sizeof(alias),			VAR_STRING|VAR_LIST|VAR_NOLOC|VAR_PERM, NULL, NULL},
  {"alias",		alias,			sizeof(alias),			VAR_STRING|VAR_LIST|VAR_NOLOC|VAR_PERM, NULL, NULL},
@@ -85,6 +86,7 @@ static variable_t vars[] = {
  {"servers6",		&serverlist,		0,				VAR_SERVERS|VAR_LIST|VAR_SHUFFLE|VAR_NOLHUB, NULL, NULL},
  {"servers6",		&serverlist,		0,				VAR_SERVERS|VAR_LIST|VAR_SHUFFLE|VAR_NOLHUB, NULL, NULL},
  {"server-port",	&default_port,		0,				VAR_INT|VAR_NOLHUB, NULL, NULL},
  {"server-port",	&default_port,		0,				VAR_INT|VAR_NOLHUB, NULL, NULL},
  {"trace",		&trace,			0,				VAR_INT|VAR_DETECTED, NULL, NULL},
  {"trace",		&trace,			0,				VAR_INT|VAR_DETECTED, NULL, NULL},
+ {"voice-non-ident",	&voice_non_ident,	0,				VAR_INT|VAR_BOOL|VAR_NOLHUB, NULL, NULL},
  {NULL,			NULL,			0,				0, NULL, NULL}
  {NULL,			NULL,			0,				0, NULL, NULL}
 };
 };
 
 

+ 1 - 1
src/set.h

@@ -52,7 +52,7 @@ typedef struct rate_b {
 
 
 extern char		auth_key[], auth_prefix[2], motd[], *def_chanset, alias[],
 extern char		auth_key[], auth_prefix[2], motd[], *def_chanset, alias[],
 			msgident[], msginvite[], msgop[], msgpass[], process_list[];
 			msgident[], msginvite[], msgop[], msgpass[], process_list[];
-extern bool		dccauth, auth_obscure, offensive_bans;
+extern bool		dccauth, auth_obscure, offensive_bans, voice_non_ident;
 extern int		cloak_script, fight_threshold, fork_interval, in_bots, set_noshare, dcc_autoaway,
 extern int		cloak_script, fight_threshold, fork_interval, in_bots, set_noshare, dcc_autoaway,
 			kill_threshold, lag_threshold, op_bots, badprocess, hijack, login, promisc, trace;
 			kill_threshold, lag_threshold, op_bots, badprocess, hijack, login, promisc, trace;
 extern rate_t		op_requests, close_threshold;
 extern rate_t		op_requests, close_threshold;