return null;
}
- public net.rizon.acid.conf.Command findConfCommand(final String name)
+ public net.rizon.acid.conf.Command findConfCommand(String name, String channel)
{
if (client != null && this.client.commands != null)
for (net.rizon.acid.conf.Command c : this.client.commands)
- if (c.name.equalsIgnoreCase(name))
+ if (c.name.equalsIgnoreCase(name) && c.allowsChannel(channel))
return c;
return null;
}
}
}
}
- else
- return;
}
// Not destined for anything else, must be a command.
if (u instanceof AcidUser)
{
AcidUser t = (AcidUser) u;
- net.rizon.acid.conf.Command cmd = t.findConfCommand(command);
+ net.rizon.acid.conf.Command cmd = t.findConfCommand(command, c.getName());
if (cmd != null)
{
return;
to = (AcidUser) targ;
- confCommand = to.findConfCommand(command);
+ confCommand = to.findConfCommand(command, null);
}
if (confCommand == null)
if (commandClass == null)
return;
- Command cmd = (Command) commandClass.newInstance();
-
if (recipient.startsWith("#"))
{
// In the proper channels commands can go without access checks. (ish)
{
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"))
+ if (!x.getIdentNick().isEmpty() || x.hasFlags("o") || x.getIP().equals("0"))
{
- return; // Access
+ // ok
+ }
+ else
+ {
+ // Only allow explicit "anyone" commands
+ if (confCommand.privilege == null || !confCommand.privilege.equals("anyone"))
+ return;
}
}
// Message to me, check priv
else
{
+ if (!x.hasMode("o"))
+ return;
+
// Non priv commands can be used by any oper
if (confCommand.privilege == null)
{
return;
}
}
+
+ Command cmd = (Command) commandClass.newInstance();
if (args.length < cmd.GetMinArgs())
{