]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - extensions/ip_cloaking.c
Log to serverlog when throwing out a server because of a bad nickname.
[irc/rqf/shadowircd.git] / extensions / ip_cloaking.c
index f4fb75e33e9395fba4e440ab4c74bbfc751590f9..035913e9b3f068c317fb0c54e85ff228c3341dfd 100644 (file)
@@ -92,16 +92,11 @@ do_host_cloak_ip(const char *inbuf, char *outbuf)
                 * the actual cloaking would get ugly
                 */
                for (tptr = outbuf; *tptr != '\0'; tptr++)
-               {
-                       if (*tptr == ':') {
+                       if (*tptr == ':')
                                totalcount++;
-                       }
-               }
        }
        else if (!strchr(outbuf, '.'))
-       {
                return;
-       }
 
        for (tptr = outbuf; *tptr != '\0'; tptr++) 
        {
@@ -111,19 +106,13 @@ do_host_cloak_ip(const char *inbuf, char *outbuf)
                        continue;
                }
 
-               switch (ipv6)
-               {
-               case 1:
-                       if (sepcount < totalcount / 2)
-                               break;
-               case 0:
-                       if (sepcount < 2)
-                               break;
-               default:
-                       *tptr = chartable[(*tptr + accum) % 20];
+               if (ipv6 && sepcount < totalcount / 2)
+                       continue;
 
-               }
+               if (!ipv6 && sepcount < 2)
+                       continue;
 
+               *tptr = chartable[(*tptr + accum) % 20];
                accum = (accum << 1) | (accum >> 31);
        }
 }
@@ -160,9 +149,7 @@ do_host_cloak_host(const char *inbuf, char *outbuf)
        for (tptr = outbuf; *tptr != '\0'; tptr++)
        {
                if (isdigit(*tptr))
-               {
                        *tptr = '0' + (*tptr + accum) % 10;
-               }
 
                accum = (accum << 1) | (accum >> 31);
        }