}
public void messageCommand(Bot bot, String nick, String command, String arguments, ServerMessage fullMessage)
throws CoreException
{
DatabaseLogs database_log = DatabaseLogsFactory.get();
try
{
if (command.equals("logsearch"))
{
if (null == arguments ||
0 == arguments.length())
{
bot.send(new Privmsg(nick, "You need to provide a search argument."));
return;
}
Matcher logsearch_matcher = SEARCH_PATTERN.matcher(arguments);
if (!logsearch_matcher.matches() ||
logsearch_matcher.groupCount() != 2)
{
bot.send(new Privmsg(nick, "Invalid syntax '"+command+" "+arguments+"'"));
return;
}
// obtain the requested channel
String channel_name = logsearch_matcher.group(1);
String search = logsearch_matcher.group(2);
Channel channel = bot.getServer().getChannel(channel_name);
if (null == channel)
{
bot.send(new Privmsg(nick, "Unknown channel '"+channel_name+"'"));
return;
}
SearchResults search_results = new SearchResults(bot, nick);
try
{
if (!database_log.searchLog(search_results, bot, channel, search))
{
bot.send(new Privmsg(nick, "No results for '"+search+"' could be found in channel '"+channel_name+"'."));
}
}
catch (InvalidSearchSyntaxException e)