1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 12:34:19 +00:00

Merge pull request #13353 from FranciscoPombal/logger_fix

Fix peer blocked message
This commit is contained in:
Mike Tzou 2020-09-17 11:32:30 +08:00 committed by GitHub
commit 79bc4f40e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -4493,22 +4493,22 @@ void Session::handlePeerBlockedAlert(const lt::peer_blocked_alert *p)
QString reason; QString reason;
switch (p->reason) { switch (p->reason) {
case lt::peer_blocked_alert::ip_filter: case lt::peer_blocked_alert::ip_filter:
reason = tr("due to IP filter.", "this peer was blocked due to ip filter."); reason = tr("IP filter", "this peer was blocked. Reason: IP filter.");
break; break;
case lt::peer_blocked_alert::port_filter: case lt::peer_blocked_alert::port_filter:
reason = tr("due to port filter.", "this peer was blocked due to port filter."); reason = tr("port filter", "this peer was blocked. Reason: port filter.");
break; break;
case lt::peer_blocked_alert::i2p_mixed: case lt::peer_blocked_alert::i2p_mixed:
reason = tr("due to i2p mixed mode restrictions.", "this peer was blocked due to i2p mixed mode restrictions."); reason = tr("%1 mixed mode restrictions", "this peer was blocked. Reason: I2P mixed mode restrictions.").arg("I2P"); // don't translate I2P
break; break;
case lt::peer_blocked_alert::privileged_ports: case lt::peer_blocked_alert::privileged_ports:
reason = tr("because it has a low port.", "this peer was blocked because it has a low port."); reason = tr("use of privileged port", "this peer was blocked. Reason: use of privileged port.");
break; break;
case lt::peer_blocked_alert::utp_disabled: case lt::peer_blocked_alert::utp_disabled:
reason = tr("because %1 is disabled.", "this peer was blocked because uTP is disabled.").arg(QString::fromUtf8(C_UTP)); // don't translate μTP reason = tr("%1 is disabled", "this peer was blocked. Reason: uTP is disabled.").arg(QString::fromUtf8(C_UTP)); // don't translate μTP
break; break;
case lt::peer_blocked_alert::tcp_disabled: case lt::peer_blocked_alert::tcp_disabled:
reason = tr("because %1 is disabled.", "this peer was blocked because TCP is disabled.").arg("TCP"); // don't translate TCP reason = tr("%1 is disabled", "this peer was blocked. Reason: TCP is disabled.").arg("TCP"); // don't translate TCP
break; break;
} }

View File

@ -172,7 +172,7 @@ void LogPeerModel::handleNewMessage(const Log::Peer &peer)
{ {
const QString time = QDateTime::fromMSecsSinceEpoch(peer.timestamp).toString(Qt::SystemLocaleShortDate); const QString time = QDateTime::fromMSecsSinceEpoch(peer.timestamp).toString(Qt::SystemLocaleShortDate);
const QString message = peer.blocked const QString message = peer.blocked
? tr("%1 was blocked due to %2", "0.0.0.0 was blocked due to reason").arg(peer.ip, peer.reason) ? tr("%1 was blocked. Reason: %2.", "0.0.0.0 was blocked. Reason: reason for blocking.").arg(peer.ip, peer.reason)
: tr("%1 was banned", "0.0.0.0 was banned").arg(peer.ip); : tr("%1 was banned", "0.0.0.0 was banned").arg(peer.ip);
addNewMessage({time, message, m_bannedPeerForeground, Log::NORMAL}); addNewMessage({time, message, m_bannedPeerForeground, Log::NORMAL});