1
0
mirror of https://github.com/anope/anope.git synced 2026-07-05 06:33:13 +02:00

Fix importing Atheme opers.

This commit is contained in:
Sadie Powell
2024-06-19 22:10:19 +01:00
parent 3388736fab
commit 01fc3ea22e
3 changed files with 86 additions and 38 deletions
+1 -37
View File
@@ -10,43 +10,7 @@
*/
#include "module.h"
struct MyOper final
: Oper
, Serializable
{
MyOper(const Anope::string &n, OperType *o) : Oper(n, o), Serializable("Oper") { }
void Serialize(Serialize::Data &data) const override
{
data["name"] << this->name;
data["type"] << this->ot->GetName();
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
{
Anope::string stype, sname;
data["type"] >> stype;
data["name"] >> sname;
OperType *ot = OperType::Find(stype);
if (ot == NULL)
return NULL;
NickCore *nc = NickCore::Find(sname);
if (nc == NULL)
return NULL;
MyOper *myo;
if (obj)
myo = anope_dynamic_static_cast<MyOper *>(obj);
else
myo = new MyOper(nc->display, ot);
nc->o = myo;
Log(LOG_NORMAL, "operserv/oper") << "Tied oper " << nc->display << " to type " << ot->GetName();
return myo;
}
};
#include "modules/os_oper.h"
class CommandOSOper final
: public Command