public static function motd(&$ircdata) { if (isset($ircdata[1]) && $ircdata[1] == 'MOTD') { $nick = core::get_nick(&$ircdata, 0); if (!file_exists(CONFPATH . 'services.motd')) { ircd::push(core::$config->server->name, $nick, 'MOTD File is missing'); return false; } $lines = file(CONFPATH . 'services.motd'); foreach ($lines as $num => $line) { $lines[$num] = rtrim($line); } // strip the crap out of it ircd::push(core::$config->server->name, 375, $nick, array(':', str_replace('{server}', core::$config->server->name, ircd::$motd_start))); // send the start of the motd. foreach ($lines as $num => $line) { if (strpos($line, '{version}') !== false) { $line = str_replace('{version}', core::$version, $line); } if (strpos($line, '{uptime}') !== false) { $line = str_replace('{uptime}', core::format_time(core::$uptime), $line); } // replaceable variables here. ircd::push(core::$config->server->name, 372, $nick, array(':', '-', $line)); } // loop through, throwing the line at the client :D ircd::push(core::$config->server->name, 376, $nick, array(':', ircd::$motd_end)); // send the end of the motd. } // only triggered if someone asks us for a MOTD. }