# HG changeset patch # User Wuzzy # Date 1535216837 -7200 # Node ID e529a34872f90f6714d4bd7e870c2e1525ad9589 # Parent 91fe09213abc62459e05fb98882448d554b415c0 Fix some formatting problems with /me diff -r 91fe09213abc -r e529a34872f9 QTfrontend/net/newnetclient.cpp --- a/QTfrontend/net/newnetclient.cpp Sat Aug 25 18:21:37 2018 +0200 +++ b/QTfrontend/net/newnetclient.cpp Sat Aug 25 19:07:17 2018 +0200 @@ -383,16 +383,18 @@ QString action; QString message; - // Fake nicks are nicks used for messages from the server with nicks like - // [server], [random], etc. - // The '[' character is not allowed in real nicks. - bool isFakeNick = lst[1].startsWith('['); - if(!isFakeNick) + // '[' is a special character used in fake nick names of server messages. + // Those are supposed to be translated + if(!lst[1].startsWith('[')) { // Normal message message = lst[2]; - // Check for action (/me command) - action = HWProto::chatStringToAction(message); + // Another kind of fake nick. '(' nicks are server messages, but they must not be translated + if(!lst[1].startsWith('(')) + { + // Check for action (/me command) + action = HWProto::chatStringToAction(message); + } } else { diff -r 91fe09213abc -r e529a34872f9 QTfrontend/net/proto.cpp --- a/QTfrontend/net/proto.cpp Sat Aug 25 18:21:37 2018 +0200 +++ b/QTfrontend/net/proto.cpp Sat Aug 25 19:07:17 2018 +0200 @@ -47,8 +47,11 @@ QString HWProto::formatChatMsg(const QString & nick, const QString & msg) { - if(msg.left(4) == "/me ") + // Messages using the /me command. + // Server messages (nick starts with a bracket) are never considered /me messages. + if(msg.left(4) == "/me " && (!nick.startsWith('[')) && (!nick.startsWith('('))) return QString("\x02* %1 %2").arg(nick).arg(msg.mid(4)); + // Normal chat message else return QString("\x01%1: %2").arg(nick).arg(msg); }