summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 274e5979..d41723ca 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -402,7 +402,19 @@ void Settings::updateServers(const QList<ServerInfo> &servers)
}
}
+ // clean up unavailable servers
+ QDate now = QDate::currentDate();
+ foreach (const QString &key, m_Settings.childKeys()) {
+ QVariantMap val = m_Settings.value(key).toMap();
+ QDate lastSeen = val["lastSeen"].toDate();
+ if (lastSeen.daysTo(now) > 30) {
+ qDebug("removing server %s since it hasn't been available for downloads in over a month", qPrintable(key));
+ m_Settings.remove(key);
+ }
+ }
+
m_Settings.endGroup();
+
m_Settings.sync();
}