- addRow(tr("Away Message"), awayMessage);
- }
- addRow(tr("Realname"), _ircUser->realName(), !_ircUser->realName().isEmpty());
- addRow(tr("Operator"), _ircUser->ircOperator(), !_ircUser->ircOperator().isEmpty());
- addRow(tr("Suser Host"), _ircUser->suserHost(),!_ircUser->suserHost().isEmpty());
- addRow(tr("Whois Service Reply"), _ircUser->whoisServiceReply(), !_ircUser->whoisServiceReply().isEmpty());
- addRow(tr("Hostmask"), _ircUser->hostmask().remove(0, _ircUser->hostmask().indexOf("!")+1));
- addRow(tr("Operator"), _ircUser->ircOperator(), !_ircUser->ircOperator().isEmpty());
+ addRow(NetworkItem::escapeHTML(tr("Away message"), true), awayMessageHTML, true);
+ }
+ addRow(tr("Realname"),
+ NetworkItem::escapeHTML(_ircUser->realName()),
+ !_ircUser->realName().isEmpty());
+
+ // suserHost may return "<nick> 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());
+ }
+
+ // Keep track of whether or not the account information's been added. Don't show it twice.
+ bool accountAdded = false;
+ if(!_ircUser->account().isEmpty()) {
+ // IRCv3 account-notify is supported by the core and IRC server.
+ // Assume logged out (seems to be more common)
+ QString accountHTML = QString("<p class='italic'>%1</p>").arg(tr("Not logged in"));
+
+ // If account is logged in, replace with the escaped account name.
+ if (_ircUser->account() != "*") {
+ accountHTML = NetworkItem::escapeHTML(_ircUser->account());
+ }
+ addRow(NetworkItem::escapeHTML(tr("Account"), true),
+ accountHTML,
+ true);
+ // Mark the row as added
+ accountAdded = true;
+ }
+ // whoisServiceReply may return "<nick> 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")),
+ !accountAdded);
+ // Don't add the account row again if information's already added via account-notify
+ // Mark the row as added
+ accountAdded = 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().replace("is an ", "").replace("is a ", "")),
+ !_ircUser->ircOperator().isEmpty());