Skip to content

Commit

Permalink
Make variable meaningful
Browse files Browse the repository at this point in the history
  • Loading branch information
c0re100 committed Oct 29, 2023
1 parent 7aed79b commit 00771cb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/gui/properties/peerlistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,15 @@ void PeerListWidget::banSelectedPeers()
// Store selected rows first as selected peers may disconnect
const QModelIndexList selectedIndexes = selectionModel()->selectedRows();

struct selectedData {
struct peerData {
QString ip;
QString client;
QString peerId;
QString country;
};

QVector<selectedData> selectedDatas;
selectedDatas.reserve(selectedIndexes.size());
QVector<peerData> selectedPeers;
selectedPeers.reserve(selectedIndexes.size());

for (const QModelIndex &index : selectedIndexes)
{
Expand All @@ -366,16 +366,16 @@ void PeerListWidget::banSelectedPeers()
QHostAddress host(ip);
const QString country = Net::GeoIPManager::CountryName(Net::GeoIPManager::instance()->lookup(host));

selectedData tmp{ip, client, peerId, country};
selectedDatas += tmp;
peerData tmp{ip, client, peerId, country};
selectedPeers += tmp;
}

// Confirm before banning peer
const QMessageBox::StandardButton btn = QMessageBox::question(this, tr("Ban peer permanently")
, tr("Are you sure you want to permanently ban the selected peers?"));
if (btn != QMessageBox::Yes) return;

for (const selectedData &data : selectedDatas)
for (const peerData &data : selectedPeers)
{
BitTorrent::Session::instance()->banIP(data.ip);
LogMsg(tr("Peer \"%1\" is manually banned. PeerID: '%2' Client: '%3' Country: '%4'").arg(data.ip).arg(data.peerId).arg(data.client).arg(data.country));
Expand Down

0 comments on commit 00771cb

Please sign in to comment.