Browse Source

Fix #1113

pull/1122/head
Timothée Jaussoin 3 years ago
parent
commit
d5be850b4b
  1. 7
      app/Message.php
  2. 6
      app/widgets/Chat/Chat.php

7
app/Message.php

@ -286,11 +286,10 @@ class Message extends Model
if ($stanza->fallback && $stanza->fallback->attributes()->xmlns == 'urn:xmpp:feature-fallback:0'
&& $stanza->fallback->attributes()->for == 'urn:xmpp:reply:0') {
$this->body = htmlspecialchars(trim(mb_substr(
htmlspecialchars_decode($this->body, ENT_NOQUOTES),
$this->body = mb_substr(
htmlspecialchars_decode($this->body, ENT_XML1),
(int)$stanza->fallback->body->attributes()->end
// might need to handle start
)), ENT_NOQUOTES);
);
}
} else if ($stanza->thread) {
$this->thread = (string)$stanza->thread;

6
app/widgets/Chat/Chat.php

@ -586,13 +586,15 @@ class Chat extends \Movim\Widget\Base
if ($quotable) {
$p->setReplyto($reply->jidfrom.'/'.$reply->resource);
$matches = [];
preg_match_all('/^/m', $reply->body, $matches);
$p->setReplyquotedbodylength(
mb_strlen(htmlspecialchars($reply->body, ENT_NOQUOTES)) + 2 // 2 = > quote character
mb_strlen($reply->body) + (2 * count($matches[0]))
);
// Prepend quoted message body
$quotedBody = preg_replace('/^/m', '> ', $reply->body) . "\n";
$quotedBody = preg_replace('/^/m', "> ", $reply->body);
$p->setContent($quotedBody . $body);
} else {
$p->setContent($body);

Loading…
Cancel
Save