]> jfr.im git - irc/rizon/acid.git/commitdiff
Eclipse code formater
authorAdam <redacted>
Wed, 26 Nov 2014 16:53:58 +0000 (11:53 -0500)
committerAdam <redacted>
Wed, 26 Nov 2014 16:53:58 +0000 (11:53 -0500)
67 files changed:
acid/src/main/java/net/rizon/acid/commands/Access.java
acid/src/main/java/net/rizon/acid/commands/GC.java
acid/src/main/java/net/rizon/acid/commands/Help.java
acid/src/main/java/net/rizon/acid/commands/Plugins.java
acid/src/main/java/net/rizon/acid/commands/Reload.java
acid/src/main/java/net/rizon/acid/commands/RemoveClient.java
acid/src/main/java/net/rizon/acid/commands/Shutdown.java
acid/src/main/java/net/rizon/acid/commands/Stats.java
acid/src/main/java/net/rizon/acid/conf/Channel.java
acid/src/main/java/net/rizon/acid/conf/Client.java
acid/src/main/java/net/rizon/acid/conf/Command.java
acid/src/main/java/net/rizon/acid/conf/Config.java
acid/src/main/java/net/rizon/acid/conf/General.java
acid/src/main/java/net/rizon/acid/conf/Uplink.java
acid/src/main/java/net/rizon/acid/conf/Validator.java
acid/src/main/java/net/rizon/acid/core/AcidCore.java
acid/src/main/java/net/rizon/acid/core/AcidUser.java
acid/src/main/java/net/rizon/acid/core/Acidictive.java
acid/src/main/java/net/rizon/acid/core/Channel.java
acid/src/main/java/net/rizon/acid/core/Command.java
acid/src/main/java/net/rizon/acid/core/Event.java
acid/src/main/java/net/rizon/acid/core/Logger.java
acid/src/main/java/net/rizon/acid/core/Membership.java
acid/src/main/java/net/rizon/acid/core/Message.java
acid/src/main/java/net/rizon/acid/core/Plugin.java
acid/src/main/java/net/rizon/acid/core/Protocol.java
acid/src/main/java/net/rizon/acid/core/Server.java
acid/src/main/java/net/rizon/acid/core/Timer.java
acid/src/main/java/net/rizon/acid/core/User.java
acid/src/main/java/net/rizon/acid/core/UserList.java
acid/src/main/java/net/rizon/acid/messages/EOB.java
acid/src/main/java/net/rizon/acid/messages/Encap.java
acid/src/main/java/net/rizon/acid/messages/Error.java
acid/src/main/java/net/rizon/acid/messages/Join.java
acid/src/main/java/net/rizon/acid/messages/Kick.java
acid/src/main/java/net/rizon/acid/messages/Kill.java
acid/src/main/java/net/rizon/acid/messages/Mode.java
acid/src/main/java/net/rizon/acid/messages/Nick.java
acid/src/main/java/net/rizon/acid/messages/Notice.java
acid/src/main/java/net/rizon/acid/messages/Operwall.java
acid/src/main/java/net/rizon/acid/messages/Part.java
acid/src/main/java/net/rizon/acid/messages/Pass.java
acid/src/main/java/net/rizon/acid/messages/Ping.java
acid/src/main/java/net/rizon/acid/messages/Privmsg.java
acid/src/main/java/net/rizon/acid/messages/Quit.java
acid/src/main/java/net/rizon/acid/messages/SID.java
acid/src/main/java/net/rizon/acid/messages/SJoin.java
acid/src/main/java/net/rizon/acid/messages/SQuit.java
acid/src/main/java/net/rizon/acid/messages/Server.java
acid/src/main/java/net/rizon/acid/messages/Stats.java
acid/src/main/java/net/rizon/acid/messages/TMode.java
acid/src/main/java/net/rizon/acid/messages/UID.java
acid/src/main/java/net/rizon/acid/messages/Whois.java
acid/src/main/java/net/rizon/acid/sql/SQL.java
acid/src/main/java/net/rizon/acid/util/ClassLoader.java
acid/src/main/java/net/rizon/acid/util/EMail.java
acid/src/main/java/net/rizon/acid/util/Util.java
pyva/core/src/main/java/net/rizon/acid/plugins/pyva/core/core.java
pyva/pyva/src/main/java/net/rizon/acid/plugins/pyva/pyva/commands/GC.java
pyva/pyva/src/main/java/net/rizon/acid/plugins/pyva/pyva/commands/Plugins.java
pyva/pyva/src/main/java/net/rizon/acid/plugins/pyva/pyva/pyva.java
trapbot/src/main/java/net/rizon/acid/plugins/trapbot/ExpireTimer.java
trapbot/src/main/java/net/rizon/acid/plugins/trapbot/ReleaseTimer.java
trapbot/src/main/java/net/rizon/acid/plugins/trapbot/RetrapTimer.java
trapbot/src/main/java/net/rizon/acid/plugins/trapbot/commands/Untrap.java
trapbot/src/main/java/net/rizon/acid/plugins/trapbot/conf/Config.java
trapbot/src/main/java/net/rizon/acid/plugins/trapbot/trapbot.java

index 3b1e7cf38f417bb4bd5fbd56eccd14048065bfdf..ee3fd1b3c7709be8962e7b257a1ef5e8d02b254b 100644 (file)
@@ -21,7 +21,7 @@ import net.rizon.acid.core.User;
 public class Access extends Command
 {
        private static final Logger log = Logger.getLogger(Access.class.getName());
-       
+
        public Access()
        {
                super(1, 4);
@@ -33,29 +33,29 @@ public class Access extends Command
                                                || flags.contains("SRA")
                                                || flags.indexOf('X') != -1);
        }
-       
+
        private static void updateFlags(final String user, final String flags)
        {
                User u = User.findUser(user);
                if (u != null)
                        u.setFlags(flags);
        }
-       
+
        private static boolean isValidCertFP(final String certfp)
        {
                if (certfp.length() != 40)
                        return false;
-               
+
                for (char c : certfp.toLowerCase().toCharArray())
                        /* Not using the Character.* functions because we don't need weird
                         * locales making weird characters "legal"
                         */
                        if (c < '0' || c > '9' && (c < 'a' || c > 'f'))
                                return false;
-               
+
                return true;
        }
-       
+
        /**
         * Adds a certfp to the access entry. This function will add a certfp and
         * notice the user about it. No effect if the target user has no certfp.
@@ -69,7 +69,7 @@ public class Access extends Command
                        return false;
                if (u.getSU().isEmpty()) // redundant with Acidictive; not with access add!
                        return false;
-               
+
                try
                {
                        PreparedStatement ps = Acidictive.acidcore_sql.prepare("SELECT `certfp` FROM `access` WHERE `user` = ?");
@@ -81,7 +81,7 @@ public class Access extends Command
                                ps.setString(1, u.getCertFP());
                                ps.setString(2, u.getSU());
                                ps.executeUpdate();
-                               
+
                                if (notice)
                                        Acidictive.notice(u, "CertFP " + u.getCertFP() + " has been added to your access list.");
                        }
@@ -94,10 +94,10 @@ public class Access extends Command
                {
                        log.log(ex);
                }
-               
+
                return true;
        }
-       
+
        @Override
        public void Run(User x, AcidUser to, Channel c, final String[] args)
        {
@@ -109,13 +109,13 @@ public class Access extends Command
                                reply(x, to, c, "Invalid arguments: access changecertfp <certfp>\n");
                                return;
                        }
-                       
+
                        if (!isValidCertFP(args[1]))
                        {
                                reply(x, to, c, args[1] + " is an invalid certfp.");
                                return;
                        }
-                       
+
                        try
                        {
                                PreparedStatement stmt = Acidictive.acidcore_sql.prepare("UPDATE `access` SET `certfp` = ? WHERE `user` = ?");
@@ -129,7 +129,7 @@ public class Access extends Command
                        }
                        reply(x, to, c, "Updated your certfp to \"" + args[1] + "\"");
                }
-               
+
                // add
                else if (args[0].equalsIgnoreCase("add"))
                {
@@ -138,13 +138,13 @@ public class Access extends Command
                                reply(x, to, c, "Invalid arguments: access add <user> <flag> [certfp]");
                                return;
                        }
-                       
+
                        if (args.length > 3 && !isValidCertFP(args[3]))
                        {
                                reply(x, to, c, args[3] + " is an invalid certfp.");
                                return;
                        }
-                       
+
                        boolean addedcertfp = (args.length > 3);
                        User u = User.findUser(args[1]);
                        String target;
@@ -152,7 +152,7 @@ public class Access extends Command
                                target = u.getSU();
                        else
                                target = args[1];
-                       
+
                        try
                        {
                                PreparedStatement stmt = Acidictive.acidcore_sql.prepare("SELECT * FROM `access` WHERE `user` = ?");
@@ -165,13 +165,13 @@ public class Access extends Command
                                                        + (target.equals(args[1]) ? " (as " + rs.getString("user") + ")" : "") + ".");
                                        return;
                                }
-                               
+
                                if (!x.hasFlags("SRA"))
                                {
                                        reply(x, to, c, "You do not have access to assign +" + args[3] + " access.");
                                        return;
                                }
-                               
+
                                stmt = Acidictive.acidcore_sql.prepare("INSERT INTO `access`(`user`, `flags`, `certfp`) VALUES (?, ?, ?)");
                                stmt.setString(1, target);
                                stmt.setString(2, args[2]);
@@ -183,15 +183,15 @@ public class Access extends Command
                                log.log(e);
                                return;
                        }
-                       
+
                        if (u != null)
                                addedcertfp = addedcertfp || addCertFP(u, false);
-                       
+
                        updateFlags(args[1], args[2]);
                        reply(x, to, c, "Added \"" + target + "\" with flags "
                                        + args[2] + (addedcertfp ? " and certfp " + u.getCertFP() : ""));
                }
-               
+
                // del
                else if (args[0].equalsIgnoreCase("del"))
                {
@@ -200,15 +200,15 @@ public class Access extends Command
                                PreparedStatement stmt = Acidictive.acidcore_sql.prepare("SELECT `flags` FROM `access` WHERE `user` = ?");
                                stmt.setString(1, args[1]);
                                ResultSet rs = Acidictive.acidcore_sql.executeQuery(stmt);
-                               
+
                                if (!rs.next())
                                {
                                        reply(x, to, c, "\"" + args[1] + "\" is not on the access list.");
                                        return;
                                }
-                               
+
                                String flags = rs.getString("flags");
-                               
+
                                /* Yes, SRAs somehow can't be removed at all. Brilliant, eh?
                                 * Someone slap whoever came up with +1 for me, thanks.
                                 */
@@ -218,7 +218,7 @@ public class Access extends Command
                                                        + "\" because you are not higher than them.");
                                        return;
                                }
-                               
+
                                stmt = Acidictive.acidcore_sql.prepare("DELETE FROM `access` WHERE `user` = ?");
                                stmt.setString(1, args[1]);
                                Acidictive.acidcore_sql.executeThread(stmt);
@@ -228,11 +228,11 @@ public class Access extends Command
                                log.log(e);
                                return;
                        }
-                       
+
                        updateFlags(args[1], "");
                        reply(x, to, c, "Removed \"" + args[1] + "\" from the access list.");
                }
-               
+
                // list
                else if (args[0].equalsIgnoreCase("list"))
                {
@@ -241,7 +241,7 @@ public class Access extends Command
                                reply(x, to, c, "This command requires SRA");
                                return;
                        }
-                       
+
                        try
                        {
                                PreparedStatement stmt = Acidictive.acidcore_sql.prepare("SELECT `user`,`certfp`,`flags` FROM `access` ORDER BY `user`");
@@ -264,7 +264,7 @@ public class Access extends Command
                                log.log(e);
                        }
                }
-               
+
                // setflags
                else if (args[0].equalsIgnoreCase("setflags"))
                {
@@ -273,7 +273,7 @@ public class Access extends Command
                                reply(x, to, c, "Invalid arguments: access setflags <user> <flags>\n");
                                return;
                        }
-                       
+
                        String oldflags;
                        try
                        {
@@ -285,15 +285,15 @@ public class Access extends Command
                                        reply(x, to, c, "The user \"" + args[1] + "\" does not exist.");
                                        return;
                                }
-                               
+
                                oldflags = rs.getString("flags");
-                               
+
                                if (isSRA(oldflags))
                                {
                                        reply(x, to, c, "You do not have access to change the flags for a SRA user.");
                                        return;
                                }
-                               
+
                                stmt = Acidictive.acidcore_sql.prepare("UPDATE `access` SET `flags` = ? WHERE `user` = ?");
                                stmt.setString(1, args[2]);
                                stmt.setString(2, args[1]);
@@ -304,12 +304,12 @@ public class Access extends Command
                                log.log(e);
                                return;
                        }
-                       
+
                        updateFlags(args[1], args[2]);
                        reply(x, to, c, "Updated flags for \"" + args[1] + "\" from "
                                                + oldflags + " to " + args[2] + "");
                }
-               
+
                // setcertfp
                else if (args[0].equalsIgnoreCase("setcertfp"))
                {
@@ -318,13 +318,13 @@ public class Access extends Command
                                reply(x, to, c, "Invalid arguments: access setcertfp <user> <certfp>\n");
                                return;
                        }
-                       
+
                        if (!isValidCertFP(args[2]))
                        {
                                reply(x, to, c, args[2] + " is an invalid certfp.");
                                return;
                        }
-                       
+
                        try
                        {
                                PreparedStatement stmt = Acidictive.acidcore_sql.prepare("SELECT * FROM `access` WHERE `user` = ?");
@@ -336,7 +336,7 @@ public class Access extends Command
                                        reply(x, to, c, "The user \"" + args[1] + "\" does not exist.");
                                        return;
                                }
-                               
+
                                String flags = rs.getString("flags"), oldcertfp = rs.getString("certfp");
 
                                if (isSRA(flags))
@@ -344,7 +344,7 @@ public class Access extends Command
                                        reply(x, to, c, "You can not change the certfp for a SRA user.");
                                        return;
                                }
-                               
+
                                stmt = Acidictive.acidcore_sql.prepare("UPDATE `access` SET `certfp` = ? WHERE `user` = ?");
                                stmt.setString(1, args[2]);
                                stmt.setString(2, args[1]);
@@ -369,7 +369,7 @@ public class Access extends Command
                Acidictive.reply(u, to, c, "\2access setflags <user> <flags>\2 / Change the level of a user beneath you.");
                Acidictive.reply(u, to, c, "\2access setcertfp <user> <certfp>\2 / Change the certfp of another user.");
        }
-       
+
        @Override
        public boolean onHelpCommand(User u, AcidUser to, Channel c)
        {
@@ -393,7 +393,7 @@ public class Access extends Command
                Acidictive.reply(u, to, c, "in order to do so.");
                Acidictive.reply(u, to, c, " ");
                Acidictive.reply(u, to, c, "Only SRAs may use the access add and access list commands.");
-               
+
                return true;
        }
 }
index fd9ca07e75df75df3411319d7524ad4f9c3e099a..071d26a1cfa9ffda1cac7ba2be3c38331cd5dd2c 100644 (file)
@@ -22,13 +22,13 @@ public class GC extends Command
                System.gc();
                Acidictive.reply(x, to, c, "Ran gc().");
        }
-       
+
        @Override
        public void onHelp(User u, AcidUser to, Channel c)
        {
                Acidictive.reply(u, to, c, "\2gc\2 / Runs the garbage collector");
        }
-       
+
        @Override
        public boolean onHelpCommand(User u, AcidUser to, Channel c)
        {
@@ -36,7 +36,7 @@ public class GC extends Command
                Acidictive.reply(u, to, c, " ");
                Acidictive.reply(u, to, c, "This command calls the Java System.gc() function. This will force running");
                Acidictive.reply(u, to, c, "the garbage collector and usually free up some memory.");
-               
+
                return true;
        }
 }
index 32d8f363de3098a95576ce0e239b86bda9cf714e..dfbcc75afe7ed496460ea66c315026916561c535 100644 (file)
@@ -14,7 +14,7 @@ public class Help extends Command
        {
                super(0, 1);
        }
-       
+
        @Override
        public void Run(User x, AcidUser to, Channel c, final String[] args)
        {
@@ -28,7 +28,7 @@ public class Help extends Command
                Acidictive.reply(x, to, c, "All commands begin with " + Message.BOLD + "/msg " + to.getNick() + Message.BOLD);
                Acidictive.reply(x, to, c, "Key: [] indicates an optional field. <> indicates a type " +
                                "of user input, otherwise it is as stated.");
-                       
+
                int total = 0;
                for (net.rizon.acid.conf.Command confCmd : to.getConfCommands())
                {
@@ -43,22 +43,22 @@ public class Help extends Command
                                ex.printStackTrace();//XXX
                                continue;
                        }
-                       
+
                        if (confCmd.privilege == null || !x.hasFlags(confCmd.privilege))
                                continue;
-                               
+
                        ++total;
-                       
+
                        String cmdName = confCmd.name;
                        String notice = "\2--== " + cmdName.toUpperCase() + " [" + confCmd.privilege + "] ==--\2";
-                               
+
                        if (args.length == 0)
                        {
                                Acidictive.reply(x, to, c, notice);
                                cmd.onHelp(x, to, c);
                                continue;
                        }
-                               
+
                        if (cmdName.equalsIgnoreCase(args[0]))
                        {
                                Acidictive.reply(x, to, c, notice);
@@ -76,20 +76,20 @@ public class Help extends Command
                                return;
                        }
                }
-                       
+
                // If we have an argument and are STILL here, bail.
                if (args.length > 0)
                {
                        Acidictive.reply(x, to, c, "Command " + Message.BOLD + args[0] + Message.BOLD + " not found.");
                        return;
                }
-                       
+
                if (total > 0)
                        Acidictive.reply(x, to, c, "End of help. [" + Message.BOLD + total + Message.BOLD + " commands displayed]");
                else
                        Acidictive.reply(x, to, c, "You do not have access to any commands.");
        }
-       
+
        @Override
        public boolean onHelpCommand(User u, AcidUser to, Channel c)
        {
@@ -104,7 +104,7 @@ public class Help extends Command
                Acidictive.reply(u, to, c, " ");
                Acidictive.reply(u, to, c, "If a command is given, more verbose information about it will be shown. Note");
                Acidictive.reply(u, to, c, "that only commands that are not bound to a channel have help entries.");
-               
+
                return true;
        }
 }
index 226a8c6dca7946675952e4c50c35dc24fcae094c..30acd709e58fc9ecd8db685ccd482c8868495387 100644 (file)
@@ -38,7 +38,7 @@ public class Plugins extends Command
                                Acidictive.reply(u, to, c, p.getName() + " is already loaded.");
                                return;
                        }
-                       
+
                        try
                        {
                                p = Plugin.loadPlugin(args[1]);
@@ -49,7 +49,7 @@ public class Plugins extends Command
                        {
                                AcidCore.log.log(Level.WARNING, "Unable to load plugin " + args[1], ex);
                                Acidictive.reply(u, to, c, "Unable to load plugin " + args[1] + ": " + ex.getMessage());
-                       }       
+                       }
                }
                else if (args[0].equalsIgnoreCase("UNLOAD") && args.length == 2)
                {
@@ -65,9 +65,9 @@ public class Plugins extends Command
                                Acidictive.reply(u, to, c, p.getName() + " is permanent and can not be unloaded.");
                                return;
                        }
-                       
+
                        p.remove();
-                       
+
                        Acidictive.reply(u, to, c, "Unloaded plugin " + p.getName());
                        AcidCore.log.log(Level.INFO, "PLUGINS UNLOAD for " + p.getName() + " from " + u.getNick());
                }
@@ -85,9 +85,9 @@ public class Plugins extends Command
                                Acidictive.reply(u, to, c, p.getName() + " is permanent and can not be unloaded.");
                                return;
                        }
-                       
+
                        p.remove();
-                       
+
                        try
                        {
                                p = Plugin.loadPlugin(args[1]);
@@ -98,12 +98,12 @@ public class Plugins extends Command
                        {
                                AcidCore.log.log(Level.WARNING, "Unable to reload plugin " + args[1], ex);
                                Acidictive.reply(u, to, c, "Unable to reload plugin " + args[1] + ": " + ex.getMessage());
-                       }       
+                       }
                }
                else
                        Acidictive.reply(u, to, c, "Use LOAD, UNLOAD, RELOAD, or LIST");
        }
-       
+
        @Override
        public void onHelp(User u, AcidUser to, Channel c)
        {
@@ -112,7 +112,7 @@ public class Plugins extends Command
                Acidictive.reply(u, to, c, "\2plugin reload <plugin>\2 / Reloads a plugin");
                Acidictive.reply(u, to, c, "\2plugin unload <plugin>\2 / Unloads a plugin");
        }
-       
+
        @Override
        public boolean onHelpCommand(User u, AcidUser to, Channel c)
        {
index 39278397921ead900b8bed835278009e75dcc052..ce02c6ba3692bfab59cbf8b765c0baf99fccf7f9 100644 (file)
@@ -19,10 +19,10 @@ public class Reload extends Command
        {
                super(0, 1);
        }
-       
+
        @Override
        public void Run(User x, AcidUser to, Channel ch, final String[] args)
-       {       
+       {
                try
                {
                        if (args.length > 0)
@@ -33,11 +33,11 @@ public class Reload extends Command
                                p.reload();
                                return;
                        }
-                       
+
                        Config c = (Config) Config.load("acidictive.yml", Config.class);
                        c.validate();
                        Acidictive.conf.rehash(c);
-                       
+
                        Acidictive.conf = c;
                        Acidictive.loadClients(null, c.clients);
                        Acidictive.loader = new ClassLoader(Acidictive.loaderBase);
@@ -58,16 +58,16 @@ public class Reload extends Command
                                        "Error reloading configuration: " + e.getMessage());
                        return;
                }
-               
+
                Acidictive.reply(x, to, ch, "Reloaded configuration");
        }
-       
+
        @Override
        public void onHelp(User u, AcidUser to, Channel c)
        {
                Acidictive.reply(u, to, c, "\2reload\2 / Reloads the configuration");
        }
-       
+
        @Override
        public boolean onHelpCommand(User u, AcidUser to, Channel c)
        {
index efc02c52a42d4812d0b0db3e54fd9651f082db06..16f5482d953e7917ea4485a0e082c064f51a4173 100644 (file)
@@ -19,17 +19,17 @@ public class RemoveClient extends Command
                User target = User.findUser(args[0]);
                if (target == null || !(target instanceof AcidUser) || target == to)
                        return;
-               
+
                String reason = args.length > 1 ? args[1] : "";
                ((AcidUser) target).quit(reason);
        }
-       
+
        @Override
        public void onHelp(User u, AcidUser to, Channel c)
        {
                Acidictive.reply(u, to, c, "\2removeclient <nick> [reason]\2");
        }
-       
+
        @Override
        public boolean onHelpCommand(User u, AcidUser to, Channel c)
        {
index 1daba5d4f06a8a6e44312c222b18e03933a1b389..fe2fc524b4ae201e4aaa428b5d81a49d3d1a6704 100644 (file)
@@ -11,7 +11,6 @@ import net.rizon.acid.core.Command;
 import net.rizon.acid.core.Logger;
 import net.rizon.acid.core.Protocol;
 import net.rizon.acid.core.User;
-import net.rizon.acid.sql.SQL;
 
 /**
  * Shuts acid4 down gracefully.
@@ -19,12 +18,12 @@ import net.rizon.acid.sql.SQL;
 public class Shutdown extends Command
 {
        private static final Logger log = Logger.getLogger(Shutdown.class.getName());
-       
+
        public Shutdown()
        {
                super(0, 0);
        }
-       
+
        @Override
        public void Run(User x, AcidUser to, Channel c, final String[] args)
        {
@@ -33,27 +32,27 @@ public class Shutdown extends Command
                 */
                Acidictive.privmsg(Acidictive.conf.getChannelNamed("cmdlogchan"), x.getNick() + "->" + to.getNick() + ": " + "shutdown");
                Protocol.wallop(to.getUID(), "SHUTDOWN command from " + x.getNick());
-               
+
                /* Given DB changes are always written when they occur, all we need to
                 * flush are our SQL and socket buffers.
                 */
                Acidictive.acidcore_sql.shutdown();
-               
+
                for (Iterator<String> it = User.getUsers().iterator(); it.hasNext();)
                {
                        User u = User.findUser(it.next());
                        if (u == null || u.getServer() != AcidCore.me)
                                continue;
-                       
+
                        /* Fake quit because we can't AcidUser.quit due to concurrent
                         * modification exceptions.
                         */
                        Protocol.quit(u, "");
                }
-               
+
                // SQUIT our uplink or it won't be all that graceful of a shutdown
                Protocol.squit(AcidCore.me, "SHUTDOWN command from " + x.getNick());
-               
+
                try
                {
                        AcidCore.out.flush();
@@ -66,16 +65,16 @@ public class Shutdown extends Command
                        log.log(e);
                        System.exit(1);
                }
-               
+
                System.exit(0);
        }
-       
+
        @Override
        public void onHelp(User u, AcidUser to, Channel c)
        {
                Acidictive.reply(u, to, c, "\2shutdown\2 / Shuts everything down");
        }
-       
+
        @Override
        public boolean onHelpCommand(User u, AcidUser to, Channel c)
        {
index fab52007753d0dc3e4b6e7f2cca6df140f572066..3ba7d08833e3a38121a984fd197fb2e2bded30ff 100644 (file)
@@ -19,7 +19,7 @@ public class Stats extends Command
        {
                super(0, 0);
        }
-       
+
        @Override
        public void Run(User x, AcidUser to, Channel c, final String[] args)
        {
@@ -29,13 +29,13 @@ public class Stats extends Command
                reply(x, to, c, "Current Users: " + User.userCount() + " Identified: " +
                        UserList.identedNicks() + "; Servers: " + Server.serverCount());
        }
-       
+
        @Override
        public void onHelp(User u, AcidUser to, Channel c)
        {
                Acidictive.reply(u, to, c, "\2stats\2 / Shows miscellaneous info about " + to.getNick());
        }
-       
+
        @Override
        public boolean onHelpCommand(User u, AcidUser to, Channel c)
        {
index cfd105033c2f9a9182906e6ca27fb0152621eaaa..fc23d172e3c2b8e7b6595d60345992158bc18570 100644 (file)
@@ -4,7 +4,7 @@ public class Channel implements Validatable
 {
        public String name, channel;
        public String blowfish;
-       
+
        @Override
        public void validate() throws ConfigException
        {
index dbb310cb6594cbdf112ea8d62bcc97f423c37f6b..001ee0ca434294a94f481aad0096f85d827ce805 100644 (file)
@@ -7,7 +7,7 @@ public class Client implements Validatable
        public String nick, user, host, vhost, name, nspass, modes, version;
        public List<String> channels;
        public List<Command> commands;
-       
+
        public Command findCommand(String name)
        {
                for (Command c : commands)
index d319d589f04d59e7f138b3cc470820369e937a73..5ca7aff77c9c58eedd08fbbc57405aad28947a4c 100644 (file)
@@ -9,7 +9,7 @@ public class Command implements Validatable
        public String name, privilege;
        public List<String> channels;
        public String clazz;
-       
+
        public boolean allowsChannel(String channel)
        {
                if (channels != null)
@@ -18,7 +18,7 @@ public class Command implements Validatable
                                        return true;
                return false;
        }
-       
+
        @Override
        public void validate() throws ConfigException
        {
index 4b21c6b04dff19075895ba170dd858430c4a3186..6b57f10adb4de000858240f62270cd7e60059425 100644 (file)
@@ -1,12 +1,12 @@
 package net.rizon.acid.conf;
 
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor;
-
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.util.List;
 
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor;
+
 public class Config extends Configuration
 {
        public boolean debug, protocol_debug;
@@ -18,30 +18,30 @@ public class Config extends Configuration
        public List<Channel> channel;
        public List<String> plugins;
        public List<AccessPreset> access_preset;
-       
+
        @Override
        public void validate() throws ConfigException
        {
                Validator.validateNotNull("serverinfo", serverinfo);
                Validator.validateNotNull("uplink", uplink);
                Validator.validateNotNull("general", general);
-               
+
                serverinfo.validate();
                uplink.validate();
                general.validate();
-               
+
                Validator.validateList(database);
                Validator.validateList(clients);
                Validator.validateList(channel);
        }
-       
+
        public void rehash(Config other)
        {
                // Rehashing, other = newer config
-               
+
                other.serverinfo = this.serverinfo;
        }
-       
+
        public String getChannelNamed(String name)
        {
                for (Channel c : channel)
@@ -51,7 +51,7 @@ public class Config extends Configuration
                        return name;
                return "#a";
        }
-       
+
        public String getCryptoPass(String ch)
        {
                for (Channel c : channel)
index 78f78cdb3d5b336f5f7b2c113118e33b76af3cc4..694ccb7e836f81e230647ab8d706f9ac51cf300f 100644 (file)
@@ -8,7 +8,7 @@ public class General implements Validatable
        public String command_prefix, email_from, email_smtp, email_securityemail;
        public String control;
        public String akillserv;
-       
+
        @Override
        public void validate() throws ConfigException
        {
index 44d8956f4e5895ffb76a34b15e22cd04f1ddf3c6..546050e98dc846abdc09f9b3e5fbc6b1a2735800 100644 (file)
@@ -5,7 +5,7 @@ public class Uplink implements Validatable
        public String host, pass;
        public int port;
        public boolean ssl;
-       
+
        @Override
        public void validate() throws ConfigException
        {
index b92df2a0c362cdfea8e3bb0bb13e09c22642260b..1fe9daea1461bcb12ab88d6e7e3c3bd8430c7fab 100644 (file)
@@ -12,33 +12,33 @@ public class Validator
                for (T t : list)
                        t.validate();
        }
-       
+
        public static <T> void validateNotNull(String name, T obj) throws ConfigException
        {
                if (obj == null)
                        throw new ConfigException(name + " must be defined");
        }
-       
+
        public static void validateNotEmpty(String name, String obj) throws ConfigException
        {
                validateNotNull(name, obj);
                if (obj.isEmpty())
                        throw new ConfigException(name + " must not be empty");
        }
-       
+
        public static <T extends Collection<?>> void validateNotEmpty(String name, T obj) throws ConfigException
        {
                validateNotNull(name, obj);
                if (obj.isEmpty())
                        throw new ConfigException(name + " must not be empty");
        }
-       
+
        public static void validateNotZero(String name, int i) throws ConfigException
        {
                if (i == 0)
                        throw new ConfigException(name + " must be non zero");
        }
-       
+
        public static void validatePort(String name, int i) throws ConfigException
        {
                if (i < 0 || i > 65535)
index eb6c3589c38ffc9dcb4bb1388cceca1810a8b04e..2039121f264ed1d8ac78b18650270f19dfec60cf 100644 (file)
@@ -63,14 +63,14 @@ public abstract class AcidCore
                                                b.write(System.currentTimeMillis() +  " " + str + "\n");
                                                b.close();
                                        }
-                                       
+
                                        Timer.processTimers();
 
                                        log.log(Level.FINEST, "<-: " + str);
 
                                        User user = null;
                                        Server server = null;
-                                       
+
                                        String source, message_name;
                                        String[] params;
 
@@ -120,19 +120,19 @@ public abstract class AcidCore
                                                log.log(Level.SEVERE, "Error parsing message: " + str, ex);
                                                continue;
                                        }
-                                       
+
                                        Message m = Message.findMessage(message_name);
                                        if (m == null)
                                        {
                                                log.log(Level.FINE, "Unknown message " + message_name);
                                                continue;
                                        }
-                                       
+
                                        if (user != null)
                                                m.onUser(user, params);
                                        else if (server != null)
                                                m.onServer(server, params);
-                                       
+
                                        m.on(source, params);
                                }
                                catch (Exception e)
index f31e25bbf785efd619e4ba930c3eba5ef8939598..fea1fb0025c908e759e08a838feafd730659782a 100644 (file)
@@ -1,9 +1,9 @@
 package net.rizon.acid.core;
 
-import net.rizon.acid.conf.Client;
-
 import java.util.List;
 
+import net.rizon.acid.conf.Client;
+
 public class AcidUser extends User
 {
        public Plugin pkg;
@@ -13,7 +13,7 @@ public class AcidUser extends User
        {
                super(nick, user, host, vhost, name, AcidCore.me, AcidCore.getTS(), AcidCore.getTS(), modes, User.generateUID(), "255.255.255.255");
        }
-       
+
        public AcidUser(Plugin pkg, Client c)
        {
                super(c.nick, c.user, c.host, c.vhost, c.name, AcidCore.me, AcidCore.getTS(), AcidCore.getTS(), c.modes, User.generateUID(), "255.255.255.255");
@@ -24,7 +24,7 @@ public class AcidUser extends User
                        for (String ch : client.channels)
                                this.joinChan(Acidictive.conf.getChannelNamed(ch));
        }
-       
+
        public void introduce()
        {
                Protocol.uid(this);
@@ -35,7 +35,7 @@ public class AcidUser extends User
                for (Channel chan : this.getChannels())
                        Protocol.join(this, chan);
        }
-       
+
        public void joinChan(final String channel)
        {
                Channel chan = Channel.findChannel(channel);
@@ -47,28 +47,28 @@ public class AcidUser extends User
                        chan = new Channel(channel, AcidCore.getTS());
                        chan.setMode('n'); chan.setMode('t');
                }
-               if (!Acidictive.me.isBursting())
+               if (!AcidCore.me.isBursting())
                        Protocol.join(this, chan);
                chan.addUser(this, "");
                this.addChan(chan);
        }
-       
+
        public void partChan(Channel chan)
        {
                if (!this.isOnChan(chan))
                        return;
-               
+
                Protocol.part(this, chan.getName());
                chan.removeUser(this);
                this.remChan(chan);
        }
-       
+
        public void quit(final String reason)
        {
                Protocol.quit(this, reason);
                this.onQuit();
        }
-       
+
        public final String getNSPass()
        {
                if (client != null)
@@ -76,7 +76,7 @@ public class AcidUser extends User
                else
                        return null;
        }
-       
+
        public net.rizon.acid.conf.Command findConfCommand(final String name)
        {
                if (client != null && this.client.commands != null)
@@ -85,7 +85,7 @@ public class AcidUser extends User
                                        return c;
                return null;
        }
-       
+
        public List<net.rizon.acid.conf.Command> getConfCommands()
        {
                return this.client.commands;
index 469c648f1c87fb9e00a0e462228051f1cc5669a3..86c15d6e2e48cc8443bee36e521c98b402bd2bef 100644 (file)
@@ -1,12 +1,5 @@
 package net.rizon.acid.core;
 
-import net.rizon.acid.conf.Client;
-import net.rizon.acid.conf.Config;
-import net.rizon.acid.sql.SQL;
-import net.rizon.acid.util.Blowfish;
-import net.rizon.acid.util.ClassLoader;
-import net.rizon.acid.util.Util;
-
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
@@ -22,6 +15,13 @@ import java.util.Date;
 import java.util.List;
 import java.util.logging.Level;
 
+import net.rizon.acid.conf.Client;
+import net.rizon.acid.conf.Config;
+import net.rizon.acid.sql.SQL;
+import net.rizon.acid.util.Blowfish;
+import net.rizon.acid.util.ClassLoader;
+import net.rizon.acid.util.Util;
+
 public class Acidictive extends AcidCore
 {
        private static final Logger log = Logger.getLogger(Acidictive.class.getName());
@@ -30,10 +30,10 @@ public class Acidictive extends AcidCore
        public static int syncTime;
        public static SQL acidcore_sql;
        public static String bold = "\ 2";
-       
+
        public static String loaderBase = "commands";
        public static ClassLoader loader; // loader for the core commands
-       
+
        public static String getVersion()
        {
                return "acid4 " + Version.getAttribute("revision");
@@ -56,14 +56,14 @@ public class Acidictive extends AcidCore
                }
 
                AcidCore.start(conf.uplink.host, conf.uplink.port, conf.serverinfo.name, conf.serverinfo.description, conf.uplink.pass, conf.serverinfo.id, conf.uplink.ssl);
-               
+
                acidcore_sql = SQL.getConnection("acidcore");
                if (acidcore_sql == null)
                {
                        log.log(Level.SEVERE, "Unable to get connection for `acidcore`");
                        System.exit(-1);
                }
-               
+
                loader = new ClassLoader(loaderBase);
                if (conf.clients != null)
                        for (Client c : conf.clients)
@@ -113,7 +113,7 @@ public class Acidictive extends AcidCore
                        User u = User.findUser(s);
                        if (!(u instanceof AcidUser))
                                continue;
-                       
+
                        ((AcidUser) u).introduce();
                }
 
@@ -229,7 +229,7 @@ public class Acidictive extends AcidCore
                        // strip leading "." if needed
                        String command = (parts[0].startsWith(conf.general.command_prefix) ? parts[0].substring(conf.general.command_prefix.length()) : parts[0]).toLowerCase();
                        String[] args = Arrays.copyOfRange(parts, 1, parts.length);
-                       
+
                        Channel c = null;
                        AcidUser to = null;
                        net.rizon.acid.conf.Command confCommand = null;
@@ -238,7 +238,7 @@ public class Acidictive extends AcidCore
                                c = Channel.findChannel(recipient);
                                if (c == null)
                                        return;
-                               
+
                                // lol?
                                for (String s : c.getUsers())
                                {
@@ -247,7 +247,7 @@ public class Acidictive extends AcidCore
                                        {
                                                AcidUser t = (AcidUser) u;
                                                net.rizon.acid.conf.Command cmd = t.findConfCommand(command);
-                                               
+
                                                if (cmd != null)
                                                {
                                                        to = t;
@@ -255,7 +255,7 @@ public class Acidictive extends AcidCore
                                                }
                                        }
                                }
-                               
+
                                if (to == null)
                                        return;
                        }
@@ -268,11 +268,11 @@ public class Acidictive extends AcidCore
                                User targ = User.findUser(recipient);
                                if (targ == null || !(targ instanceof AcidUser))
                                        return;
-                               
+
                                to = (AcidUser) targ;
                                confCommand = to.findConfCommand(command);
                        }
-                       
+
                        if (confCommand == null)
                                return;
 
@@ -280,11 +280,11 @@ public class Acidictive extends AcidCore
                        // by searching the plugin loaders.
                        Plugin p = to.pkg;
                        // Use our loader if there is no plugin
-                       ClassLoader cl = p != null ? p.loader : loader; 
+                       ClassLoader cl = p != null ? p.loader : loader;
                        Class<?> commandClass = cl.loadClass(confCommand.clazz);
                        if (commandClass == null)
                                return;
-                       
+
                        Command cmd = (Command) commandClass.newInstance();
 
                        if (recipient.startsWith("#"))
@@ -294,7 +294,7 @@ public class Acidictive extends AcidCore
                                {
                                        return; // Access
                                }
-                                       
+
                                // Now that we're in the right channel check for just being logged in OR +o OR spoof
                                if (x.getIdentNick().isEmpty() && !x.hasMode("o") && !x.getIP().equals("0"))
                                {
@@ -311,7 +311,7 @@ public class Acidictive extends AcidCore
                                        // Commands with no priv can not be executed in PM
                                        return;
                                }
-                                       
+
                                // Explicitly requires no privilege
                                if (confCommand.privilege.equals("none"))
                                        ;
@@ -343,7 +343,7 @@ public class Acidictive extends AcidCore
                        try
                        {
                                cmd.Run(x, to, c, args);
-                               
+
                                /* log SUCCESSFUL privmsg command usages as well
                                 * except help because that's just silly and nobody cares.
                                 */
@@ -365,7 +365,7 @@ public class Acidictive extends AcidCore
        public static void onCtcp(String creator, String recipient, String msg)
        {
                boolean stop = false;
-               
+
                if (msg.startsWith("\1VERSION"))
                {
                        User u = User.findUser(recipient);
@@ -376,7 +376,7 @@ public class Acidictive extends AcidCore
                                        Acidictive.notice(au.getUID(), creator, "\1VERSION " + au.client.version + "\1");
                        }
                }
-               
+
                for (Event e : Event.getEvents())
                {
                        stop = stop || e.onCTCP(creator, recipient, msg);
@@ -467,7 +467,7 @@ public class Acidictive extends AcidCore
                        for (int i = 0; i < x[0].length(); i++)
                        {
                                m = x[0].substring(i, i + 1);
-                               
+
                                if (m.equals("+"))
                                        give = true;
                                else if (m.equals("-"))
@@ -480,9 +480,9 @@ public class Acidictive extends AcidCore
                                                chan.setKey(x[whatnick]);
                                        else
                                                chan.setKey(null);
-                                       
+
                                        ++whatnick;
-                                       
+
                                        if (give)
                                                chan.setMode(m.charAt(0));
                                        else
@@ -497,7 +497,7 @@ public class Acidictive extends AcidCore
                                        }
                                        else
                                                chan.setLimit(0);
-                                       
+
                                        if (give)
                                                chan.setMode(m.charAt(0));
                                        else
@@ -530,17 +530,17 @@ public class Acidictive extends AcidCore
                                }
                        }
                }
-               
+
                for (Event e : Event.getEvents())
                        e.onChanModes(creator, chan, modes);
        }
-       
+
        public static void setMode(String source, String target, String modes)
        {
                Channel c = Channel.findChannel(target);
                if (c != null)
                        onChanMode(source, c, modes);
-               
+
                Protocol.mode(source, target, modes);
        }
 
@@ -581,7 +581,7 @@ public class Acidictive extends AcidCore
        {
                privmsg(conf.general.control, recipient, message);
        }
-       
+
        public static void privmsg(String source, String target, String message)
        {
                if (target.startsWith("#"))
@@ -606,7 +606,7 @@ public class Acidictive extends AcidCore
        {
                Protocol.notice(conf.general.control, recipient.getUID(), message);
        }
-       
+
        public static void notice(final String source, final String recipient, final String message)
        {
                Protocol.notice(source, recipient, message);
@@ -692,7 +692,7 @@ public class Acidictive extends AcidCore
                else
                        privmsg(target, msg);
        }
-       
+
        public static void reply(User source, AcidUser to, Channel c, String message)
        {
                if (c != null)
@@ -700,7 +700,7 @@ public class Acidictive extends AcidCore
                else
                        notice(to.getNick(), source.getNick(), message);
        }
-       
+
        public static void loadClients(Plugin pkg, List<Client> clients)
        {
                for (Client c : clients)
@@ -711,14 +711,14 @@ public class Acidictive extends AcidCore
                                if (u instanceof AcidUser)
                                {
                                        AcidUser au = (AcidUser) u;
-                                       
+
                                        // update config and plugin
                                        au.client = c;
                                        au.pkg = pkg;
                                }
                                continue;
                        }
-                       
+
                        AcidUser au = new AcidUser(pkg, c);
                        if (syncTime != 0)
                                au.introduce();
index feeb4d50fea38770e0744a16048189b8cb70c1af..5b056fe2bc48104ec00dbf29e39d02c87c608281 100644 (file)
@@ -9,7 +9,7 @@ import java.util.logging.Level;
 public class Channel
 {
        private static final Logger log = Logger.getLogger(Channel.class.getName());
-       
+
        private int ts;
        private String channel;
        // User list: nick => channel user status modes. TreeMap auto-sorts keys
@@ -22,15 +22,15 @@ public class Channel
        {
                this.ts = ts;
                this.channel = channel;
-               
+
                channelMap.put(channel.toLowerCase(), this);
        }
-       
+
        public void destroy()
        {
                channelMap.remove(this.channel.toLowerCase());
        }
-       
+
        public Set<String> getUsers()
        {
                return list.keySet();
@@ -57,16 +57,16 @@ public class Channel
        {
                return channel;
        }
-       
+
        public int getTS()
        {
                return ts;
        }
-       
+
        public void reset(int ts)
        {
                log.log(Level.FINE, "Lowering TS of " + channel + " from " + this.ts + " to " + ts);
-               
+
                this.ts = ts;
                for (Membership cm : list.values())
                        cm.clear();
@@ -79,43 +79,43 @@ public class Channel
        {
                return list.size();
        }
-       
+
        public void setMode(char mode)
        {
                if (modes.indexOf(mode) == -1)
                        modes += mode;
        }
-       
+
        public void unsetMode(char mode)
        {
                modes = modes.replace("" + mode, "");
        }
-       
+
        public boolean hasMode(char mode)
        {
                return modes.indexOf(mode) != -1;
        }
-       
+
        public String getKey()
        {
                return key;
        }
-       
+
        public int getLimit()
        {
                return limit;
        }
-       
+
        public void setKey(String key)
        {
                this.key = key;
        }
-       
+
        public void setLimit(int limit)
        {
                this.limit = limit;
        }
-       
+
        public String getModes(boolean full)
        {
                if (!full)
@@ -195,14 +195,14 @@ public class Channel
                        Acidictive.notice(target, regs.get(i));
                Acidictive.notice(target, "Listed " + (owners.size() + admins.size() + ops.size() + hops.size() + voices.size() + regs.size()) + " users that are currently in " + channel);
        }
-       
+
        private static HashMap<String, Channel> channelMap = new HashMap<String, Channel>();
-       
+
        public static Set<String> getChannels()
        {
                return channelMap.keySet();
        }
-       
+
        public static Channel findChannel(final String name)
        {
                return channelMap.get(name.toLowerCase());
index 2ed77617af882f93a518381467f271c6621d3666..c2d62220daab9e8ab01a8ce179cf7cc84f5764f0 100644 (file)
@@ -1,16 +1,16 @@
 package net.rizon.acid.core;
 
 public abstract class Command
-{      
+{
        private int min;
        private int max;
-       
+
        protected Command(int min, int max)
        {
                this.min = min;
                this.max = max;
        }
-       
+
        public void remove()
        {
        }
@@ -19,17 +19,17 @@ public abstract class Command
        {
                return this.min;
        }
-       
+
        public int GetMaxArgs()
        {
                return this.max;
        }
-       
+
        public abstract void Run(User source, AcidUser to, Channel c, final String[] args);
-       
+
        // For HELP COMMAND
        public boolean onHelpCommand(User u, AcidUser to, Channel c) { return false; }
-       
+
        // For just HELP
        public void onHelp(User u, AcidUser to, Channel c)
        {
index 9bb47ea3cb3307bdee886df9d657beaee6f8b473..7c104a64cdde4c3f7e6cf5ebc8acefdbce3e3713 100644 (file)
@@ -8,48 +8,48 @@ public abstract class Event
        {
                events.add(this);
        }
-       
+
        public void remove()
        {
                events.remove(this);
        }
-       
+
        public void onUserConnect(final User u) { }
-       
+
        public void onNickChange(final User u, final String oldnick) { }
-       
+
        public void onJoin(Channel channel, User[] users) { }
-       
+
        public void onPart(User user, Channel channel) { }
 
        public void onKick(String kicker, User victim, Channel channel, String reason) { }
-       
+
        public boolean onPrivmsg(final String creator, final String recipient, final String msg) { return false; }
        public void onCommandCertFPMismatch(final User u, final String certfp) { }
-       
+
        public boolean onNotice(final String creator, final String recipient, final String msg) { return false; }
-       
+
        public boolean onCTCP(final String creator, final String recipient, final String msg) { return false; }
        public void onCTCPReply(User source, String target, String message) { }
-       
+
        public void onSync() { }
        public void onEOB(Server server) { }
-       
+
        public void onKill(final String killer, User user, final String reason) { }
-       
+
        public void onQuit(User user, String msg) { }
-       
+
        public void onServerLink(Server server) { }
-       
+
        public void onServerDelink(Server server) { }
-       
+
        public void onUserMode(User user, String oldmodes, String newmodes) { }
        public void onChanModes(String prefix, Channel chan, String modes) { }
-       
+
        public void onRehash() throws Exception { }
-       
+
        private static LinkedList<Event> events = new LinkedList<Event>();
-       
+
        public static final Event[] getEvents()
        {
                Event[] a = new Event[events.size()];
index e5c09ec830236868da90972351c33d1ae2464ee4..ee480de9b09e0f3e193180427cf7f475815a5247 100644 (file)
@@ -60,7 +60,7 @@ public class Logger extends java.util.logging.Logger
 {
        private static HashMap<String, Logger> loggers = new HashMap<String, Logger>();
        private static final loggerHandler handler = new loggerHandler();
-       
+
        protected Logger(String name, String resourceBundleName)
        {
                super(name, resourceBundleName);
@@ -71,15 +71,15 @@ public class Logger extends java.util.logging.Logger
                Logger l = loggers.get(name);
                if (l != null)
                        return l;
-       
+
                l = new Logger(name, null);
                loggers.put(name, l);
-               
+
                l.setLevel(Level.ALL);
                l.addHandler(handler);
                return l;
        }
-       
+
        public void log(Exception ex)
        {
                this.log(Level.SEVERE, null, ex);
index fe7215dc9a3abf5f3f7b5a6d20da2d895a348db7..6faa50fc74aee80df7d7e783675f192d5daa26df 100644 (file)
@@ -15,7 +15,7 @@ public class Membership
                else
                        this.modes = modes;
        }
-       
+
        public void clear()
        {
                modes = "";
index e8c4366a320ab22dd5179bdc698005be888a6c07..c9020a19d4bb898d399e39e7a072c8b8f71820bb 100644 (file)
@@ -6,18 +6,18 @@ import java.util.logging.Level;
 public abstract class Message
 {
        public static final char BOLD = 2;
-       
+
        private static final String messageBase = "net.rizon.acid.messages";
        private static final String[] messageClasses = {
                "Encap", "EOB", "Error", "Join", "Kick", "Kill", "Mode", "Nick",
                "Notice", "Part", "Pass", "Ping", "Privmsg", "Quit", "Server", "SID",
                "SJoin", "SQuit", "Stats", "TMode", "UID", "Whois", "Operwall"
        };
-       
+
        static
        {
                messages = new HashMap<String, Message>();
-               
+
                try
                {
                        for (String s : messageClasses)
@@ -29,18 +29,18 @@ public abstract class Message
                        System.exit(-1);
                }
        }
-       
+
        protected Message(String name)
-       {       
+       {
                messages.put(name.toUpperCase(), this);
        }
-       
+
        public void onUser(User source, String[] params) { }
        public void onServer(Server source, String[] params) { }
        public void on(String source, String[] params) { }
-       
+
        private static HashMap<String, Message> messages;
-       
+
        public static Message findMessage(String name)
        {
                return messages.get(name.toUpperCase());
index 40f5f16763baa10cea78c1a1cb9bdd9721af9955..805302bd45505ee94cc58edfc02ed852ac41f828 100644 (file)
@@ -11,12 +11,12 @@ public abstract class Plugin
        private String name;
        private boolean permanent;
        public ClassLoader loader; // Loader for this class
-       
+
        protected Plugin()
        {
                plugins.add(this);
        }
-       
+
        public void remove()
        {
                for (User u : User.getUsersC())
@@ -40,22 +40,22 @@ public abstract class Plugin
        {
                return permanent;
        }
-       
+
        public String getName()
        {
                return name;
        }
-       
+
        public abstract void start() throws Exception;
        public abstract void stop();
        public void reload() throws Exception { }
-       
+
        public static Plugin loadPlugin(String name) throws Exception
        {
                Plugin p = findPlugin(name);
                if (p != null)
                        return p;
-               
+
                String finalName = name.substring(name.lastIndexOf('.') + 1);
 
                ClassLoader cl = new ClassLoader(name, pluginBase + name);
@@ -67,16 +67,16 @@ public abstract class Plugin
                p.start();
                return p;
        }
-       
+
        private static LinkedList<Plugin> plugins = new LinkedList<Plugin>();
-       
+
        public static final Plugin[] getPlugins()
        {
                Plugin[] a = new Plugin[plugins.size()];
                plugins.toArray(a);
                return a;
        }
-       
+
        public static Plugin findPlugin(String name)
        {
                for (Plugin p : plugins)
@@ -84,23 +84,23 @@ public abstract class Plugin
                                return p;
                return null;
        }
-       
+
        public static Plugin findPluginByClassName(String name)
        {
                if (!name.startsWith(Plugin.pluginBase))
                        return null;
-               
+
                name = name.substring(Plugin.pluginBase.length());
                int idx = name.indexOf('.');
                if (idx != -1)
                        name = name.substring(0, idx);
-               
+
                for (final Plugin p : plugins)
                {
                        if (p.getName().equals(name))
                                return p;
                }
-               
+
                return null;
        }
 }
index a4e96914716a594306d6eac49d8cfebe844feb82..fb9b2179df4735695cc79a30d382cd42d2f436d2 100644 (file)
@@ -5,22 +5,22 @@ import java.util.logging.Level;
 public class Protocol
 {
        private static final Logger log = Logger.getLogger(Protocol.class.getName());
-       
+
        private static void privmsgInternal(final String sender, final String recipient, String message)
        {
                AcidCore.sendln(":" + sender + " PRIVMSG " + recipient + " :" + message);
        }
-       
+
        private static void noticeInternal(final String sender, final String recipient, String message)
        {
                AcidCore.sendln(":" + sender + " NOTICE " + recipient + " :" + message);
        }
-       
+
        private static void encap(final String server, final String command, final String buffer)
        {
-               AcidCore.sendln(":" + AcidCore.me.getSID() + " ENCAP " + server + " " + command + " " + buffer); 
+               AcidCore.sendln(":" + AcidCore.me.getSID() + " ENCAP " + server + " " + command + " " + buffer);
        }
-       
+
        public static void privmsg(final String source, final String recipient, String msg)
        {
                String[] split = msg.split("\n");
@@ -35,7 +35,7 @@ public class Protocol
                        }
                        while (s.isEmpty() == false);
        }
-       
+
        public static void notice(final String source, final String recipient, String msg)
        {
                String[] split = msg.split("\n");
@@ -50,7 +50,7 @@ public class Protocol
                        }
                        while (s.isEmpty() == false);
        }
-       
+
        public static void join(User u, Channel c)
        {
                if (u.getServer() != AcidCore.me)
@@ -58,10 +58,10 @@ public class Protocol
                        log.log(Level.WARNING, "Fake direction for JOIN " + u.getServer().getName() + " <-> " + AcidCore.me.getName());
                        return;
                }
-               
+
                join(u, "", c);
        }
-       
+
        public static void join(User u, final String status, Channel c)
        {
                if (u.getServer() != AcidCore.me)
@@ -69,10 +69,10 @@ public class Protocol
                        log.log(Level.WARNING, "Fake direction for SJOIN " + u.getServer().getName() + " <-> " + AcidCore.me.getName());
                        return;
                }
-               
+
                AcidCore.sendln(":" + AcidCore.me.getSID() + " SJOIN " + AcidCore.getTS() + " " + c.getName() + " +" + c.getModes(true) + " :" + status + u.getUID());
        }
-       
+
        public static void part(User u, final String channel)
        {
                if (u.getServer() != AcidCore.me)
@@ -80,10 +80,10 @@ public class Protocol
                        log.log(Level.WARNING, "Fake direction for PART " + u.getServer().getName() + " <-> " + AcidCore.me.getName());
                        return;
                }
-               
+
                AcidCore.sendln(":" + u.getUID() + " PART " + channel);
        }
-       
+
        public static void quit(User u, final String reason)
        {
                if (u.getServer() != AcidCore.me)
@@ -91,10 +91,10 @@ public class Protocol
                        log.log(Level.WARNING, "Fake direction for QUIT " + u.getServer().getName() + " <-> " + AcidCore.me.getName());
                        return;
                }
-               
+
                AcidCore.sendln(":" + u.getUID() + " QUIT :" + reason);
        }
-       
+
        public static void kick(User u, final String channel, final String reason)
        {
                AcidCore.sendln(":" + AcidCore.me.getSID() + " KICK " + channel + " " + u.getUID() + " :" + reason);
@@ -110,62 +110,62 @@ public class Protocol
                // Add kill path or the reason gets broken
                AcidCore.sendln(":" + AcidCore.me.getSID() + " KILL " + target + " :" + AcidCore.me.getName() + " (" + reason + ")");
        }
-       
+
        public static void svskill(final String target)
        {
                encap("*", "SVSKILL", target);
        }
-       
+
        public static void noop(Server s)
        {
                encap(s.getName(), "SVSNOOP", "+");
        }
-       
+
        public static void unnoop(Server s)
        {
                encap(s.getName(), "SVSNOOP", "-");
        }
-       
+
        public static void capture(User u)
        {
                AcidCore.sendln(":" + AcidCore.me.getSID() + " CAPTURE " + u.getUID());
        }
-       
+
        public static void uncapture(User u)
        {
                AcidCore.sendln(":" + AcidCore.me.getSID() + " UNCAPTURE " + u.getUID());
        }
-       
+
        public static void svsmode(User u, final String modes)
        {
                encap("*", "SVSMODE", u.getUID() + " " + u.getNickTS() + " " + modes);
        }
-       
+
        public static void chgident(User u, final String host)
        {
                encap("*", "CHGIDENT", u.getUID() + " " + host);
        }
-       
+
        public static void chghost(User u, final String host)
        {
                encap("*", "CHGHOST", u.getUID() + " " + host);
        }
-       
+
        public static void svsnick(User u, final String newnick)
        {
                encap("*", "SVSNICK", u.getUID() + " " + u.getNickTS() + " " + newnick + " " + AcidCore.getTS());
        }
-       
+
        public static void svsjoin(User u, final String channel)
        {
                encap("*", "SVSJOIN", u.getUID() + " " + channel);
        }
-       
+
        public static void svspart(User u, final String channel)
        {
                encap("*", "SVSPART", u.getUID() + " " + channel);
        }
-       
+
        public static void resv(String source, Server s, final String what, final String reason)
        {
                AcidCore.sendln(":" + source + " RESV " + (s != null ? s.getName() : "*") + " " + what + " :" + reason);
@@ -175,52 +175,52 @@ public class Protocol
        {
                AcidCore.sendln(":" + source + " UNRESV * " + what);
        }
-       
+
        public static void wallop(final String source, final String what)
        {
                AcidCore.sendln(":" + source + " OPERWALL :" + what);
        }
-       
+
        public static void kline(final String source, int time, final String user, final String host, final String reason)
        {
                if (host.replaceAll("[*.?]", "").isEmpty())
                        return;
-               AcidCore.sendln(":" + source + " KLINE * " + time + " " + user + " " + host + " :" + reason); 
+               AcidCore.sendln(":" + source + " KLINE * " + time + " " + user + " " + host + " :" + reason);
        }
-       
+
        public static void unkline(final String source, final String user, final String host)
        {
                AcidCore.sendln(":" + source + " UNKLINE * " + user + " " + host);
        }
-       
+
        public static void mode(final String source, final String target, final String modes)
        {
                AcidCore.sendln(":" + source + " MODE " + target + " " + modes);
        }
-       
+
        public static void uid(User user)
        {
                // :99h UID deso 1 1233151144 +Saiowy deso canuck 0 99hAAAAAB 0 canuck :canuck
                // :99h UID <nick> <hops> <ts> +<umodes> <user> <vhost> <ip> <uid> <svsts> <realhost> :<geco>
                AcidCore.sendln(":" + AcidCore.me.getSID() + " UID " + user.getNick() + " 1 " + AcidCore.getTS() + " +" + user.getModes() + " " + user.getUser() + " " + user.getVhost() + " 0 " + user.getUID() + " 0 " + user.getHost() + " :" + user.getRealName());
        }
-       
+
        public static void sid(Server server)
        {
                // :geo.rizon.net SID irc.test.net 2 98C :JUPED
                AcidCore.sendln(":" + AcidCore.me.getSID() + " SID " + server.getName() + " " + (server.getHops() + 1) + " " + server.getSID() + " :" + server.getDescription());
        }
-       
-       public static void squit(Server server, final String reason) 
+
+       public static void squit(Server server, final String reason)
        {
                AcidCore.sendln(":" + AcidCore.me.getSID() + " SQUIT " + server.getName() + " :" + reason);
        }
-       
+
        public static void eob()
        {
                AcidCore.sendln(":" + AcidCore.me.getSID() + " EOB");
        }
-       
+
        public static void numeric(int num, final String what)
        {
                AcidCore.sendln(":" + AcidCore.me.getSID() + " " + num + " " + what);
index 8b8b587fc67d141f1a8c9ca50875922b46a0141a..6857d66a99724828888593fe759227d1e6fb6c1f 100644 (file)
@@ -27,13 +27,13 @@ public class Server
                syncTime = 0;
                this.burst = true;
                this.SID = SID;
-               
+
                sidMap.put(SID, this);
                serverMap.put(name.toLowerCase(), this);
-               
+
                log.log(Level.FINE, "New server: " + name + " (SID: " + SID + ") uplinked to " + (hub != null ? hub.getName() : "nothing"));
        }
-       
+
        public void onQuit()
        {
                sidMap.remove(SID);
@@ -69,12 +69,12 @@ public class Server
        {
                return users;
        }
-       
+
        public void incUsers()
        {
                ++this.users;
        }
-       
+
        public void decUsers()
        {
                --this.users;
@@ -84,7 +84,7 @@ public class Server
                        log.log(Level.WARNING, "User count for " + this.getName() + " managed to drop below 0?");
                }
        }
-       
+
        public boolean isBursting()
        {
                return this.burst;
@@ -99,7 +99,7 @@ public class Server
        {
                return hops;
        }
-       
+
        public boolean isJupe()
        {
                return (hub == AcidCore.me || hub.isUlined());
@@ -110,29 +110,29 @@ public class Server
        {
                return getName();
        }
-       
+
        public void finishBurst()
        {
                if (this.burst == false)
                        return;
-               
+
                this.syncTime = AcidCore.getTS();
                this.burst = false;
-               
+
                for (Iterator<String> it = Server.getServers().iterator(); it.hasNext();)
                {
                        Server serv = Server.findServer(it.next());
-                       
+
                        if (serv.getHub() == this)
                                serv.finishBurst();
                }
-               
+
                // If this server is finished syncing and it is uplinked directoy to me,
                // then we are finished syncing
                if (this.getHub() == AcidCore.me)
                        AcidCore.me.finishBurst();
        }
-       
+
        public int getLinkCount()
        {
                int count = 1;
@@ -140,14 +140,14 @@ public class Server
                for (Iterator<String> it = Server.getServers().iterator(); it.hasNext();)
                {
                        Server serv = Server.findServer(it.next());
-                       
+
                        if (serv.getHub() == this)
                                count += serv.getLinkCount();
                }
-               
+
                return count;
        }
-       
+
        public int getRecursiveUsers()
        {
                int count = this.getUsers();
@@ -155,11 +155,11 @@ public class Server
                for (Iterator<String> it = Server.getServers().iterator(); it.hasNext();)
                {
                        Server serv = Server.findServer(it.next());
-                       
+
                        if (serv.getHub() == this)
                                count += serv.getRecursiveUsers();
                }
-               
+
                return count;
        }
 
@@ -172,7 +172,7 @@ public class Server
        {
                return syncTime;
        }
-       
+
        public boolean isUlined()
        {
                for (String s : Acidictive.conf.general.ulines)
@@ -180,22 +180,22 @@ public class Server
                                return true;
                return false;
        }
-       
+
        private static HashMap<String, Server> sidMap = new HashMap<String, Server>();
        private static HashMap<String, Server> serverMap = new HashMap<String, Server>();
-       
+
        public static Server findServer(final String name)
        {
                if (name.length() == 3 && name.indexOf('.') == -1)
                        return sidMap.get(name);
                return serverMap.get(name.toLowerCase());
        }
-       
+
        public static final Set<String> getServers()
        {
                return serverMap.keySet();
        }
-       
+
        public static final String toName(final String sid)
        {
                Server s = findServer(sid);
@@ -203,12 +203,12 @@ public class Server
                        return s.getName();
                return sid;
        }
-       
+
        public static int serverCount()
        {
                return serverMap.size();
        }
-       
+
        public static Server[] sort(String method)
        {
                class ServerUsersComparator implements Comparator<Server>
@@ -241,7 +241,7 @@ public class Server
                Arrays.sort(e, comp);
                return e;
        }
-       
+
        public static String format(Server[] servers)
        {
                StringBuffer buf = new StringBuffer();
index 4420116e7def8bf66620364680e9dc4781d9ce1f..6a331ef01a5dd05108835c95ae28cbd1b3afdd69 100644 (file)
@@ -21,22 +21,22 @@ public abstract class Timer
                this.creation = new Date();
                this.tick = new Date(System.currentTimeMillis() + (time_from_now * 1000));
                this.time_from_now = time_from_now;
-               this.repeating = repeating;     
+               this.repeating = repeating;
                this.dead = false;
        }
-       
+
        public void start()
        {
                timers.add(this);
        }
-       
+
        public void stop()
        {
                this.dead = true;
        }
-       
+
        public abstract void run(final Date now);
-       
+
        public static void processTimers()
        {
                Date now = new Date();
@@ -46,7 +46,7 @@ public abstract class Timer
                for (int i = timers.size(); i >  0; --i)
                {
                        Timer t = timers.get(i - 1);
-                       
+
                        if (t.dead == false && now.after(t.tick))
                        {
                                try
@@ -63,11 +63,11 @@ public abstract class Timer
                                        t.tick = new Date(System.currentTimeMillis() + (t.time_from_now * 1000));
                        }
                }
-               
+
                for (Iterator<Timer> it = timers.iterator(); it.hasNext();)
                {
                        Timer t = it.next();
-                       
+
                        if (t.dead == true)
                                it.remove();
                }
index 41370c0a0de12d04eb66108909a469994a185809..077fc6f73b7d600bf3c0157e10b9cc13927bbfb6 100644 (file)
@@ -1,7 +1,5 @@
 package net.rizon.acid.core;
 
-import net.rizon.acid.conf.AccessPreset;
-
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -14,6 +12,8 @@ import java.util.Iterator;
 import java.util.Set;
 import java.util.logging.Level;
 
+import net.rizon.acid.conf.AccessPreset;
+
 public class User implements Comparable<User>
 {
        private static final Logger log = Logger.getLogger(User.class.getName());
@@ -68,7 +68,7 @@ public class User implements Comparable<User>
                this.getServer().decUsers();
                if (!(this instanceof AcidUser))
                        UserList.decreaseHost(this.ip);
-               
+
                uidMap.remove(UID);
                nickMap.remove(nick.toLowerCase());
        }
@@ -197,9 +197,9 @@ public class User implements Comparable<User>
        {
                if (mode.equals("") || mode == null)
                        return;
-               
+
                String old = modes;
-               
+
                boolean plus = true;
                String chr;
                for (int x = 0; x < mode.length(); x++)
@@ -224,7 +224,7 @@ public class User implements Comparable<User>
                                modes = modes.replaceAll(chr, "");
                        }
                }
-               
+
                for (Event e : Event.getEvents())
                        e.onUserMode(this, old, modes);
        }
@@ -284,9 +284,9 @@ public class User implements Comparable<User>
        {
                if (flags.isEmpty())
                        return false;
-               
+
                String my_flags = this.flags;
-               
+
                for (AccessPreset p : Acidictive.conf.access_preset)
                {
                        for (String s : p.name)
@@ -295,11 +295,11 @@ public class User implements Comparable<User>
                                flags = flags.replace(s, p.privileges);
                        }
                }
-               
+
                for (int i = 0; i < flags.length(); ++i)
                        if (my_flags.indexOf(flags.charAt(i)) == -1)
                                return false;
-               
+
                return true;
        }
 
@@ -312,22 +312,22 @@ public class User implements Comparable<User>
        {
                return modes;
        }
-       
+
        public String getCertFP()
        {
                return certfp;
        }
-       
+
        public void setCertFP(String certfp)
        {
                this.certfp = certfp;
        }
-       
+
        public String getAuthFlags()
        {
                return authflags;
        }
-       
+
        public void setAuthFlags(String authflags)
        {
                this.authflags = authflags;
@@ -337,12 +337,12 @@ public class User implements Comparable<User>
        {
                return su;
        }
-       
+
        public void setSU(String su)
        {
                this.su = su;
        }
-       
+
        @Override
        public int compareTo(User user)
        {
@@ -457,9 +457,9 @@ public class User implements Comparable<User>
        {
                return nickMap.size();
        }
-       
+
        private static char[] currentUid = new char[] { 'A', 'A', 'A', 'A', 'A', '@' };
-       
+
        public static String generateUID()
        {
                for (int i = 5; i >= 0; --i)
@@ -477,7 +477,7 @@ public class User implements Comparable<User>
                        else
                                currentUid[i] = 'A';
                }
-               
+
                return AcidCore.me.getSID() + new String(currentUid);
        }
 }
index fc4ba1d2d165c78ceb5bd7ac2db98f840721d9f0..5ab866fce661b6dc547848c584f689cbf4926dea 100644 (file)
@@ -7,7 +7,7 @@ import java.util.Iterator;
 public class UserList
 {
        private static final Hashtable<String, Integer> ipList = new Hashtable<String, Integer>();
-       
+
        public static User[] findUsersByHost(String ip)
        {
                if (ip == null || ip.equalsIgnoreCase(""))
@@ -30,7 +30,7 @@ public class UserList
                return null;
 
        }
-       
+
        public static User locateNick(String nick)
        {
                for (Iterator<String> it = User.getUsers().iterator(); it.hasNext();)
@@ -75,7 +75,7 @@ public class UserList
                        x.clearFlood();
                }
        }
-       
+
        public static String globToRegex(String glob)
        {
                StringBuilder regex = new StringBuilder("^");
@@ -107,7 +107,7 @@ public class UserList
                }
                return regex.append("$").toString();
        }
-       
+
        public static void increaseHost(final String ip)
        {
                Integer hosts = ipList.get(ip);
@@ -116,7 +116,7 @@ public class UserList
                else
                        ipList.put(ip, hosts + 1);
        }
-       
+
        public static void decreaseHost(final String ip)
        {
                int hosts = ipList.get(ip);
@@ -125,7 +125,7 @@ public class UserList
                else
                        ipList.put(ip, hosts - 1);
        }
-       
+
        public static int getUserCountForIP(final String ip)
        {
                Integer hosts = ipList.get(ip);
index 9b2018ff332e36449645bb0a401240f3f94dbed1..a15f029e8a8a2f39f53e1e314cc24cda4bc1c19e 100644 (file)
@@ -11,9 +11,9 @@ public class EOB extends Message
        {
                super("EOB");
        }
-       
+
        // :00C EOB
-       
+
        @Override
        public void onServer(Server server, String[] params)
        {
index 0f6832d16b9bb9f9758c8c34990fd8bba7061a73..1cd2a0dd274594db113a64dc691befadafddd387 100644 (file)
@@ -11,7 +11,7 @@ public class Encap extends Message
        {
                super("ENCAP");
        }
-       
+
        @Override
        public void onServer(Server source, String[] params)
        {
index 880c0e91195bf5064285d748d0a97fc262ea4b56..171a8322b3d65634abdeedc0f3267ff6f59dd734 100644 (file)
@@ -9,7 +9,7 @@ public class Error extends Message
        {
                super("ERROR");
        }
-       
+
        @Override
        public void on(String source, String[] params)
        {
index ffa4d656c3079f3af13669b6c979b67b9af085d0..27dfa2413b399dfd673f05c0c563a7c8b87fb70f 100644 (file)
@@ -11,9 +11,9 @@ public class Join extends Message
        {
                super("JOIN");
        }
-       
+
        // :4SSAAAATV JOIN 1218474093 #oper +
-       
+
        @Override
        public void onUser(User u, String[] params)
        {
index 8a1a373d0a1e68dbf23f6fd6ee32fd8245f3c015..fa93c60057c64a0f2f1a7bc0876a1ae17a46131d 100644 (file)
@@ -1,5 +1,7 @@
 package net.rizon.acid.messages;
 
+import java.util.logging.Level;
+
 import net.rizon.acid.core.AcidCore;
 import net.rizon.acid.core.Acidictive;
 import net.rizon.acid.core.Channel;
@@ -7,17 +9,15 @@ import net.rizon.acid.core.Message;
 import net.rizon.acid.core.Server;
 import net.rizon.acid.core.User;
 
-import java.util.logging.Level;
-
 public class Kick extends Message
 {
        public Kick()
        {
                super("KICK");
        }
-       
+
        // :99hAAAAAB KICK #geo 99hAAAAAB :Lame and fake
-       
+
        @Override
        public void on(String source, String[] params)
        {
index abac7c99ca4758c3d30a02777f1b14c5014c590e..7d74e3113d66322aea9b866e6bedb98e20663395 100644 (file)
@@ -11,9 +11,9 @@ public class Kill extends Message
        {
                super("KILL");
        }
-       
+
        // :pdi KILL kenzie :the.hub!staff.rizon.net!pdi!pdi (testing)
-       
+
        @Override
        public void on(String source, String[] params)
        {
index 514751359d1c5ffb6e072fc1bb377ad21fc4aa5d..0aadc1113bb21b9e73f5636075da3ccc985ba04a 100644 (file)
@@ -13,9 +13,9 @@ public class Mode extends Message
        {
                super("MODE");
        }
-       
+
        // :99hAAAAAB MODE 99hAAAAAB :-y
-       
+
        @Override
        public void on(String source, String[] params)
        {
index 0775b903c306e709eb892006de9f4aad2d034d7b..b70c20af928f6c2f2c42125d574711c109ee8c16 100644 (file)
@@ -10,9 +10,9 @@ public class Nick extends Message
        {
                super("NICK");
        }
-       
+
        // :99hAAAAAB NICK wild :1233188135
-       
+
        @Override
        public void onUser(User u, String[] params)
        {
index 151e9608750a0a613fdae5d22ff77ee0ce23d085..dc75c4eb5b19959904bff3f77bdea66766dcc6e8 100644 (file)
@@ -10,9 +10,9 @@ public class Notice extends Message
        {
                super("NOTICE");
        }
-       
+
        // :99hAAAAAB NOTICE moo :BOO !
-       
+
        @Override
        public void onUser(User sender, String[] params)
        {
index 0cf0b56765029ec6ee15c13dc04029858c6ca301..f3d0676a8958c4055fde8a278213336e499d8e4a 100644 (file)
@@ -1,10 +1,5 @@
 package net.rizon.acid.messages;
 
-import java.util.logging.Level;
-
-import net.rizon.acid.core.AcidCore;
-import net.rizon.acid.core.Acidictive;
-import net.rizon.acid.core.Channel;
 import net.rizon.acid.core.Message;
 import net.rizon.acid.core.User;
 
@@ -14,9 +9,9 @@ public class Operwall extends Message
        {
                super("OPERWALL");
        }
-       
+
        // :OperServ OPERWALL :USERS: py-ctcp!ctcp@ctcp-scanner.rizon.net is now an IRC operator.
-       
+
        @Override
        public void onUser(User u, String[] params)
        {
index c47a4d93c2d40d86d366bdacc5ca7bf51e3bafb9..d96906cea89c91e99fd3c9aa49f7c8114315ed58 100644 (file)
@@ -1,22 +1,22 @@
 package net.rizon.acid.messages;
 
+import java.util.logging.Level;
+
 import net.rizon.acid.core.AcidCore;
 import net.rizon.acid.core.Acidictive;
 import net.rizon.acid.core.Channel;
 import net.rizon.acid.core.Message;
 import net.rizon.acid.core.User;
 
-import java.util.logging.Level;
-
 public class Part extends Message
 {
        public Part()
        {
                super("PART");
        }
-       
+
        // :99hAAAAAB PART #geo
-       
+
        @Override
        public void onUser(User u, String[] params)
        {
index dc75ab39d4b537253328bad31ac49ec082ee5e22..f82d5df63a8efdfa5f52709413d4062cde6e2f1a 100644 (file)
@@ -5,12 +5,12 @@ import net.rizon.acid.core.Message;
 public class Pass extends Message
 {
        public static String LinkSID;
-       
+
        public Pass()
        {
                super("PASS");
        }
-       
+
        @Override
        public void on(String source, String[] params)
        {
index 3ed2f532ccc24d62dcdfd66da0d9a9a7fc111dfc..b2b3393986a07434ad820902328defccfb9c036c 100644 (file)
@@ -9,7 +9,7 @@ public class Ping extends Message
        {
                super("PING");
        }
-       
+
        @Override
        public void on(String source, String[] params)
        {
index 4be6d4f03b4b32e3b0f51172e529ccb93d7fda1c..c083a9e0c6a3d7d452c9b29876628109003c420f 100644 (file)
@@ -14,9 +14,9 @@ public class Privmsg extends Message
        {
                super("PRIVMSG");
        }
-       
+
        // :99hAAAAAB PRIVMSG moo :hi there
-       
+
        @Override
        public void onUser(User sender, String[] params)
        {
index 21f89b2928fc2a267df6a07a86240470bdfb502f..c8b45399146f398623dd85b40b2972423865833b 100644 (file)
@@ -10,9 +10,9 @@ public class Quit extends Message
        {
                super("QUIT");
        }
-       
+
        // :99hAAAAAA QUIT :Quit: moo
-       
+
        @Override
        public void onUser(User x, String[] params)
        {
index 08ad88bfcaa4c7e4ee463f660cf3c7591e16206f..fdbc37d11cad21d6b925848c831d71ad3f0a641a 100644 (file)
@@ -13,11 +13,11 @@ public class SID extends Message
        {
                super("SID");
        }
-       
+
        // :8OL SID irc.lolinator.net 6 17C :Rizon Client Server
        // :4SS SID services.l2thorn.com 2 00H :Services for L2Thorn IRC Network
        // :4SS SID irc.dev.cccp-project.net 2 99S :Communist Bitch ass Monkey whore
-       
+
        @Override
        public void onServer(Server from, String[] params)
        {
index a5ecc4583798b005188cc7d8861f8eee66ede50d..a6835b1567b4f0d0a0bab28085a28725be8f0a0a 100644 (file)
@@ -1,5 +1,7 @@
 package net.rizon.acid.messages;
 
+import java.util.logging.Level;
+
 import net.rizon.acid.core.AcidCore;
 import net.rizon.acid.core.Acidictive;
 import net.rizon.acid.core.Channel;
@@ -7,19 +9,17 @@ import net.rizon.acid.core.Message;
 import net.rizon.acid.core.Server;
 import net.rizon.acid.core.User;
 
-import java.util.logging.Level;
-
 public class SJoin extends Message
 {
        public SJoin()
        {
                super("SJOIN");
        }
-       
+
        // :4SS SJOIN 1233194735 #c +nt :@4SSAAAATV
        // :80C SJOIN 1233634716 #DontJoinItsATrap +npstz :80CAACM7J
        // :42C SJOIN 1233634716 #DontJoinItsATrap +mnpstz :
-       
+
        private static String stripUser(String user)
        {
                user = user.replaceAll("\\@|\\%", "");
@@ -27,7 +27,7 @@ public class SJoin extends Message
                user = user.replaceAll("\\&|\\~", "");
                return user;
        }
-       
+
        private static String getModes(String x)
        {
                String modes = "";
@@ -49,14 +49,14 @@ public class SJoin extends Message
                return modes;
        }
 
-       
+
        @Override
        public void onServer(Server source, String[] params)
        {
                String sts = params[0], channel = params[1], modes = params[2], nicks = params[params.length - 1];
                for (int i = 3; i < params.length - 1; ++i)
                        modes += " " + params[i];
-               
+
                int ts = Integer.parseInt(sts);
 
                boolean keep_their_modes = true;
index c081f2b983e61a3103b340ae79cfa6767f57fa33..f0cbcb19631843c553acbd0f762b1cd155a06b04 100644 (file)
@@ -13,10 +13,10 @@ public class SQuit extends Message
        {
                super("SQUIT");
        }
-       
+
        // SQUIT test.geodns.org :irc.geodns.org
        // SQUIT 98C :jupe over
-       
+
        @Override
        public void on(String source, String[] params)
        {
index 274746091de07254b9cf2ff713533ce479fe3a24..f628141e0e46474e43b9660b6f766f329bcabaec 100644 (file)
@@ -10,9 +10,9 @@ public class Server extends Message
        {
                super("SERVER");
        }
-       
+
        //SERVER rizon.hub 1 :Rizon IRC Network - Client Server
-       
+
        @Override
        public void on(String source, String[] params)
        {
index 373a94f6f7677ffd6bf07f6e08b8e1da1b02c39d..eaf90122c4facb72eddd7a7159e80e7a0ad41789 100644 (file)
@@ -1,13 +1,14 @@
 package net.rizon.acid.messages;
 
-import net.rizon.acid.core.Acidictive;
-import net.rizon.acid.core.Message;
-import net.rizon.acid.core.Protocol;
-
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
+import net.rizon.acid.core.AcidCore;
+import net.rizon.acid.core.Acidictive;
+import net.rizon.acid.core.Message;
+import net.rizon.acid.core.Protocol;
+
 public class Stats extends Message
 {
        public Stats()
@@ -22,7 +23,7 @@ public class Stats extends Message
        {
                String letter = params[0];
 
-               if (!params[1].equalsIgnoreCase(Acidictive.me.getName()))
+               if (!params[1].equalsIgnoreCase(AcidCore.me.getName()))
                {
                        Protocol.numeric(219, source + " " + letter + " :End of /STATS report");
                        return;
index 170071b943bec124f5eb9cad841d910a9606232e..c24b529436d2f42d909864608647db2a412ebe6a 100644 (file)
@@ -15,9 +15,9 @@ public class TMode extends Message
        {
                super("TMODE");
        }
-       
+
        // :4SSAAAAWB TMODE 1233718499 #a -sOb blah!*@*
-       
+
        @Override
        public void on(String source, String[] params)
        {
@@ -33,7 +33,7 @@ public class TMode extends Message
                Channel chan = Channel.findChannel(params[1]);
                if (chan == null)
                        return;
-               
+
                int ts;
                try
                {
@@ -44,7 +44,7 @@ public class TMode extends Message
                        ex.printStackTrace();
                        return;
                }
-               
+
                if (ts > chan.getTS())
                        return;
 
@@ -53,7 +53,7 @@ public class TMode extends Message
                        modes += " " + params[i];
 
                Acidictive.onChanMode(setter, chan, modes);
-               
+
                if (chan.size() == 0 && !chan.hasMode('z'))
                        chan.destroy();
        }
index 59f461a999cd6cdaa9e618934c40849074097aa0..1d2a19f794f085371e5e8290ffacacf29d9642c4 100644 (file)
@@ -12,10 +12,10 @@ public class UID extends Message
        {
                super("UID");
        }
-       
+
        // :00C UID Adam 1 1317939198 +aiow ~Adam 192.168.1.2 192.168.1.2 00CAAAAAA 0 192.168.1.2 :Adam
        // source UID 0-nick 1-hops 2-ts 3-umode 4-username 5-hostname 6-ip 7-uid 8-servicesstamp 9-realhost 10-realname
-       
+
        @Override
        public void onServer(Server source, String[] params)
        {
index 51e43d7cd2b91abd1dfee6a5e818f711f5770083..3077fb605627c34220f2307c5f9e7f1b25216448 100644 (file)
@@ -14,9 +14,9 @@ public class Whois extends Message
        {
                super("WHOIS");
        }
-       
+
        // :4SSAAAAXT WHOIS Acidictive :Acidictive
-       
+
        @Override
        public void onUser(User whoiser, String[] params)
        {
index 701901274f1fecb870c01c00a528bd22cd4f2924..5060726343c2704fb760e5ed9aa3b7b5decba1e5 100644 (file)
@@ -1,9 +1,5 @@
 package net.rizon.acid.sql;
 
-import net.rizon.acid.conf.Database;
-import net.rizon.acid.core.Acidictive;
-import net.rizon.acid.core.Logger;
-
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
@@ -12,6 +8,10 @@ import java.sql.SQLException;
 import java.util.LinkedList;
 import java.util.logging.Level;
 
+import net.rizon.acid.conf.Database;
+import net.rizon.acid.core.Acidictive;
+import net.rizon.acid.core.Logger;
+
 public class SQL extends Thread
 {
        private static final Logger log = Logger.getLogger(SQL.class.getName());
@@ -156,7 +156,7 @@ public class SQL extends Thread
                        return this.pendingQueries.size();
                }
        }
-       
+
        public void setAutoCommit(boolean state) throws SQLException
        {
                this.con.setAutoCommit(state);
@@ -214,18 +214,18 @@ public class SQL extends Thread
                        lastWarn = now;
                }
        }
-       
+
        public static SQL getConnection(final String name)
        {
                SQL sql = null;
-               
+
                try
                {
                        for (Database d : Acidictive.conf.database)
                        {
                                if (!d.name.equals(name))
                                        continue;
-                               
+
                                return sql = new SQL(d.host, d.user, d.pass);
                        }
                }
@@ -237,7 +237,7 @@ public class SQL extends Thread
                {
                        throw new RuntimeException(e.getMessage());
                }
-               
+
                return sql;
        }
 }
index d4c66bbfc8ae354aa21a2ad9fd3a1ad4a2f9f435..dbc061b17d5c47e83f75ed813f9fcd898ce5c480 100644 (file)
@@ -13,7 +13,7 @@ public final class ClassLoader extends URLClassLoader
 {
        private static final Logger log = Logger.getLogger(ClassLoader.class.getName());
        private String plugin;
-       
+
        public ClassLoader(String plugin, String classname)
        {
                super(new URL[0]);
@@ -21,7 +21,7 @@ public final class ClassLoader extends URLClassLoader
                File jar = null;
 
                this.plugin = plugin;
-               
+
                if (plugin != null)
                {
                        String pluginPath = plugin.replaceAll("\\.", "/");
@@ -101,7 +101,7 @@ public final class ClassLoader extends URLClassLoader
        {
                return loadClassRecurse(name, true);
        }
-       
+
        private Class<?> loadClassRecurse(String name, boolean recurse) throws ClassNotFoundException
        {
                try
@@ -119,7 +119,7 @@ public final class ClassLoader extends URLClassLoader
                                        catch (ClassNotFoundException ex2)
                                        {
                                        }
-                       
+
                        throw ex;
                }
        }
index a95ce9b14ca96f9c40894437af4ec7a03dad864b..8b4b0805c87388850b7382c0563e8234b2bfff6b 100644 (file)
@@ -19,16 +19,16 @@ import net.rizon.acid.core.Logger;
 public class EMail
 {
        private static final Logger log = Logger.getLogger(EMail.class.getName());
-       
+
        public EMail(String to, String subject, String msg)
        {
                Properties mailprops = new Properties();
                mailprops.put("mail.smtp.host", Acidictive.conf.general.email_smtp);
                if (Acidictive.conf.debug)
                        mailprops.put("mail.debug", "true");
-               
+
                Session session = Session.getInstance(mailprops);
-               
+
                try
                {
                        Message m = new MimeMessage(session);
index 7a6a589ac5d839253b9d0daa5c9d1ba2cd99461d..4cd547982e63770bd4c679a9bd3417f3d770c9f3 100644 (file)
@@ -86,7 +86,7 @@ public class Util
                        return false;
                }
        }
-       
+
 
        public static int getSeconds(String time) throws NumberFormatException
        {
@@ -114,7 +114,7 @@ public class Util
                }
                return rtime;
        }
-       
+
        public static String fTime(int seconds)
        {
                int weeks = seconds / 604800;
@@ -165,7 +165,7 @@ public class Util
                }
                return str.toString();
        }
-       
+
        public static String safeRegex(String str)
        {
                String sr = "";
@@ -234,7 +234,7 @@ public class Util
                }
                return sr;
        }
-       
+
        public static String randomString(int length)
        {
                Random rand = new Random();
@@ -247,7 +247,7 @@ public class Util
        }
 
        private static String randChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-       
+
        public static String formatTime(int seconds)
        {
                int weeks = seconds / 604800;
index 6c129c3de536763c66a866bc872d9a8a96f7fa18..b4aec61ab1a25117b88c7ed21c2d6763e07f0de8 100644 (file)
@@ -1,7 +1,6 @@
 package net.rizon.acid.plugins.pyva.core;
 
 import net.rizon.acid.core.Plugin;
-import net.rizon.acid.util.ClassLoader;
 
 public class core extends Plugin
 {
index d678e9b7a1ad4ab20a3b75e531d3aa9ffafe4651..dc14798cb88a6746442088aa3322679f91db0321 100644 (file)
@@ -13,7 +13,7 @@ public class GC extends Command
        {
                super(0, 0);
        }
-       
+
        @Override
        public void Run(User x, AcidUser to, Channel c, final String[] args)
        {
index 86aea62eeb3f060ea8aaff3583aef6beea5f4741..f46d9deebe104b0ea9a60141125ca761c06712ee 100644 (file)
@@ -14,7 +14,7 @@ import net.rizon.pyva.PyvaException;
 public class Plugins extends Command
 {
        private static final Logger log = Logger.getLogger(Plugins.class.getName());
-       
+
        public Plugins()
        {
                super(1, 2);
@@ -33,7 +33,7 @@ public class Plugins extends Command
                        log.log(Level.WARNING, "Unable to get current plugins", e);
                        return;
                }
-               
+
                if (args[0].equalsIgnoreCase("LIST"))
                {
                        for (String s : loaded)
@@ -48,7 +48,7 @@ public class Plugins extends Command
                                        Acidictive.reply(u, to, c, s + " is already loaded.");
                                        return;
                                }
-                       
+
                        try
                        {
                                pyva.loadPyvaPlugin(args[1]);
@@ -65,13 +65,13 @@ public class Plugins extends Command
                        for (String s : loaded)
                                if (s.equalsIgnoreCase(args[1]))
                                        found = true;
-                       
+
                        if (!found)
                        {
                                Acidictive.reply(u, to, c, args[1] + " is not loaded");
                                return;
                        }
-                       
+
                        try
                        {
                                pyva.unloadPyvaPlugin(args[1]);
index a760d67ed657bf3e71b040c63e2ad38d8f7aade4..32b9d601fef609bd1a473f199bd11653d29c7971 100644 (file)
@@ -1,5 +1,9 @@
 package net.rizon.acid.plugins.pyva.pyva;
 
+import java.util.Arrays;
+import java.util.Date;
+import java.util.logging.Level;
+
 import net.rizon.acid.core.Acidictive;
 import net.rizon.acid.core.Channel;
 import net.rizon.acid.core.Event;
@@ -11,10 +15,6 @@ import net.rizon.acid.plugins.pyva.pyva.conf.Config;
 import net.rizon.pyva.Pyva;
 import net.rizon.pyva.PyvaException;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.logging.Level;
-
 class PyvaEvent extends Event
 {
        @Override
@@ -22,14 +22,14 @@ class PyvaEvent extends Event
        {
                this.call("onUserConnect", u);
        }
-       
+
        @Override
        public void onJoin(Channel channel, final User[] users)
        {
                for (User u : users)
                        this.call("onJoin", u, channel.getName());
        }
-       
+
        @Override
        public void onPart(User user, Channel channel)
        {
@@ -47,7 +47,7 @@ class PyvaEvent extends Event
        {
                this.call("onQuit", user, msg);
        }
-       
+
        @Override
        public boolean onPrivmsg(String creator, String recipient, final String msg)
        {
@@ -56,7 +56,7 @@ class PyvaEvent extends Event
                this.call("onPrivmsg", creator, recipient, msg);
                return false;
        }
-       
+
        @Override
        public boolean onNotice(String creator, String recipient, final String msg)
        {
@@ -65,7 +65,7 @@ class PyvaEvent extends Event
                this.call("onNotice", creator, recipient, msg);
                return false;
        }
-       
+
        @Override
        public boolean onCTCP(final String creator, final String recipient, final String msg)
        {
@@ -90,7 +90,7 @@ class PyvaEvent extends Event
        {
                this.call("onChanModes", prefix, chan.getName(), modes);
        }
-       
+
        private void call(String name, Object... params)
        {
                try
@@ -128,24 +128,24 @@ public class pyva extends Plugin
        public static Pyva pyva;
 
        private Event e;
-       
+
        @Override
        public void start() throws Exception
        {
                reload();
 
                pyva = new Pyva();
-               
+
                for (String path : conf.path)
                        pyva.addToSystemPath(path);
 
                pyva.init();
 
                e = new PyvaEvent();
-               
+
                for (String plugin : conf.plugins)
                        loadPyvaPlugin(plugin);
-               
+
                t = new GCTimer();
                t.start();
        }
@@ -154,9 +154,9 @@ public class pyva extends Plugin
        public void stop()
        {
                t.stop();
-               
+
                e.remove();
-               
+
                try
                {
                        for (String plugin : conf.plugins)
@@ -174,10 +174,10 @@ public class pyva extends Plugin
        public void reload() throws Exception
        {
                conf = (Config) net.rizon.acid.conf.Config.load("pyva.yml", Config.class);
-               
+
                Acidictive.loadClients(this, conf.clients);
        }
-       
+
        public static void loadPyvaPlugin(String name) throws PyvaException
        {
                pyva.invoke("plugin", "loadPlugin", name);
@@ -194,7 +194,7 @@ public class pyva extends Plugin
                String[] stringArray = Arrays.copyOf(obj, obj.length, String[].class);
                return stringArray;
        }
-       
+
        public static void call(String name, Object... args) throws PyvaException
        {
                Object[] object = new Object[args.length + 1];
index 3653e49724f662da1ec2db8102374a27ce097fb0..55e990e7d31dde93361b7ff5063cbff23b651d6c 100644 (file)
@@ -1,11 +1,11 @@
 package net.rizon.acid.plugins.trapbot;
 
-import net.rizon.acid.core.Timer;
-
 import java.util.Date;
 import java.util.Iterator;
 import java.util.Map;
 
+import net.rizon.acid.core.Timer;
+
 class ExpireTimer extends Timer
 {
        ExpireTimer()
index 811c9b70a76b2f99bd1c63f8382d235ca22a70ec..bb2ea9d3b557ffb6fe6e49e659bf4012e1042180 100644 (file)
@@ -1,12 +1,12 @@
 package net.rizon.acid.plugins.trapbot;
 
+import java.util.Date;
+import java.util.Random;
+
 import net.rizon.acid.core.Message;
 import net.rizon.acid.core.Protocol;
 import net.rizon.acid.core.Timer;
 
-import java.util.Date;
-import java.util.Random;
-
 class ReleaseTimer extends Timer
 {
        ReleaseTimer()
index 70e68cc87a1a8eb643ec2dcfd98f24d523af956b..364ff3acc224b4ecad25ce84a99a31d8c8241b52 100644 (file)
@@ -1,11 +1,11 @@
 package net.rizon.acid.plugins.trapbot;
 
+import java.util.Date;
+
 import net.rizon.acid.core.Message;
 import net.rizon.acid.core.Protocol;
 import net.rizon.acid.core.Timer;
 
-import java.util.Date;
-
 class RetrapTimer extends Timer
 {
        RetrapTimer(long time_from_now, boolean repeating)
index e66bbc722c2092518a68cb145d0fd9a05b1dc4b0..42c4473dc1f81af231d4be47fd12e3f2efcc997a 100644 (file)
@@ -1,5 +1,6 @@
 package net.rizon.acid.plugins.trapbot.commands;
 
+import net.rizon.acid.core.AcidCore;
 import net.rizon.acid.core.AcidUser;
 import net.rizon.acid.core.Acidictive;
 import net.rizon.acid.core.Channel;
@@ -20,7 +21,7 @@ public class Untrap extends Command
        {
                User u = User.findUser(args[0]);
 
-               if (u == null || u.getServer() == Acidictive.me || u.getServer().isUlined())
+               if (u == null || u.getServer() == AcidCore.me || u.getServer().isUlined())
                {
                        Acidictive.reply(x, to, c, "Cannot find user \2" + args[0] + "\2.");
                        return;
index dcbd0e5f2c9c226a98a53498998a91a8611436c8..394f57426e772597091f817abd652af40d925550 100644 (file)
@@ -1,11 +1,11 @@
 package net.rizon.acid.plugins.trapbot.conf;
 
+import java.util.List;
+
 import net.rizon.acid.conf.Client;
 import net.rizon.acid.conf.ConfigException;
 import net.rizon.acid.conf.Configuration;
 
-import java.util.List;
-
 public class Config extends Configuration
 {
        public List<Client> clients;
index ac8c4d041c7d029815f7bc9efe6093cd3ed25eec..d9d72ea2100bbcd1bdba8ffb479984c251f17916 100644 (file)
@@ -1,5 +1,8 @@
 package net.rizon.acid.plugins.trapbot;
 
+import java.util.HashMap;
+
+import net.rizon.acid.core.AcidCore;
 import net.rizon.acid.core.AcidUser;
 import net.rizon.acid.core.Acidictive;
 import net.rizon.acid.core.Event;
@@ -9,8 +12,6 @@ import net.rizon.acid.core.Timer;
 import net.rizon.acid.core.User;
 import net.rizon.acid.plugins.trapbot.conf.Config;
 
-import java.util.HashMap;
-
 public class trapbot extends Plugin
 {
        protected static final Logger log = Logger.getLogger(trapbot.class.getName());
@@ -52,7 +53,7 @@ public class trapbot extends Plugin
 
        public static void updateTrap(User u)
        {
-               if (u.getServer() == Acidictive.me || u.getServer().isUlined())
+               if (u.getServer() == AcidCore.me || u.getServer().isUlined())
                        return;
 
                /* ignore spoofed users */