rearranged NeonServ code to be modular
[NeonServV5.git] / src / cmd_neonserv_events.c
diff --git a/src/cmd_neonserv_events.c b/src/cmd_neonserv_events.c
deleted file mode 100644 (file)
index de4fd6c..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* cmd_neonserv_events.c - NeonServ v5.3
- * Copyright (C) 2011-2012  Philipp Kreil (pk910)
- * 
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License 
- * along with this program. If not, see <http://www.gnu.org/licenses/>. 
- */
-
-#include "cmd_neonserv.h"
-
-/*
-* argv[0]     time
-* argv[1-*]   match
-*/
-
-CMD_BIND(neonserv_cmd_events) {
-    char *str_match;
-    int duration = (argc ? strToTime(user, argv[0]) : 0);
-    if(argc > (duration ? 1 : 0))
-        str_match = merge_argv(argv, (duration ? 1 : 0), argc);
-    else
-        str_match = "";
-    if(!duration) duration = (60*60*24);
-    MYSQL_RES *res;
-    MYSQL_ROW row;
-    printf_mysql_query("SELECT `time`, `auth`, `nick`, `command` FROM `events` WHERE `cid` = '%d' AND `time` > '%lu' ORDER BY `time` ASC", chan->channel_id, ((unsigned long) time(0) - duration));
-    res = mysql_use();
-    int skip = mysql_num_rows(res) - 100;
-    int count = 0;
-    char timeBuf[50];
-    struct tm *timeinfo;
-    time_t event_time;
-    if(skip < 0) skip = 0;
-    reply(getTextBot(), user, "NS_EVENTS_HEADER");
-    while ((row = mysql_fetch_row(res)) != NULL) {
-        if(skip) {
-            skip--;
-            continue;
-        }
-        if(*str_match && match(str_match, row[3])) continue;
-        count++;
-        event_time = (time_t) atol(row[0]);
-        timeinfo = localtime(&event_time);
-        strftime(timeBuf, 80, "%X %x", timeinfo);
-        reply(getTextBot(), user, "[%s] [%s:%s]: %s", timeBuf, row[2], row[1], row[3]);
-    }
-    reply(getTextBot(), user, "NS_TABLE_COUNT", count);
-}