summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-06-19 20:19:35 +0100
committerSadie Powell <sadie@witchery.services>2024-06-19 20:22:57 +0100
commit13e5ddf8078d2e5df5f601b3f6fe89fb03bf7f30 (patch)
tree20a4951d3b19451b4964cca6578921fd0229a871 /modules
parente42c728ab8bca1ef6be17f66d8a41ae175913e5b (diff)
Fix importing Atheme akick reasons.
Diffstat (limited to 'modules')
-rw-r--r--modules/database/db_atheme.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/modules/database/db_atheme.cpp b/modules/database/db_atheme.cpp
index 948ff787f..9c754ffe3 100644
--- a/modules/database/db_atheme.cpp
+++ b/modules/database/db_atheme.cpp
@@ -97,6 +97,7 @@ struct ModeData final
struct ChannelData final
{
+ Anope::unordered_map<AutoKick *> akicks;
Anope::string bot;
Anope::string info_adder;
Anope::string info_message;
@@ -583,10 +584,11 @@ private:
auto *nc = NickCore::Find(mask);
if (flags.find('b') != Anope::string::npos)
{
+ auto *data = chandata.Require(ci);
if (nc)
- ci->AddAkick(setter, nc, "", modifiedtime, modifiedtime);
+ data->akicks[mask] = ci->AddAkick(setter, nc, "", modifiedtime, modifiedtime);
else
- ci->AddAkick(setter, mask, "", modifiedtime, modifiedtime);
+ data->akicks[mask] = ci->AddAkick(setter, mask, "", modifiedtime, modifiedtime);
return true;
}
@@ -822,7 +824,7 @@ private:
bool HandleMDA(AthemeRow &row)
{
// MDA <channel> <account/mask> <key> <value>
- auto display = row.Get();
+ auto channel = row.Get();
auto mask = row.Get();
auto key = row.Get();
auto value = row.GetRemaining();
@@ -830,7 +832,23 @@ private:
if (!row)
return row.LogError(this);
- Log(this) << "Unknown channel access metadata " << key << " = " << value;
+ auto *ci = ChannelInfo::Find(channel);
+ if (!ci)
+ {
+ Log(this) << "Missing ChannelInfo for MDA: " << channel;
+ return false;
+ }
+
+ if (key == "reason")
+ {
+ auto *data = chandata.Require(ci);
+ auto akick = data->akicks.find(mask);
+ if (akick != data->akicks.end())
+ akick->second->reason = value;
+ }
+ else
+ Log(this) << "Unknown channel access metadata " << key << " = " << value;
+
return true;
}