summaryrefslogtreecommitdiffhomepage
path: root/migration
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-04-20 09:10:21 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-04-20 09:35:28 +0200
commite18907846d8fda54fea105206aa29da646277c90 (patch)
treed16467f04f3970bbb3533a9288e460ccf46236f3 /migration
parent33c997bf8981ba3663fc48e4f4c04525a941f934 (diff)
{proto,tracker}-udp: add migration from old names
Issue: #571
Diffstat (limited to 'migration')
-rw-r--r--migration/20170420_00-udp-naming.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/migration/20170420_00-udp-naming.cpp b/migration/20170420_00-udp-naming.cpp
new file mode 100644
index 00000000..b1224c5d
--- /dev/null
+++ b/migration/20170420_00-udp-naming.cpp
@@ -0,0 +1,55 @@
+/* Copyright (c) 2017, Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this
+ * software for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice and this permission
+ * notice appear in all copies.
+ */
+
+#include "migration.hpp"
+#include "options/options.hpp"
+#include "compat/util.hpp"
+#include "logic/main-settings.hpp"
+
+using namespace migrations;
+using namespace options;
+
+static constexpr const char* old_tracker_name = "UDP sender";
+static constexpr const char* old_proto_name = "UDP Tracker";
+
+static constexpr const char* new_tracker_name = "UDP over network";
+static constexpr const char* new_proto_name = "UDP over network";
+
+struct rename_udp_stuff : migration
+{
+ bool should_run() const override
+ {
+ module_settings s;
+ return s.protocol_dll == old_proto_name || s.tracker_dll == old_tracker_name;
+ }
+
+ void run() override
+ {
+ module_settings s;
+
+ if (s.protocol_dll == old_proto_name)
+ s.protocol_dll = new_proto_name;
+
+ if (s.tracker_dll == old_tracker_name)
+ s.tracker_dll = new_tracker_name;
+
+ s.b->save();
+ }
+
+ QString unique_date() const override
+ {
+ return "20170420_00";
+ }
+
+ QString name() const override
+ {
+ return "rename confusing UDP tracker/proto names";
+ }
+};
+
+OPENTRACK_MIGRATION(rename_udp_stuff);