summaryrefslogtreecommitdiffstats
path: root/pica-client/chatwindow.cpp
diff options
context:
space:
mode:
authorAnton <anton@picapica.im>2026-11-24 02:40:10 +0400
committerAnton <anton@picapica.im>2026-11-24 02:40:10 +0400
commit48417c1da102dc9eb332227237805b8e28f81f97 (patch)
tree53defd47a60bf505a3431a0ae4193b1e40b29c2e /pica-client/chatwindow.cpp
parent3922dcc4c4822cc626d62f73ddefbe4fce8e94e5 (diff)
parent98d341e2e55852f075001c6c2d084d025a97383f (diff)
downloadpica-pica-48417c1da102dc9eb332227237805b8e28f81f97.tar.gz
pica-pica-48417c1da102dc9eb332227237805b8e28f81f97.zip
Merge branch 'audio_video_calls'
Diffstat (limited to 'pica-client/chatwindow.cpp')
-rw-r--r--pica-client/chatwindow.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/pica-client/chatwindow.cpp b/pica-client/chatwindow.cpp
index a135c19..af86ae7 100644
--- a/pica-client/chatwindow.cpp
+++ b/pica-client/chatwindow.cpp
@@ -87,6 +87,9 @@ ChatWindow::ChatWindow(QByteArray peer_id, QString status) :
QHBoxLayout *hl = new QHBoxLayout();
lbAddCtQuestion = new QLabel(tr("Do you want to add \"%1\" to your contact list?").arg(peer_name_));
+ // peer_name_ comes from the peer's certificate; keep it literal so it
+ // cannot be interpreted as rich text.
+ lbAddCtQuestion->setTextFormat(Qt::PlainText);
btAddCtYes = new QPushButton(tr("Yes"));
btAddCtNo = new QPushButton(tr("No"));
btAddCtBlacklist = new QPushButton(tr("Add to blacklist"));
@@ -189,8 +192,8 @@ int ChatWindow::draw_message(QString msg, QString nickname, QString datetime, QS
QString("<b><font color=%1>%2(%3) %4 : </font></b>").
arg(color).
arg(delivered_mark).
- arg(datetime).
- arg(nickname)
+ arg(datetime.toHtmlEscaped()).
+ arg(nickname.toHtmlEscaped())
);
chatw->setCurrentCharFormat(fmt);
chatw->insertPlainText(msg + '\n');
@@ -251,8 +254,10 @@ void ChatWindow::msg_delivered()
QByteArray my_id = Accounts::GetCurrentAccount().id;
QMap<QByteArray, QList<QString> > undl = hist.GetUndeliveredMessages();
- if (!undl[my_id].isEmpty())
- put_message(undl[my_id].first(), my_id, true);
+ // GetUndeliveredMessages() is keyed by the peer's contact_id, not by
+ // our own id, so this must look up peer_id_ to find anything.
+ if (!undl[peer_id_].isEmpty())
+ put_message(undl[peer_id_].first(), my_id, true);
}
if (!undelivered_msgs.isEmpty())