summaryrefslogtreecommitdiff
path: root/modules/database/db_atheme.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-06-19 22:10:19 +0100
committerSadie Powell <sadie@witchery.services>2024-06-19 22:44:31 +0100
commit01fc3ea22e02da39a0297858dba118ea3da4e410 (patch)
treed130b0d2dd471b51821da13e44bc964a19c715c8 /modules/database/db_atheme.cpp
parent3388736fabf562de9ad2c50cb45c7ccbb05ab9f0 (diff)
Fix importing Atheme opers.
Diffstat (limited to 'modules/database/db_atheme.cpp')
-rw-r--r--modules/database/db_atheme.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/modules/database/db_atheme.cpp b/modules/database/db_atheme.cpp
index 8ccef0e20..16a8595d0 100644
--- a/modules/database/db_atheme.cpp
+++ b/modules/database/db_atheme.cpp
@@ -20,6 +20,7 @@
#include "modules/info.h"
#include "modules/ns_cert.h"
#include "modules/os_forbid.h"
+#include "modules/os_oper.h"
#include "modules/os_session.h"
#include "modules/suspend.h"
@@ -202,7 +203,7 @@ private:
{ "RR", &DBAtheme::HandleIgnore },
{ "RW", &DBAtheme::HandleIgnore },
{ "SI", &DBAtheme::HandleIgnore },
- { "SO", &DBAtheme::HandleIgnore },
+ { "SO", &DBAtheme::HandleSO },
{ "TS", &DBAtheme::HandleIgnore },
{ "XID", &DBAtheme::HandleIgnore },
{ "XL", &DBAtheme::HandleXL },
@@ -1328,6 +1329,43 @@ private:
return true;
}
+ bool HandleSO(AthemeRow &row)
+ {
+ // SO <display> <type> <flags>
+ auto display = row.Get();
+ auto type = row.Get();
+ auto flags = row.Get();
+
+ if (!row)
+ return row.LogError(this);
+
+ auto *nc = NickCore::Find(display);
+ if (!nc)
+ {
+ Log(this) << "Missing NickCore for SO: " << display;
+ return false;
+ }
+
+ auto ot = OperType::Find(type);
+ if (!ot)
+ {
+ // Attempt to convert oper types.
+ if (type == "sra")
+ ot = OperType::Find("Services Root");
+ else if (type == "ircop")
+ ot = OperType::Find("Services Operator");
+ }
+
+ if (!ot)
+ {
+ Log(this) << "Unable to convert operator status for " << nc->display << " as there is no equivalent oper type: " << type;
+ return true;
+ }
+
+ nc->o = new MyOper(nc->display, ot);
+ return true;
+ }
+
bool HandleXL(AthemeRow &row)
{
// XL <id> <real> <duration> <settime> <setby> <reason>