handlers.put(".bs", handlers.get(".bncsuspend"));\r
handlers.put(".bus", handlers.get(".bncsuspend"));\r
handlers.put(".bnclistsuspend", new BncListSuspendCmd());\r
- \r
+\r
handlers.put(".bncadd", new BncAddCmd());\r
\r
handlers.put(".bncmove", new BncMoveCmd());\r
handlers.put(".bncsearch", handlers.get(".bncfind"));\r
handlers.put(".bnclastseen", new BncLastSeenCmd());\r
handlers.put(".bncls", handlers.get(".bnclastseen"));\r
+ handlers.put(".bp", new BncNotProcessedCmd());\r
handlers.put(".bncabout", new BncAboutCmd());\r
handlers.put(".bncoverride", new BncGenerateOverrideCmd());\r
handlers.put(".bncrehash", new BncRehashCmd());\r
handlers.put(".bnchelp", new BncHelpCmd());\r
- \r
+\r
handlers.put(".bncloadmod", new BncLoadModCmd());\r
handlers.put(".bncunloadmod", handlers.get(".bncloadmod"));\r
\r
--- /dev/null
+package net.rizon.bncbot.commands;\r
+\r
+import java.util.ArrayList;\r
+\r
+import net.rizon.bncbot.AbstractSimpleCommand;\r
+import net.rizon.bncbot.UserDB.UserEntry;\r
+import net.rizon.bncbot.UserDB.UserEntry.UserState;\r
+\r
+public class BncNotProcessedCmd extends AbstractSimpleCommand {\r
+ @Override\r
+ public boolean prepare(String line) {\r
+ super.prepare(line);\r
+\r
+ // We want the message to look like this:\r
+ // :nick!ident@host PRIVMSG #adminchan :command\r
+ // 0 1 2 3\r
+ return args[2].equalsIgnoreCase(bot.getAdminChannel());\r
+ }\r
+\r
+ public void run() {\r
+ ArrayList<UserEntry> matches = new ArrayList<UserEntry>();\r
+ for (UserEntry ue : bot.database)\r
+ if (ue.getState() == UserState.NotProcessed)\r
+ matches.add(ue);\r
+\r
+ bot.privmsg(bot.getAdminChannel(), bot.getString("adminQueryMatch", matches.size(), "processed=false"));\r
+ if (matches.size() > 0) {\r
+ StringBuilder sb = new StringBuilder();\r
+ for (UserEntry ue : matches) {\r
+ sb.append(ue.getNick() + " (Id: " + ue.getId() + "), ");\r
+ }\r
+\r
+ if (sb.length() > 200) {\r
+ bot.privmsg(bot.getAdminChannel(), "Exceeded length limit, response sent via notice.");\r
+ bot.notice(args[0].substring(1).split("!")[0], sb.toString().substring(0, sb.length() - 2));\r
+ } else {\r
+ bot.privmsg(bot.getAdminChannel(), sb.toString().substring(0, sb.length() - 2));\r
+ }\r
+ }\r
+ }\r
+}\r