diff options
Diffstat (limited to 'src/Net.cpp')
-rw-r--r-- | src/Net.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Net.cpp b/src/Net.cpp index a3d737e91..b9a18819b 100644 --- a/src/Net.cpp +++ b/src/Net.cpp @@ -162,3 +162,20 @@ bool Ban::operator ==(const Ban &other) const { bool Ban::isValid() const { return haAddress.isValid() && (iMask >= 8) && (iMask <= 128); } + +QString Ban::toString() const { + return QString(QLatin1String("Hash: \"%1\", Host: \"%2\", Mask: \"%3\", Username: \"%4\", Reason: \"%5\", BanStart: \"%6\", BanEnd: \"%7\" %8")).arg( + qsHash, + haAddress.toString(), + haAddress.isV6() ? QString::number(iMask) : QString::number(iMask-96), + qsUsername, + qsReason, + qdtStart.toLocalTime().toString("yyyy-MM-dd hh:mm:ss"), + qdtStart.toLocalTime().addSecs(iDuration).toString("yyyy-MM-dd hh:mm:ss"), + iDuration == 0 ? "(permanent)" : "(temporary)" + ); +} + +quint32 qHash(const Ban &b) { + return qHash(b.qsHash) ^ qHash(b.haAddress) ^ qHash(b.qsUsername) ^ qHash(b.iMask); +} |