diff options
| -rw-r--r-- | pica-client/chatwindow.cpp | 13 | ||||
| -rw-r--r-- | pica-client/dialogs/filetransferdialog.cpp | 4 | ||||
| -rw-r--r-- | pica-client/dialogs/showpicaiddialog.cpp | 2 |
3 files changed, 14 insertions, 5 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()) diff --git a/pica-client/dialogs/filetransferdialog.cpp b/pica-client/dialogs/filetransferdialog.cpp index ef431ec..8ee6d3b 100644 --- a/pica-client/dialogs/filetransferdialog.cpp +++ b/pica-client/dialogs/filetransferdialog.cpp @@ -44,6 +44,10 @@ FileTransferDialog::FileTransferDialog(QByteArray peer_id, QString filename, qui lbFilename = new QLabel(this); lbPeer = new QLabel(this); + // Both carry peer-supplied text (file name, certificate-derived name), + // so keep them literal rather than letting Qt render them as rich text. + lbFilename->setTextFormat(Qt::PlainText); + lbPeer->setTextFormat(Qt::PlainText); lbProgressStatus = new QLabel(this); lbTransferSpeed = new QLabel(this); lbRemainingTime = new QLabel(this); diff --git a/pica-client/dialogs/showpicaiddialog.cpp b/pica-client/dialogs/showpicaiddialog.cpp index dbcf814..5395aa2 100644 --- a/pica-client/dialogs/showpicaiddialog.cpp +++ b/pica-client/dialogs/showpicaiddialog.cpp @@ -25,7 +25,7 @@ ShowPicaIdDialog::ShowPicaIdDialog(QString name, QByteArray id, QString caption, setWindowTitle(caption); QVBoxLayout *layout = new QVBoxLayout(this); - lbname_ = new QLabel(tr("Account: <b>%1</b>").arg(name)); + lbname_ = new QLabel(tr("Account: <b>%1</b>").arg(name.toHtmlEscaped())); lbname_ ->setTextFormat(Qt::RichText); picaid_ = new QLineEdit(); |
