summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-06-19 20:04:17 +0100
committerSadie Powell <sadie@witchery.services>2024-06-19 20:31:55 +0100
commita44acb6de5017e6752c7e2c687e7c3a1380ad0a7 (patch)
treeeb7d91ab5c93b988928c4925d64818a14c65854a /modules
parent13e5ddf8078d2e5df5f601b3f6fe89fb03bf7f30 (diff)
Fix importing Atheme forbid reasons.
Diffstat (limited to 'modules')
-rw-r--r--modules/database/db_atheme.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/modules/database/db_atheme.cpp b/modules/database/db_atheme.cpp
index 9c754ffe3..f48f39d3e 100644
--- a/modules/database/db_atheme.cpp
+++ b/modules/database/db_atheme.cpp
@@ -924,15 +924,35 @@ private:
bool HandleMDN(AthemeRow &row)
{
- // MDN <display> <key> <value>
- auto display = row.Get();
+ // MDN <nick> <key> <value>
+ auto nick = row.Get();
auto key = row.Get();
auto value = row.GetRemaining();
if (!row)
return row.LogError(this);
- Log(this) << "Unknown nick metadata " << key << " = " << value;
+ if (!forbidsvc)
+ {
+ Log(this) << "Unable to convert forbidden nick " << nick << " metadata as os_forbid is not loaded";
+ return true;
+ }
+
+ auto *forbid = forbidsvc->FindForbidExact(nick, FT_NICK);
+ if (!forbid)
+ {
+ Log(this) << "Missing forbid for MDN: " << nick;
+ return false;
+ }
+
+ if (key == "private:mark:reason")
+ forbid->reason = value;
+ else if (key == "private:mark:setter")
+ forbid->creator = value;
+ else if (key == "private:mark:timestamp")
+ forbid->created = Anope::Convert<time_t>(value, 0);
+ else
+ Log(this) << "Unknown forbidden nick metadata " << key << " = " << value;
return true;
}