mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 16:39:29 -05:00
Remove location from user name when using /me
This commit is contained in:
parent
e2c40d6693
commit
77804bbf16
@ -272,6 +272,7 @@ QString ChatStyle::formatMessage(enumFormatMessage type, const QString &name, co
|
||||
QString styleOptimized ;
|
||||
QString errorMsg ; int errorLine ; int errorColumn ;
|
||||
QString messageBody = message ;
|
||||
me = me || message.trimmed().startsWith("/me ");
|
||||
if (doc.setContent(messageBody, &errorMsg, &errorLine, &errorColumn)) {
|
||||
QDomElement body = doc.documentElement();
|
||||
if (!body.isNull()){
|
||||
@ -362,9 +363,12 @@ QString ChatStyle::formatMessage(enumFormatMessage type, const QString &name, co
|
||||
QString strDate = DateTime::formatDate(timestamp.date()).prepend(QString("<a name=\"date\">")).append(QString("</a>"));
|
||||
QString strTime = DateTime::formatTime(timestamp.time()).prepend(QString("<a name=\"time\">")).append(QString("</a>"));
|
||||
|
||||
int bi = name.lastIndexOf(QRegExp(" \\(.*\\)")); //trim location from the end
|
||||
QString strShortName = RsHtml::plainText(name.left(bi)).prepend(QString("<a name=\"name\">")).append(QString("</a>"));
|
||||
|
||||
//handle /me
|
||||
if(me){
|
||||
messageBody = messageBody.replace(messageBody.indexOf("/me "), 3, strName); //replace only the first /me
|
||||
messageBody = messageBody.replace(messageBody.indexOf("/me "), 3, strShortName); //replace only the first /me
|
||||
strName = "*";
|
||||
}
|
||||
|
||||
|
@ -338,6 +338,7 @@ void ChatPage::setPreviewMessages(QString &stylePath, QString styleVariant, QTex
|
||||
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_OUTGOING, nameOutgoing, timestmp, tr("Outgoing message")));
|
||||
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_OOUTGOING, nameOutgoing, timestmp, tr("Outgoing offline message")));
|
||||
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_SYSTEM, tr("System"), timestmp, tr("System message")));
|
||||
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_OUTGOING, tr("UserName"), timestmp, tr("/me is sending a message with /me")));
|
||||
}
|
||||
|
||||
void ChatPage::fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser)
|
||||
|
Loading…
Reference in New Issue
Block a user