From: Marcus Eggenberger Date: Mon, 11 Aug 2008 16:24:15 +0000 (+0200) Subject: fixing strange looking CTCP ACTIONs (/me style message) in the chat monitor X-Git-Tag: 0.3.0~64 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=b18eac231c8a124a4e3a0792792343863eb10ab2;ds=sidebyside fixing strange looking CTCP ACTIONs (/me style message) in the chat monitor --- diff --git a/src/qtui/chatmonitorfilter.cpp b/src/qtui/chatmonitorfilter.cpp index d11378d1..ef68a9cd 100644 --- a/src/qtui/chatmonitorfilter.cpp +++ b/src/qtui/chatmonitorfilter.cpp @@ -54,6 +54,8 @@ QVariant ChatMonitorFilter::data(const QModelIndex &index, int role) const { qDebug() << "ChatMonitorFilter::data(): chatline belongs to an invalid buffer!"; return QVariant(); } + + QModelIndex source_index = mapToSource(index); QStringList fields; if(showFields_ & NetworkField) { @@ -62,8 +64,14 @@ QVariant ChatMonitorFilter::data(const QModelIndex &index, int role) const { if(showFields_ & BufferField) { fields << Client::networkModel()->bufferName(bufid); } - fields << MessageFilter::data(index, role).toString().mid(1); - return QString("<%1").arg(fields.join(":")); + + Message::Type messageType = (Message::Type)sourceModel()->data(source_index, MessageModel::TypeRole).toInt(); + if(messageType & (Message::Plain | Message::Notice)) { + QString sender = MessageFilter::data(index, role).toString(); + // we have to strip leading and traling < / > + fields << sender.mid(1, sender.count() - 2); + } + return QString("<%1>").arg(fields.join(":")); } void ChatMonitorFilter::addShowField(int field) {