7 static CMD_BIND(neonserv_cmd_events) {
9 int duration = (argc ? strToTime(user, argv[0]) : 0);
10 if(argc > (duration ? 1 : 0))
11 str_match = merge_argv(argv, (duration ? 1 : 0), argc);
14 if(!duration) duration = (60*60*24);
17 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));
19 int skip = mysql_num_rows(res) - 100;
24 if(skip < 0) skip = 0;
25 reply(getTextBot(), user, "NS_EVENTS_HEADER");
26 while ((row = mysql_fetch_row(res)) != NULL) {
31 if(*str_match && match(str_match, row[3])) continue;
33 event_time = (time_t) atol(row[0]);
34 timeinfo = localtime(&event_time);
35 strftime(timeBuf, 80, "%X %x", timeinfo);
36 reply(getTextBot(), user, "[%s] [%s:%s]: %s", timeBuf, row[2], row[1], row[3]);
38 reply(getTextBot(), user, "NS_TABLE_COUNT", count);