public function priv_seen($line, $args) { if ($this->seen->getError()) { $this->ircClass->notice($line['fromNick'], "There was an error while attempting to access the seen database."); return; } if ($line['to'] == $this->ircClass->getNick()) { return; } if ($args['nargs'] <= 0) { $this->ircClass->notice($line['fromNick'], "Usage: !seen <nick>"); return; } $user = irc::myStrToLower($args['arg1']); if ($user == irc::myStrToLower($line['fromNick'])) { $this->ircClass->privMsg($line['to'], $line['fromNick'] . ", umm... O..kay..."); $this->ircClass->action($line['to'], "points at " . $line['fromNick'] . "..."); return; } $data = $this->getLast($user); if ($data === false) { $this->ircClass->privMsg($line['to'], $line['fromNick'] . ", I have never seen " . $args['arg1'] . " before."); return; } $time = time() - $data['time']; if ($time > 3600 * 24) { $timeString = irc::timeFormat($time, "%d days %h hours %m min %s sec"); } else { if ($time > 3600) { $timeString = irc::timeFormat($time, "%h hours %m min %s sec"); } else { if ($time > 60) { $timeString = irc::timeFormat($time, "%m min %s sec"); } else { $timeString = irc::timeFormat($time, "%s sec"); } } } $action = ""; switch ($data['act']) { case "privmsg": $action = "saying in a channel"; break; case "notice": $action = "noticing a channel"; break; case "join": $action = "joining a channel"; break; case "kick": $action = "being kicked from a channel"; break; case "part": $action = "parting a channel"; break; case "quit": $action = "quitting"; break; } if ($data['txt'] != "") { $action .= ": " . $data['txt']; } $this->ircClass->privMsg($line['to'], $line['fromNick'] . ", I last saw " . $data['user'] . " " . $timeString . " ago " . $action . "."); }
public function dcc_timers($chat, $args) { $timers = $this->timerClass->getTimers(); $chat->dccSend("Active Timers:"); if (count($timers) > 0) { $time = timers::getMicroTime(); foreach ($timers as $timer) { $interval = "interval(" . $timer->interval . " sec)"; $timeTillNext = round($timer->nextRunTime - $time < 0 ? 0 : $timer->nextRunTime - $time, 0); $ttnext = irc::timeFormat($timeTillNext, "%m min, %s sec"); if (is_object($timer->class)) { $cName = get_class($timer->class); } else { $cName = ""; } $tName = preg_replace("/([a-z0-9]){32}/", "", $timer->name); if ($tName == "") { $tName = "(random hash)"; } $cName = preg_replace("/_([a-z0-9]){32}/", "", $cName); $chat->dccSend("Timer " . BOLD . $tName . BOLD . ": func(" . $cName . "::" . $timer->func . ") " . $interval . ", Time till next run: " . $ttnext); } } else { $chat->dccSend("There are currently no timers."); } }