|
@@ -58,6 +58,7 @@ import org.apache.oro.text.GlobCompiler;
|
|
|
import org.jibble.pircbot.Colors;
|
|
|
import org.jibble.pircbot.IrcException;
|
|
|
import org.jibble.pircbot.PircBot;
|
|
|
+import org.jibble.pircbot.User;
|
|
|
|
|
|
public class BigScreenBot extends PircBot
|
|
|
{
|
|
@@ -152,6 +153,7 @@ public class BigScreenBot extends PircBot
|
|
|
private List<Pattern> admins = new ArrayList<Pattern>();
|
|
|
private Map<String, Command> commands = new TreeMap<String, Command>();
|
|
|
private Action action = Action.RECONNECT;
|
|
|
+ private JmDNS mdns;
|
|
|
|
|
|
private BigScreenBot(Settings settings)
|
|
|
{
|
|
@@ -228,6 +230,16 @@ public class BigScreenBot extends PircBot
|
|
|
@Override
|
|
|
public void execute(String channel, String sender, boolean admin, String argument)
|
|
|
{
|
|
|
+ /*JmDNS dns = JmDNS.create(InetAddress.getByName(settings.getProperty("interface")));
|
|
|
+
|
|
|
+ for (ServiceInfo info : dns.list("_anymote._tcp.local."))
|
|
|
+ {
|
|
|
+ System.out.println(info.getName());
|
|
|
+ System.out.println(info.getInetAddresses()[0]);
|
|
|
+ System.out.println(info.getPort());
|
|
|
+ }
|
|
|
+
|
|
|
+ dns.close();*/
|
|
|
}
|
|
|
});
|
|
|
commands.put("quit", new Command(true, PRIVATE, "[message]", "quit and do not come back")
|
|
@@ -366,7 +378,8 @@ public class BigScreenBot extends PircBot
|
|
|
{
|
|
|
boolean admin = matchNickMasks(sender, login, hostname, admins);
|
|
|
|
|
|
- // TODO: determine if this person is in our channels before responding
|
|
|
+ if (!admin && !isNickInChannels(sender))
|
|
|
+ return;
|
|
|
|
|
|
String[] arguments = message.split("\\s", 2);
|
|
|
String argument = arguments[0].toLowerCase();
|
|
@@ -419,19 +432,18 @@ public class BigScreenBot extends PircBot
|
|
|
commands.get("help").execute(channel, sender, admin, command);
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args)
|
|
|
+ private boolean isNickInChannels(String nick)
|
|
|
{
|
|
|
- /*JmDNS dns = JmDNS.create(InetAddress.getByName("10.0.0.1"));
|
|
|
-
|
|
|
- for (ServiceInfo info : dns.list("_anymote._tcp.local."))
|
|
|
- {
|
|
|
- System.out.println(info.getName());
|
|
|
- System.out.println(info.getInetAddresses()[0]);
|
|
|
- System.out.println(info.getPort());
|
|
|
- }
|
|
|
+ for (String channel : getChannels())
|
|
|
+ for (User user : getUsers(channel))
|
|
|
+ if (user.equals(nick))
|
|
|
+ return true;
|
|
|
|
|
|
- dns.close();*/
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
+ public static void main(String[] args)
|
|
|
+ {
|
|
|
Settings settings = new Settings();
|
|
|
FileReader reader = null;
|
|
|
|