mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merging from MOODLE_16_STABLE:
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.
This commit is contained in:
parent
d5b04008fd
commit
927a78087c
1 changed files with 9 additions and 11 deletions
|
@ -561,9 +561,13 @@ function chat_format_message_manually($message, $courseid, $sender, $currentuser
|
||||||
$options = new object();
|
$options = new object();
|
||||||
$options->para = false;
|
$options->para = false;
|
||||||
$text = format_text($text, FORMAT_MOODLE, $options, $courseid);
|
$text = format_text($text, FORMAT_MOODLE, $options, $courseid);
|
||||||
|
|
||||||
// And now check for special cases
|
// And now check for special cases
|
||||||
|
$special = false;
|
||||||
|
|
||||||
if (substr($text, 0, 5) == 'beep ') {
|
if (substr($text, 0, 5) == 'beep ') {
|
||||||
/// It's a beep!
|
/// It's a beep!
|
||||||
|
$special = true;
|
||||||
$beepwho = trim(substr($text, 5));
|
$beepwho = trim(substr($text, 5));
|
||||||
|
|
||||||
if ($beepwho == 'all') { // everyone
|
if ($beepwho == 'all') { // everyone
|
||||||
|
@ -580,21 +584,15 @@ function chat_format_message_manually($message, $courseid, $sender, $currentuser
|
||||||
} else { //something is not caught?
|
} else { //something is not caught?
|
||||||
return false;
|
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
|
} else if (substr($text, 0, 1) == '/') { /// It's a user command
|
||||||
|
if (trim(substr($text, 0, 4)) == '/me') {
|
||||||
if (substr($text, 0, 4) == "/me ") {
|
$special = true;
|
||||||
$outinfo = $message->strtime;
|
$outinfo = $message->strtime;
|
||||||
$outmain = $sender->firstname.' '.substr($text, 4);
|
$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;
|
$outinfo = $message->strtime.' '.$sender->firstname;
|
||||||
$outmain = $text;
|
$outmain = $text;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue