Skip to content

Commit

Permalink
Merging from MOODLE_16_STABLE:
Browse files Browse the repository at this point in the history
Fix for MDL-8515: Prefixing chat messages with a slash should not hide the
user's name unless it's a special command we handle.

I completely removed the emoticon handling case, but it seems like it was
not needed for a long time now? Emoticons work just fine without it.
  • Loading branch information
defacer committed Mar 1, 2007
1 parent 3ce66e9 commit 4edc434
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions mod/chat/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,13 @@ function chat_format_message_manually($message, $courseid, $sender, $currentuser

$options->para = false;
$text = format_text($text, FORMAT_MOODLE, $options, $courseid);

// And now check for special cases
$special = false;

if (substr($text, 0, 5) == 'beep ') {
/// It's a beep!
$special = true;
$beepwho = trim(substr($text, 5));

if ($beepwho == 'all') { // everyone
Expand All @@ -591,25 +595,19 @@ function chat_format_message_manually($message, $courseid, $sender, $currentuser
} else { //something is not caught?
return false;
}
} else if (substr($text, 0, 1) == ':') { /// It's an MOO emote
$outinfo = $message->strtime;
$outmain = $sender->firstname.' '.substr($text, 1);

} else if (substr($text, 0, 1) == '/') { /// It's a user command

if (substr($text, 0, 4) == "/me ") {
if (trim(substr($text, 0, 4)) == '/me') {
$special = true;
$outinfo = $message->strtime;
$outmain = $sender->firstname.' '.substr($text, 4);
} else {
$outinfo = $message->strtime;
$outmain = $text;
}
}

} else { /// It's a normal message
if(!$special) {
$outinfo = $message->strtime.' '.$sender->firstname;
$outmain = $text;
}

/// Format the message as a small table

$output->text = strip_tags($outinfo.': '.$outmain);
Expand Down

0 comments on commit 4edc434

Please sign in to comment.