diff --git a/bot_log/bot_log.module b/bot_log/bot_log.module index ae40b04..04e1e8b 100644 --- a/bot_log/bot_log.module +++ b/bot_log/bot_log.module @@ -421,3 +421,25 @@ function bot_log_settings(){ return system_settings_form($form); } +/** + * Implements hook_search(). + */ +function bot_log_search($op = 'search', $keys = NULL) { + switch($op) { + case 'name': + return t('IRC Logs'); + break; + case 'search': + $result = db_query("SELECT * FROM {bot_log} WHERE message LIKE '%%%s%%' ORDER BY timestamp DESC", $keys); + while($item = db_fetch_object($result)) { + + $search_results[] = array( + 'link' => url('bot/log/'. preg_replace('!^#!', '', $item->channel) .'/' . date('Y-m-d', $item->timestamp)), + 'title' => t('@channel @timestamp', array('@channel' => $item->channel, '@timestamp' => format_date($item->timestamp, 'sho + 'snippet' => t(check_plain('<@nick> @message'), array('@nick' => $item->nick, '@message' => $item->message)), + ); + } + return $search_results; + break; + } +} \ No newline at end of file