|
' . get_string('message'.$message->message, 'chat', fullname($sender)) . ' |
' . $message->strtime . ' |
';
if ($message->message == 'exit' or $message->message == 'enter') {
$output->refreshusers = true; // Force user panel refresh ASAP.
}
return $output;
}
// It's not a system event.
$rawtext = trim($message->message);
// Options for format_text, when we get to it...
// format_text call will parse the text to clean and filter it.
// It cannot be called here as HTML-isation interferes with special case
// recognition, but *must* be called on any user-sourced text to be inserted
// into $outmain.
$options = new stdClass();
$options->para = false;
$options->blanktarget = true;
// And now check for special cases.
$patternto = '#^\s*To\s([^:]+):(.*)#';
$special = false;
if (substr($rawtext, 0, 5) == 'beep ') {
// It's a beep!
$special = true;
$beepwho = trim(substr($rawtext, 5));
if ($beepwho == 'all') { // Everyone.
$outinfobasic = get_string('messagebeepseveryone', 'chat', fullname($sender));
$outinfo = $message->strtime . ': ' . $outinfobasic;
$outmain = '';
$output->beep = true; // Eventually this should be set to a filename uploaded by the user.
} else if ($beepwho == $currentuser->id) { // Current user.
$outinfobasic = get_string('messagebeepsyou', 'chat', fullname($sender));
$outinfo = $message->strtime . ': ' . $outinfobasic;
$outmain = '';
$output->beep = true;
} else { // Something is not caught?
return false;
}
} else if (substr($rawtext, 0, 1) == '/') { // It's a user command.
$special = true;
$pattern = '#(^\/)(\w+).*#';
preg_match($pattern, $rawtext, $matches);
$command = isset($matches[2]) ? $matches[2] : false;
// Support some IRC commands.
switch ($command) {
case 'me':
$outinfo = $message->strtime;
$text = '***