From b8e94e1fbe17e2c968339e78a58b7e95331bd4d5 Mon Sep 17 00:00:00 2001 From: Shane Synan Date: Wed, 9 Mar 2016 21:55:18 -0600 Subject: [PATCH] Clarify suserHost and WhoisServiceReply If suserHost indicates help status, substitute in a translatable message. Otherwise, behave as before. If whoisServiceReply indicates nick registration status, substitute in a translatable message. Otherwise, behave as before. Remove "is a" or "is an" from Operator status, since it's implied by the tooltip itself. See https://www.alien.net.au/irc/irc2numerics.html --- src/client/networkmodel.cpp | 63 ++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 14 deletions(-) diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index d6bd9f48..1edbb241 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -558,17 +558,34 @@ QString QueryBufferItem::toolTip(int column) const addRow(tr("Realname"), NetworkItem::escapeHTML(_ircUser->realName()), !_ircUser->realName().isEmpty()); - addRow(NetworkItem::escapeHTML(tr("Suser Host"), true), - NetworkItem::escapeHTML(_ircUser->suserHost()), - !_ircUser->suserHost().isEmpty()); - addRow(NetworkItem::escapeHTML(tr("Whois Service Reply"), true), - NetworkItem::escapeHTML(_ircUser->whoisServiceReply()), - !_ircUser->whoisServiceReply().isEmpty()); + // suserHost may return " is available for help", which should be translated. + // See https://www.alien.net.au/irc/irc2numerics.html + if(_ircUser->suserHost().endsWith("available for help")) { + addRow(NetworkItem::escapeHTML(tr("Help status"), true), + NetworkItem::escapeHTML(tr("Available for help")), + true); + } else { + addRow(NetworkItem::escapeHTML(tr("Service status"), true), + NetworkItem::escapeHTML(_ircUser->suserHost()), + !_ircUser->suserHost().isEmpty()); + } + // whoisServiceReply may return " is identified for this nick", which should be translated. + // See https://www.alien.net.au/irc/irc2numerics.html + if(_ircUser->whoisServiceReply().endsWith("identified for this nick")) { + addRow(NetworkItem::escapeHTML(tr("Account"), true), + NetworkItem::escapeHTML(tr("Identified for this nick")), + true); + } else { + addRow(NetworkItem::escapeHTML(tr("Service Reply"), true), + NetworkItem::escapeHTML(_ircUser->whoisServiceReply()), + !_ircUser->whoisServiceReply().isEmpty()); + } addRow(tr("Hostmask"), NetworkItem::escapeHTML(_ircUser->hostmask().remove(0, _ircUser->hostmask().indexOf("!") + 1)), !(_ircUser->hostmask().remove(0, _ircUser->hostmask().indexOf("!") + 1) == "@")); + // ircOperator may contain "is an" or "is a", which should be removed. addRow(tr("Operator"), - NetworkItem::escapeHTML(_ircUser->ircOperator()), + NetworkItem::escapeHTML(_ircUser->ircOperator().replace("is an ", "").replace("is a ", "")), !_ircUser->ircOperator().isEmpty()); if (_ircUser->idleTime().isValid()) { @@ -1058,17 +1075,35 @@ QString IrcUserItem::toolTip(int column) const addRow(tr("Realname"), NetworkItem::escapeHTML(_ircUser->realName()), !_ircUser->realName().isEmpty()); - addRow(NetworkItem::escapeHTML(tr("Suser Host"), true), - NetworkItem::escapeHTML(_ircUser->suserHost()), - !_ircUser->suserHost().isEmpty()); - addRow(NetworkItem::escapeHTML(tr("Whois Service Reply"), true), - NetworkItem::escapeHTML(_ircUser->whoisServiceReply()), - !_ircUser->whoisServiceReply().isEmpty()); + + // suserHost may return " is available for help", which should be translated. + // See https://www.alien.net.au/irc/irc2numerics.html + if(_ircUser->suserHost().endsWith("available for help")) { + addRow(NetworkItem::escapeHTML(tr("Help status"), true), + NetworkItem::escapeHTML(tr("Available for help")), + true); + } else { + addRow(NetworkItem::escapeHTML(tr("Service status"), true), + NetworkItem::escapeHTML(_ircUser->suserHost()), + !_ircUser->suserHost().isEmpty()); + } + // whoisServiceReply may return " is identified for this nick", which should be translated. + // See https://www.alien.net.au/irc/irc2numerics.html + if(_ircUser->whoisServiceReply().endsWith("identified for this nick")) { + addRow(NetworkItem::escapeHTML(tr("Account"), true), + NetworkItem::escapeHTML(tr("Identified for this nick")), + true); + } else { + addRow(NetworkItem::escapeHTML(tr("Service Reply"), true), + NetworkItem::escapeHTML(_ircUser->whoisServiceReply()), + !_ircUser->whoisServiceReply().isEmpty()); + } addRow(tr("Hostmask"), NetworkItem::escapeHTML(_ircUser->hostmask().remove(0, _ircUser->hostmask().indexOf("!") + 1)), !(_ircUser->hostmask().remove(0, _ircUser->hostmask().indexOf("!") + 1) == "@")); + // ircOperator may contain "is an" or "is a", which should be removed. addRow(tr("Operator"), - NetworkItem::escapeHTML(_ircUser->ircOperator()), + NetworkItem::escapeHTML(_ircUser->ircOperator().replace("is an ", "").replace("is a ", "")), !_ircUser->ircOperator().isEmpty()); if (_ircUser->idleTime().isValid()) { -- 2.20.1