|
|
@ -27,7 +27,7 @@ bool BannedNodeLessThan::operator()(const CCombinedBan& left, const CCombinedBan |
|
|
|
case BanTableModel::Address: |
|
|
|
case BanTableModel::Address: |
|
|
|
return pLeft->subnet.ToString().compare(pRight->subnet.ToString()) < 0; |
|
|
|
return pLeft->subnet.ToString().compare(pRight->subnet.ToString()) < 0; |
|
|
|
case BanTableModel::Bantime: |
|
|
|
case BanTableModel::Bantime: |
|
|
|
return pLeft->bantil < pRight->bantil; |
|
|
|
return pLeft->banEntry.nBanUntil < pRight->banEntry.nBanUntil; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -47,18 +47,18 @@ public: |
|
|
|
/** Pull a full list of banned nodes from CNode into our cache */ |
|
|
|
/** Pull a full list of banned nodes from CNode into our cache */ |
|
|
|
void refreshBanlist() |
|
|
|
void refreshBanlist() |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::map<CSubNet, int64_t> banMap; |
|
|
|
banmap_t banMap; |
|
|
|
CNode::GetBanned(banMap); |
|
|
|
CNode::GetBanned(banMap); |
|
|
|
|
|
|
|
|
|
|
|
cachedBanlist.clear(); |
|
|
|
cachedBanlist.clear(); |
|
|
|
#if QT_VERSION >= 0x040700 |
|
|
|
#if QT_VERSION >= 0x040700 |
|
|
|
cachedBanlist.reserve(banMap.size()); |
|
|
|
cachedBanlist.reserve(banMap.size()); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
foreach (const PAIRTYPE(CSubNet, int64_t)& banentry, banMap) |
|
|
|
foreach (const PAIRTYPE(CSubNet, CBanEntry)& banentry, banMap) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CCombinedBan banEntry; |
|
|
|
CCombinedBan banEntry; |
|
|
|
banEntry.subnet = banentry.first; |
|
|
|
banEntry.subnet = banentry.first; |
|
|
|
banEntry.bantil = banentry.second; |
|
|
|
banEntry.banEntry = banentry.second; |
|
|
|
cachedBanlist.append(banEntry); |
|
|
|
cachedBanlist.append(banEntry); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -120,7 +120,7 @@ QVariant BanTableModel::data(const QModelIndex &index, int role) const |
|
|
|
return QString::fromStdString(rec->subnet.ToString()); |
|
|
|
return QString::fromStdString(rec->subnet.ToString()); |
|
|
|
case Bantime: |
|
|
|
case Bantime: |
|
|
|
QDateTime date = QDateTime::fromMSecsSinceEpoch(0); |
|
|
|
QDateTime date = QDateTime::fromMSecsSinceEpoch(0); |
|
|
|
date = date.addSecs(rec->bantil); |
|
|
|
date = date.addSecs(rec->banEntry.nBanUntil); |
|
|
|
return date.toString(Qt::SystemLocaleLongDate); |
|
|
|
return date.toString(Qt::SystemLocaleLongDate); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|