summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-03-07 12:31:42 +0000
committerSadie Powell <sadie@witchery.services>2025-03-07 12:31:42 +0000
commitb30bfb5d2b926fccd72dac7481486b66e203f2b7 (patch)
treebe2b5459c1397218f2a856d265ec9a8aaed83036
parentcccdf0431bd755ab927ce434458b831c58bc7244 (diff)
Import misc channel and user metadata in db_atheme.
-rw-r--r--modules/chanserv/cs_set_misc.cpp6
-rw-r--r--modules/database/db_atheme.cpp29
-rw-r--r--modules/nickserv/ns_set_misc.cpp3
3 files changed, 37 insertions, 1 deletions
diff --git a/modules/chanserv/cs_set_misc.cpp b/modules/chanserv/cs_set_misc.cpp
index 01a5b90b7..4439589a8 100644
--- a/modules/chanserv/cs_set_misc.cpp
+++ b/modules/chanserv/cs_set_misc.cpp
@@ -207,9 +207,13 @@ public:
descriptions[cname] = desc;
+ // Force creation of the extension item.
+ const auto extname = "cs_set_misc:" + GetAttribute(cname);
+ GetItem(extname);
+
auto numeric = block.Get<unsigned>("misc_numeric");
if (numeric >= 1 && numeric <= 999)
- numerics["cs_set_misc:" + GetAttribute(cname)] = numeric;
+ numerics[extname] = numeric;
}
}
diff --git a/modules/database/db_atheme.cpp b/modules/database/db_atheme.cpp
index ada5d25a6..912e7fd2c 100644
--- a/modules/database/db_atheme.cpp
+++ b/modules/database/db_atheme.cpp
@@ -23,6 +23,7 @@
#include "modules/os_news.h"
#include "modules/os_oper.h"
#include "modules/os_session.h"
+#include "modules/set_misc.h"
#include "modules/suspend.h"
// Handles reading from an Atheme database row.
@@ -1066,6 +1067,20 @@ private:
ci->last_topic_time = Anope::Convert<time_t>(value, 0);
else if (key.compare(0, 14, "private:stats:", 14) == 0)
return HandleIgnoreMetadata(ci->name, key, value);
+ else if (key.find(':') == Anope::string::npos)
+ {
+ ExtensibleRef<MiscData> extref("cs_set_misc:" + key.upper());
+ if (!extref)
+ {
+ Log(this) << "Unknown public metadata for " << ci->name << ": " << key << " = " << value;
+ return true;
+ }
+
+ auto *data = extref->Set(ci);
+ data->object = ci->name;
+ data->name = key;
+ data->data = value;
+ }
else
Log(this) << "Unknown channel metadata for " << ci->name << ": " << key << " = " << value;
@@ -1178,6 +1193,20 @@ private:
data->vhost_ts = Anope::Convert<time_t>(value, 0);
else if (key.compare(0, 18, "private:usercloak:", 18) == 0)
data->vhost_nick[key.substr(18)] = value;
+ else if (key.find(':') == Anope::string::npos)
+ {
+ ExtensibleRef<MiscData> extref("ns_set_misc:" + key.upper());
+ if (!extref)
+ {
+ Log(this) << "Unknown public channel metadata for " << nc->display << ": " << key << " = " << value;
+ return true;
+ }
+
+ auto *data = extref->Set(nc);
+ data->object = nc->display;
+ data->name = key;
+ data->data = value;
+ }
else
Log(this) << "Unknown account metadata for " << nc->display << ": " << key << " = " << value;
diff --git a/modules/nickserv/ns_set_misc.cpp b/modules/nickserv/ns_set_misc.cpp
index 77dd62d92..90d463fff 100644
--- a/modules/nickserv/ns_set_misc.cpp
+++ b/modules/nickserv/ns_set_misc.cpp
@@ -220,6 +220,9 @@ public:
continue;
descriptions[cname] = desc;
+
+ // Force creation of the extension item.
+ GetItem("ns_set_misc:" + GetAttribute(cname));
}
}