]> jfr.im git - irc/rizon/acid.git/commitdiff
Add a public method to check if a user's IP is spoofed
authorOrillion <redacted>
Sun, 10 Sep 2017 07:37:17 +0000 (09:37 +0200)
committerOrillion <redacted>
Sun, 10 Sep 2017 07:37:17 +0000 (09:37 +0200)
acid/src/main/java/net/rizon/acid/core/User.java

index 3303f200290af19d27f8a59086a9505522fc9824..784c293e4c79264e9eba2a30e855b48efbfaa86e 100644 (file)
@@ -49,7 +49,7 @@ public class User implements Comparable<User>
                this.UID = UID;
                this.ip = ip;
                // Check if this IP isn't spoofed.
-               if (!this.ip.equals("255.255.255.255") && !this.ip.equals("0"))
+               if (!isSpoofed())
                {
                        // Cloak IP if IP is visible host, else cloak hostname.
                        this.cloakedIp = Acidictive.cloakGenerator.cloak(this.ip);
@@ -81,6 +81,11 @@ public class User implements Comparable<User>
                this.getServer().incUsers();
        }
 
+       public final boolean isSpoofed()
+       {
+               return this.ip.equals("255.255.255.255") || this.ip.equals("0");
+       }
+
        public void onQuit()
        {
                for (Iterator<Channel> it = chanList.iterator(); it.hasNext();)