mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Fixed storing mode locks
This commit is contained in:
@@ -50,6 +50,7 @@ class CoreExport ChanAccess : public Serializable
|
||||
ChanAccess(AccessProvider *p);
|
||||
virtual ~ChanAccess();
|
||||
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag, NS_EN
|
||||
NickCore *nc; /* I'm an alias of this */
|
||||
HostInfo hostinfo;
|
||||
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
|
||||
@@ -162,6 +163,7 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END
|
||||
time_t lastmail; /* Last time this nick record got a mail */
|
||||
std::list<NickAlias *> aliases; /* List of aliases */
|
||||
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>, public Se
|
||||
*/
|
||||
virtual ~BotInfo();
|
||||
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
|
||||
|
||||
+1
-2
@@ -13,8 +13,6 @@ class XLineManager;
|
||||
|
||||
class CoreExport XLine : public Serializable
|
||||
{
|
||||
protected:
|
||||
XLine();
|
||||
public:
|
||||
Anope::string Mask;
|
||||
Anope::string By;
|
||||
@@ -33,6 +31,7 @@ class CoreExport XLine : public Serializable
|
||||
Anope::string GetHost() const;
|
||||
sockaddrs GetIP() const;
|
||||
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &data);
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ struct CoreExport BadWord : Serializable
|
||||
Anope::string word;
|
||||
BadWordType type;
|
||||
|
||||
BadWord();
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
};
|
||||
@@ -111,13 +111,13 @@ class CoreExport AutoKick : public Flags<AutoKickFlag>, public Serializable
|
||||
time_t addtime;
|
||||
time_t last_used;
|
||||
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
};
|
||||
|
||||
struct CoreExport ModeLock : Serializable
|
||||
{
|
||||
ModeLock();
|
||||
public:
|
||||
ChannelInfo *ci;
|
||||
bool set;
|
||||
@@ -128,6 +128,7 @@ struct CoreExport ModeLock : Serializable
|
||||
|
||||
ModeLock(ChannelInfo *ch, bool s, ChannelModeName n, const Anope::string &p, const Anope::string &se = "", time_t c = Anope::CurTime);
|
||||
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
};
|
||||
@@ -145,7 +146,7 @@ struct CoreExport LogSetting : Serializable
|
||||
Anope::string creator;
|
||||
time_t created;
|
||||
|
||||
LogSetting();
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
};
|
||||
@@ -204,6 +205,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
|
||||
int16_t floodlines, floodsecs; /* For FLOOD kicker */
|
||||
int16_t repeattimes; /* For REPEAT kicker */
|
||||
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
|
||||
|
||||
+2
-12
@@ -68,16 +68,10 @@ class CoreExport Serializable
|
||||
private:
|
||||
static std::list<Serializable *> *serizliable_items;
|
||||
|
||||
Anope::string serizliable_name;
|
||||
std::list<Serializable *>::iterator s_iter;
|
||||
|
||||
Serializable()
|
||||
{
|
||||
throw CoreException();
|
||||
}
|
||||
|
||||
protected:
|
||||
Serializable(const Anope::string &n) : serizliable_name(n)
|
||||
Serializable()
|
||||
{
|
||||
if (serizliable_items == NULL)
|
||||
serizliable_items = new std::list<Serializable *>();
|
||||
@@ -104,11 +98,7 @@ class CoreExport Serializable
|
||||
public:
|
||||
typedef std::map<Anope::string, Serialize::stringstream> serialized_data;
|
||||
|
||||
const Anope::string &GetSerializeName()
|
||||
{
|
||||
return this->serizliable_name;
|
||||
}
|
||||
|
||||
virtual Anope::string serialize_name() const = 0;
|
||||
virtual serialized_data serialize() = 0;
|
||||
|
||||
static const std::list<Serializable *> &GetItems()
|
||||
|
||||
@@ -505,6 +505,8 @@ class CoreExport Memo : public Flags<MemoFlag>, public Serializable
|
||||
{
|
||||
public:
|
||||
Memo();
|
||||
|
||||
Anope::string serialize_name() const;
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ struct EntryMsg : Serializable
|
||||
Anope::string message;
|
||||
time_t when;
|
||||
|
||||
EntryMsg(ChannelInfo *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime) : Serializable("EntryMsg")
|
||||
EntryMsg(ChannelInfo *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime)
|
||||
{
|
||||
|
||||
this->ci = c;
|
||||
@@ -29,6 +29,11 @@ struct EntryMsg : Serializable
|
||||
this->when = ct;
|
||||
}
|
||||
|
||||
Anope::string serialize_name() const
|
||||
{
|
||||
return "EntryMsg";
|
||||
}
|
||||
|
||||
serialized_data serialize()
|
||||
{
|
||||
serialized_data data;
|
||||
|
||||
@@ -54,8 +54,12 @@ class CommandCSRegister : public Command
|
||||
if (!chdesc.empty())
|
||||
ci->desc = chdesc;
|
||||
|
||||
ci->mode_locks = def_mode_locks;
|
||||
for (ChannelInfo::ModeList::iterator it = ci->mode_locks.begin(), it_end = ci->mode_locks.end(); it != it_end; ++it)
|
||||
{
|
||||
it->second.setter = u->nick;
|
||||
it->second.ci = ci;
|
||||
}
|
||||
|
||||
if (c && !c->topic.empty())
|
||||
{
|
||||
|
||||
@@ -33,10 +33,15 @@ struct SeenInfo : Serializable
|
||||
Anope::string message; // for part/kick/quit
|
||||
time_t last; // the time when the user was last seen
|
||||
|
||||
SeenInfo() : Serializable("SeenInfo")
|
||||
SeenInfo()
|
||||
{
|
||||
}
|
||||
|
||||
Anope::string serialize_name() const
|
||||
{
|
||||
return "SeenInfo";
|
||||
}
|
||||
|
||||
serialized_data serialize()
|
||||
{
|
||||
serialized_data data;
|
||||
|
||||
@@ -18,10 +18,15 @@ struct CSMiscData : Anope::string, ExtensibleItem, Serializable
|
||||
Anope::string name;
|
||||
Anope::string data;
|
||||
|
||||
CSMiscData(ChannelInfo *c, const Anope::string &n, const Anope::string &d) : Serializable("CSMiscData"), ci(c), name(n), data(d)
|
||||
CSMiscData(ChannelInfo *c, const Anope::string &n, const Anope::string &d) : ci(c), name(n), data(d)
|
||||
{
|
||||
}
|
||||
|
||||
Anope::string serialize_name() const
|
||||
{
|
||||
return "CSMiscData";
|
||||
}
|
||||
|
||||
serialized_data serialize()
|
||||
{
|
||||
serialized_data sdata;
|
||||
|
||||
@@ -18,10 +18,15 @@ struct ChanSuspend : ExtensibleItem, Serializable
|
||||
Anope::string chan;
|
||||
time_t when;
|
||||
|
||||
ChanSuspend() : Serializable("ChanSuspend")
|
||||
ChanSuspend()
|
||||
{
|
||||
}
|
||||
|
||||
Anope::string serialize_name() const
|
||||
{
|
||||
return "ChanSuspend";
|
||||
}
|
||||
|
||||
serialized_data serialize()
|
||||
{
|
||||
serialized_data sd;
|
||||
|
||||
@@ -30,8 +30,9 @@ struct HostRequest : ExtensibleItem, Serializable
|
||||
Anope::string host;
|
||||
time_t time;
|
||||
|
||||
HostRequest() : Serializable("HostRequest")
|
||||
Anope::string serialize_name() const
|
||||
{
|
||||
return "HostRequest";
|
||||
}
|
||||
|
||||
serialized_data serialize()
|
||||
|
||||
@@ -17,7 +17,12 @@ struct AJoinList : std::vector<std::pair<Anope::string, Anope::string> >, Extens
|
||||
{
|
||||
NickCore *nc;
|
||||
|
||||
AJoinList(NickCore *n) : Serializable("AJoinList"), nc(n) { }
|
||||
AJoinList(NickCore *n) : nc(n) { }
|
||||
|
||||
Anope::string serialize_name() const
|
||||
{
|
||||
return "AJoinList";
|
||||
}
|
||||
|
||||
serialized_data serialize()
|
||||
{
|
||||
|
||||
@@ -19,10 +19,15 @@ struct NSMiscData : Anope::string, ExtensibleItem, Serializable
|
||||
Anope::string name;
|
||||
Anope::string data;
|
||||
|
||||
NSMiscData(NickCore *ncore, const Anope::string &n, const Anope::string &d) : Serializable("NSMiscdata"), nc(ncore), name(n), data(d)
|
||||
NSMiscData(NickCore *ncore, const Anope::string &n, const Anope::string &d) : nc(ncore), name(n), data(d)
|
||||
{
|
||||
}
|
||||
|
||||
Anope::string serialize_name() const
|
||||
{
|
||||
return "NSMiscData";
|
||||
}
|
||||
|
||||
serialized_data serialize()
|
||||
{
|
||||
serialized_data sdata;
|
||||
|
||||
@@ -18,10 +18,15 @@ struct NickSuspend : ExtensibleItem, Serializable
|
||||
Anope::string nick;
|
||||
time_t when;
|
||||
|
||||
NickSuspend() : Serializable("NickSuspend")
|
||||
NickSuspend()
|
||||
{
|
||||
}
|
||||
|
||||
Anope::string serialize_name() const
|
||||
{
|
||||
return "NickSuspend";
|
||||
}
|
||||
|
||||
serialized_data serialize()
|
||||
{
|
||||
serialized_data sd;
|
||||
|
||||
@@ -18,10 +18,7 @@ struct ForbidData : Serializable
|
||||
time_t expires;
|
||||
ForbidType type;
|
||||
|
||||
ForbidData() : Serializable("ForbidData")
|
||||
{
|
||||
}
|
||||
|
||||
Anope::string serialize_name() const { return "ForbidData"; }
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &data);
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ struct IgnoreData : Serializable
|
||||
Anope::string reason;
|
||||
time_t time; /* When do we stop ignoring them? */
|
||||
|
||||
IgnoreData() : Serializable("IgnoreData") { }
|
||||
Anope::string serialize_name() const { return "IgnoreData"; }
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &data);
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ struct NewsItem : Serializable
|
||||
Anope::string who;
|
||||
time_t time;
|
||||
|
||||
NewsItem() : Serializable("NewsItem") { }
|
||||
Anope::string serialize_name() const { return "NewsItem"; }
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &data);
|
||||
};
|
||||
|
||||
@@ -15,7 +15,12 @@
|
||||
|
||||
struct MyOper : Oper, Serializable
|
||||
{
|
||||
MyOper(const Anope::string &n, OperType *o) : Oper(n, o), Serializable("Oper") { }
|
||||
MyOper(const Anope::string &n, OperType *o) : Oper(n, o) { }
|
||||
|
||||
Anope::string serialize_name() const
|
||||
{
|
||||
return "Oper";
|
||||
}
|
||||
|
||||
serialized_data serialize()
|
||||
{
|
||||
|
||||
@@ -10,10 +10,7 @@ struct Exception : Serializable
|
||||
time_t time; /* When this exception was added */
|
||||
time_t expires; /* Time when it expires. 0 == no expiry */
|
||||
|
||||
Exception() : Serializable("Exception")
|
||||
{
|
||||
}
|
||||
|
||||
Anope::string serialize_name() const { return "Exception"; }
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &data);
|
||||
};
|
||||
|
||||
@@ -157,7 +157,7 @@ class DBFlatFile : public Module
|
||||
Serializable *base = *it;
|
||||
Serializable::serialized_data data = base->serialize();
|
||||
|
||||
db << "OBJECT " << base->GetSerializeName() << "\n";
|
||||
db << "OBJECT " << base->serialize_name() << "\n";
|
||||
for (Serializable::serialized_data::iterator dit = data.begin(), dit_end = data.end(); dit != dit_end; ++dit)
|
||||
db << "DATA " << dit->first << " " << dit->second.astr() << "\n";
|
||||
db << "END\n";
|
||||
|
||||
@@ -141,18 +141,18 @@ class DBSQL : public Module
|
||||
if (data.empty())
|
||||
continue;
|
||||
|
||||
std::set<Anope::string> &layout = table_layout[base->GetSerializeName()];
|
||||
std::set<Anope::string> &layout = table_layout[base->serialize_name()];
|
||||
if (layout.empty())
|
||||
{
|
||||
this->RunBackground(this->sql->CreateTable(base->GetSerializeName(), data));
|
||||
this->RunBackground(this->sql->CreateTable(base->serialize_name(), data));
|
||||
|
||||
for (Serializable::serialized_data::iterator it2 = data.begin(), it2_end = data.end(); it2 != it2_end; ++it2)
|
||||
layout.insert(it2->first);
|
||||
}
|
||||
else
|
||||
this->AlterTable(base->GetSerializeName(), layout, data);
|
||||
this->AlterTable(base->serialize_name(), layout, data);
|
||||
|
||||
this->Insert(base->GetSerializeName(), data);
|
||||
this->Insert(base->serialize_name(), data);
|
||||
}
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -158,20 +158,20 @@ class DBMySQL : public Module
|
||||
{
|
||||
NickAlias *na = findnick(source.u->nick);
|
||||
if (!na)
|
||||
this->Insert(na->nc->GetSerializeName(), na->nc->serialize());
|
||||
this->Insert(na->nc->serialize_name(), na->nc->serialize());
|
||||
|
||||
}
|
||||
else if (command->name.find("nickserv/saset/") == 0)
|
||||
{
|
||||
NickAlias *na = findnick(params[1]);
|
||||
if (!na)
|
||||
this->Insert(na->nc->GetSerializeName(), na->nc->serialize());
|
||||
this->Insert(na->nc->serialize_name(), na->nc->serialize());
|
||||
}
|
||||
else if (command->name.find("chanserv/set") == 0 || command->name.find("chanserv/saset") == 0)
|
||||
{
|
||||
ChannelInfo *ci = params.size() > 0 ? cs_findchan(params[0]) : NULL;
|
||||
if (!ci)
|
||||
this->Insert(ci->GetSerializeName(), ci->serialize());
|
||||
this->Insert(ci->serialize_name(), ci->serialize());
|
||||
}
|
||||
else if (command->name == "botserv/kick" && params.size() > 2)
|
||||
{
|
||||
@@ -180,7 +180,7 @@ class DBMySQL : public Module
|
||||
return;
|
||||
if (!ci->AccessFor(u).HasPriv("SET") && !u->HasPriv("botserv/administration"))
|
||||
return;
|
||||
this->Insert(ci->GetSerializeName(), ci->serialize());
|
||||
this->Insert(ci->serialize_name(), ci->serialize());
|
||||
}
|
||||
else if (command->name == "botserv/set" && params.size() > 1)
|
||||
{
|
||||
@@ -189,9 +189,9 @@ class DBMySQL : public Module
|
||||
if (!ci)
|
||||
bi = findbot(params[0]);
|
||||
if (bi && params[1].equals_ci("PRIVATE") && u->HasPriv("botserv/set/private"))
|
||||
this->Insert(bi->GetSerializeName(), bi->serialize());
|
||||
this->Insert(bi->serialize_name(), bi->serialize());
|
||||
else if (ci && !ci->AccessFor(u).HasPriv("SET") && !u->HasPriv("botserv/administration"))
|
||||
this->Insert(ci->GetSerializeName(), ci->serialize());
|
||||
this->Insert(ci->serialize_name(), ci->serialize());
|
||||
}
|
||||
else if (command->name == "memoserv/ignore" && params.size() > 0)
|
||||
{
|
||||
@@ -200,40 +200,40 @@ class DBMySQL : public Module
|
||||
{
|
||||
NickCore *nc = u->Account();
|
||||
if (nc)
|
||||
this->Insert(nc->GetSerializeName(), nc->serialize());
|
||||
this->Insert(nc->serialize_name(), nc->serialize());
|
||||
}
|
||||
else
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(target);
|
||||
if (ci && ci->AccessFor(u).HasPriv("MEMO"))
|
||||
this->Insert(ci->GetSerializeName(), ci->serialize());
|
||||
this->Insert(ci->serialize_name(), ci->serialize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnNickAddAccess(NickCore *nc, const Anope::string &entry)
|
||||
{
|
||||
this->Insert(nc->GetSerializeName(), nc->serialize());
|
||||
this->Insert(nc->serialize_name(), nc->serialize());
|
||||
}
|
||||
|
||||
void OnNickEraseAccess(NickCore *nc, const Anope::string &entry)
|
||||
{
|
||||
this->Insert(nc->GetSerializeName(), nc->serialize());
|
||||
this->Insert(nc->serialize_name(), nc->serialize());
|
||||
}
|
||||
|
||||
void OnNickClearAccess(NickCore *nc)
|
||||
{
|
||||
this->Insert(nc->GetSerializeName(), nc->serialize());
|
||||
this->Insert(nc->serialize_name(), nc->serialize());
|
||||
}
|
||||
|
||||
void OnDelCore(NickCore *nc)
|
||||
{
|
||||
this->Delete(nc->GetSerializeName(), nc->serialize());
|
||||
this->Delete(nc->serialize_name(), nc->serialize());
|
||||
}
|
||||
|
||||
void OnNickForbidden(NickAlias *na)
|
||||
{
|
||||
this->Insert(na->GetSerializeName(), na->serialize());
|
||||
this->Insert(na->serialize_name(), na->serialize());
|
||||
}
|
||||
|
||||
void OnNickGroup(User *u, NickAlias *)
|
||||
@@ -243,12 +243,12 @@ class DBMySQL : public Module
|
||||
|
||||
void InsertAlias(NickAlias *na)
|
||||
{
|
||||
this->Insert(na->GetSerializeName(), na->serialize());
|
||||
this->Insert(na->serialize_name(), na->serialize());
|
||||
}
|
||||
|
||||
void InsertCore(NickCore *nc)
|
||||
{
|
||||
this->Insert(nc->GetSerializeName(), nc->serialize());
|
||||
this->Insert(nc->serialize_name(), nc->serialize());
|
||||
}
|
||||
|
||||
void OnNickRegister(NickAlias *na)
|
||||
@@ -260,41 +260,41 @@ class DBMySQL : public Module
|
||||
void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay)
|
||||
{
|
||||
Serializable::serialized_data data = nc->serialize();
|
||||
this->Delete(nc->GetSerializeName(), data);
|
||||
this->Delete(nc->serialize_name(), data);
|
||||
data.erase("display");
|
||||
data["display"] << newdisplay;
|
||||
this->Insert(nc->GetSerializeName(), data);
|
||||
this->Insert(nc->serialize_name(), data);
|
||||
|
||||
for (std::list<NickAlias *>::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end; ++it)
|
||||
{
|
||||
NickAlias *na = *it;
|
||||
data = na->serialize();
|
||||
|
||||
this->Delete(na->GetSerializeName(), data);
|
||||
this->Delete(na->serialize_name(), data);
|
||||
data.erase("nc");
|
||||
data["nc"] << newdisplay;
|
||||
this->Insert(na->GetSerializeName(), data);
|
||||
this->Insert(na->serialize_name(), data);
|
||||
}
|
||||
}
|
||||
|
||||
void OnNickSuspend(NickAlias *na)
|
||||
{
|
||||
this->Insert(na->GetSerializeName(), na->serialize());
|
||||
this->Insert(na->serialize_name(), na->serialize());
|
||||
}
|
||||
|
||||
void OnDelNick(NickAlias *na)
|
||||
{
|
||||
this->Delete(na->GetSerializeName(), na->serialize());
|
||||
this->Delete(na->serialize_name(), na->serialize());
|
||||
}
|
||||
|
||||
void OnAccessAdd(ChannelInfo *ci, User *, ChanAccess *access)
|
||||
{
|
||||
this->Insert(access->GetSerializeName(), access->serialize());
|
||||
this->Insert(access->serialize_name(), access->serialize());
|
||||
}
|
||||
|
||||
void OnAccessDel(ChannelInfo *ci, User *u, ChanAccess *access)
|
||||
{
|
||||
this->Delete(access->GetSerializeName(), access->serialize());
|
||||
this->Delete(access->serialize_name(), access->serialize());
|
||||
}
|
||||
|
||||
void OnAccessClear(ChannelInfo *ci, User *u)
|
||||
@@ -305,49 +305,49 @@ class DBMySQL : public Module
|
||||
|
||||
void OnLevelChange(User *u, ChannelInfo *ci, const Anope::string &priv, int16_t what)
|
||||
{
|
||||
this->Insert(ci->GetSerializeName(), ci->serialize());
|
||||
this->Insert(ci->serialize_name(), ci->serialize());
|
||||
}
|
||||
|
||||
void OnDelChan(ChannelInfo *ci)
|
||||
{
|
||||
this->Delete(ci->GetSerializeName(), ci->serialize());
|
||||
this->Delete(ci->serialize_name(), ci->serialize());
|
||||
}
|
||||
|
||||
void OnChanRegistered(ChannelInfo *ci)
|
||||
{
|
||||
this->Insert(ci->GetSerializeName(), ci->serialize());
|
||||
this->Insert(ci->serialize_name(), ci->serialize());
|
||||
}
|
||||
|
||||
void OnChanSuspend(ChannelInfo *ci)
|
||||
{
|
||||
this->Insert(ci->GetSerializeName(), ci->serialize());
|
||||
this->Insert(ci->serialize_name(), ci->serialize());
|
||||
}
|
||||
|
||||
void OnAkickAdd(ChannelInfo *ci, AutoKick *ak)
|
||||
{
|
||||
this->Insert(ak->GetSerializeName(), ak->serialize());
|
||||
this->Insert(ak->serialize_name(), ak->serialize());
|
||||
}
|
||||
|
||||
void OnAkickDel(ChannelInfo *ci, AutoKick *ak)
|
||||
{
|
||||
this->Delete(ak->GetSerializeName(), ak->serialize());
|
||||
this->Delete(ak->serialize_name(), ak->serialize());
|
||||
}
|
||||
|
||||
EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock)
|
||||
{
|
||||
this->Insert(lock->GetSerializeName(), lock->serialize());
|
||||
this->Insert(lock->serialize_name(), lock->serialize());
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
|
||||
EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock)
|
||||
{
|
||||
this->Delete(lock->GetSerializeName(), lock->serialize());
|
||||
this->Delete(lock->serialize_name(), lock->serialize());
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
|
||||
void OnBotCreate(BotInfo *bi)
|
||||
{
|
||||
this->Insert(bi->GetSerializeName(), bi->serialize());
|
||||
this->Insert(bi->serialize_name(), bi->serialize());
|
||||
}
|
||||
|
||||
void OnBotChange(BotInfo *bi)
|
||||
@@ -357,76 +357,76 @@ class DBMySQL : public Module
|
||||
|
||||
void OnBotDelete(BotInfo *bi)
|
||||
{
|
||||
this->Delete(bi->GetSerializeName(), bi->serialize());
|
||||
this->Delete(bi->serialize_name(), bi->serialize());
|
||||
}
|
||||
|
||||
EventReturn OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi)
|
||||
{
|
||||
this->Insert(ci->GetSerializeName(), ci->serialize());
|
||||
this->Insert(ci->serialize_name(), ci->serialize());
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
|
||||
EventReturn OnBotUnAssign(User *sender, ChannelInfo *ci)
|
||||
{
|
||||
this->Insert(ci->GetSerializeName(), ci->serialize());
|
||||
this->Insert(ci->serialize_name(), ci->serialize());
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
|
||||
void OnBadWordAdd(ChannelInfo *ci, BadWord *bw)
|
||||
{
|
||||
this->Insert(bw->GetSerializeName(), bw->serialize());
|
||||
this->Insert(bw->serialize_name(), bw->serialize());
|
||||
}
|
||||
|
||||
void OnBadWordDel(ChannelInfo *ci, BadWord *bw)
|
||||
{
|
||||
this->Delete(bw->GetSerializeName(), bw->serialize());
|
||||
this->Delete(bw->serialize_name(), bw->serialize());
|
||||
}
|
||||
|
||||
void OnMemoSend(const Anope::string &source, const Anope::string &target, MemoInfo *mi, Memo *m)
|
||||
{
|
||||
this->Insert(m->GetSerializeName(), m->serialize());
|
||||
this->Insert(m->serialize_name(), m->serialize());
|
||||
}
|
||||
|
||||
void OnMemoDel(const NickCore *nc, MemoInfo *mi, Memo *m)
|
||||
{
|
||||
this->Delete(m->GetSerializeName(), m->serialize());
|
||||
this->Delete(m->serialize_name(), m->serialize());
|
||||
}
|
||||
|
||||
void OnMemoDel(ChannelInfo *ci, MemoInfo *mi, Memo *m)
|
||||
{
|
||||
this->Delete(m->GetSerializeName(), m->serialize());
|
||||
this->Delete(m->serialize_name(), m->serialize());
|
||||
}
|
||||
|
||||
EventReturn OnExceptionAdd(Exception *ex)
|
||||
{
|
||||
this->Insert(ex->GetSerializeName(), ex->serialize());
|
||||
this->Insert(ex->serialize_name(), ex->serialize());
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
|
||||
void OnExceptionDel(User *, Exception *ex)
|
||||
{
|
||||
this->Delete(ex->GetSerializeName(), ex->serialize());
|
||||
this->Delete(ex->serialize_name(), ex->serialize());
|
||||
}
|
||||
|
||||
EventReturn OnAddXLine(XLine *x, XLineManager *xlm)
|
||||
{
|
||||
this->Insert(x->GetSerializeName(), x->serialize());
|
||||
this->Insert(x->serialize_name(), x->serialize());
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
|
||||
void OnDelXLine(User *, XLine *x, XLineManager *xlm)
|
||||
{
|
||||
this->Delete(x->GetSerializeName(), x->serialize());
|
||||
this->Delete(x->serialize_name(), x->serialize());
|
||||
}
|
||||
|
||||
void OnDeleteVhost(NickAlias *na)
|
||||
{
|
||||
this->Insert(na->GetSerializeName(), na->serialize());
|
||||
this->Insert(na->serialize_name(), na->serialize());
|
||||
}
|
||||
|
||||
void OnSetVhost(NickAlias *na)
|
||||
{
|
||||
this->Insert(na->GetSerializeName(), na->serialize());
|
||||
this->Insert(na->serialize_name(), na->serialize());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+6
-1
@@ -65,7 +65,7 @@ AccessProvider::~AccessProvider()
|
||||
{
|
||||
}
|
||||
|
||||
ChanAccess::ChanAccess(AccessProvider *p) : Serializable("ChanAccess"), provider(p)
|
||||
ChanAccess::ChanAccess(AccessProvider *p) : provider(p)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -73,6 +73,11 @@ ChanAccess::~ChanAccess()
|
||||
{
|
||||
}
|
||||
|
||||
Anope::string ChanAccess::serialize_name() const
|
||||
{
|
||||
return "ChanAccess";
|
||||
}
|
||||
|
||||
Serializable::serialized_data ChanAccess::serialize()
|
||||
{
|
||||
serialized_data data;
|
||||
|
||||
+6
-1
@@ -13,7 +13,7 @@
|
||||
Anope::insensitive_map<BotInfo *> BotListByNick;
|
||||
Anope::map<BotInfo *> BotListByUID;
|
||||
|
||||
BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const Anope::string &nhost, const Anope::string &nreal, const Anope::string &bmodes) : User(nnick, nuser, nhost, ts6_uid_retrieve()), Flags<BotFlag, BI_END>(BotFlagString), Serializable("BotInfo"), botmodes(bmodes)
|
||||
BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const Anope::string &nhost, const Anope::string &nreal, const Anope::string &bmodes) : User(nnick, nuser, nhost, ts6_uid_retrieve()), Flags<BotFlag, BI_END>(BotFlagString), botmodes(bmodes)
|
||||
{
|
||||
this->realname = nreal;
|
||||
this->server = Me;
|
||||
@@ -64,6 +64,11 @@ BotInfo::~BotInfo()
|
||||
BotListByUID.erase(this->uid);
|
||||
}
|
||||
|
||||
Anope::string BotInfo::serialize_name() const
|
||||
{
|
||||
return "BotInfo";
|
||||
}
|
||||
|
||||
Serializable::serialized_data BotInfo::serialize()
|
||||
{
|
||||
serialized_data data;
|
||||
|
||||
+6
-1
@@ -13,7 +13,12 @@
|
||||
#include "modules.h"
|
||||
#include "memoserv.h"
|
||||
|
||||
Memo::Memo() : Flags<MemoFlag>(MemoFlagStrings), Serializable("Memo") { }
|
||||
Memo::Memo() : Flags<MemoFlag>(MemoFlagStrings) { }
|
||||
|
||||
Anope::string Memo::serialize_name() const
|
||||
{
|
||||
return "Memo";
|
||||
}
|
||||
|
||||
Serializable::serialized_data Memo::serialize()
|
||||
{
|
||||
|
||||
+6
-1
@@ -5,7 +5,7 @@
|
||||
* @param nick The nick
|
||||
* @param nickcore The nickcofe for this nick
|
||||
*/
|
||||
NickAlias::NickAlias(const Anope::string &nickname, NickCore *nickcore) : Flags<NickNameFlag, NS_END>(NickNameFlagStrings), Serializable("NickAlias")
|
||||
NickAlias::NickAlias(const Anope::string &nickname, NickCore *nickcore) : Flags<NickNameFlag, NS_END>(NickNameFlagStrings)
|
||||
{
|
||||
if (nickname.empty())
|
||||
throw CoreException("Empty nick passed to NickAlias constructor");
|
||||
@@ -103,6 +103,11 @@ void NickAlias::OnCancel(User *)
|
||||
}
|
||||
}
|
||||
|
||||
Anope::string NickAlias::serialize_name() const
|
||||
{
|
||||
return "NickAlias";
|
||||
}
|
||||
|
||||
Serializable::serialized_data NickAlias::serialize()
|
||||
{
|
||||
serialized_data data;
|
||||
|
||||
+6
-1
@@ -4,7 +4,7 @@
|
||||
/** Default constructor
|
||||
* @param display The display nick
|
||||
*/
|
||||
NickCore::NickCore(const Anope::string &coredisplay) : Flags<NickCoreFlag, NI_END>(NickCoreFlagStrings), Serializable("NickCore")
|
||||
NickCore::NickCore(const Anope::string &coredisplay) : Flags<NickCoreFlag, NI_END>(NickCoreFlagStrings)
|
||||
{
|
||||
if (coredisplay.empty())
|
||||
throw CoreException("Empty display passed to NickCore constructor");
|
||||
@@ -45,6 +45,11 @@ NickCore::~NickCore()
|
||||
}
|
||||
}
|
||||
|
||||
Anope::string NickCore::serialize_name() const
|
||||
{
|
||||
return "NickCore";
|
||||
}
|
||||
|
||||
Serializable::serialized_data NickCore::serialize()
|
||||
{
|
||||
serialized_data data;
|
||||
|
||||
+10
-13
@@ -17,16 +17,12 @@
|
||||
std::list<XLineManager *> XLineManager::XLineManagers;
|
||||
std::map<Anope::string, XLine *, ci::less> XLineManager::XLinesByUID;
|
||||
|
||||
XLine::XLine() : Serializable("XLine")
|
||||
{
|
||||
}
|
||||
|
||||
XLine::XLine(const Anope::string &mask, const Anope::string &reason, const Anope::string &uid) : Serializable("XLine"), Mask(mask), Created(0), Expires(0), Reason(reason), UID(uid)
|
||||
XLine::XLine(const Anope::string &mask, const Anope::string &reason, const Anope::string &uid) : Mask(mask), Created(0), Expires(0), Reason(reason), UID(uid)
|
||||
{
|
||||
manager = NULL;
|
||||
}
|
||||
|
||||
XLine::XLine(const Anope::string &mask, const Anope::string &by, const time_t expires, const Anope::string &reason, const Anope::string &uid) : Serializable("XLine"), Mask(mask), By(by), Created(Anope::CurTime), Expires(expires), Reason(reason), UID(uid)
|
||||
XLine::XLine(const Anope::string &mask, const Anope::string &by, const time_t expires, const Anope::string &reason, const Anope::string &uid) : Mask(mask), By(by), Created(Anope::CurTime), Expires(expires), Reason(reason), UID(uid)
|
||||
{
|
||||
manager = NULL;
|
||||
}
|
||||
@@ -73,6 +69,11 @@ sockaddrs XLine::GetIP() const
|
||||
return addr;
|
||||
}
|
||||
|
||||
Anope::string XLine::serialize_name() const
|
||||
{
|
||||
return "XLine";
|
||||
}
|
||||
|
||||
Serializable::serialized_data XLine::serialize()
|
||||
{
|
||||
serialized_data data;
|
||||
@@ -95,14 +96,10 @@ void XLine::unserialize(serialized_data &data)
|
||||
if (!xlm)
|
||||
return;
|
||||
|
||||
XLine *xl = new XLine();
|
||||
|
||||
data["mask"] >> xl->Mask;
|
||||
data["by"] >> xl->By;
|
||||
time_t expires;
|
||||
data["expires"] >> expires;
|
||||
XLine *xl = new XLine(data["mask"].astr(), data["by"].astr(), expires, data["expires"].astr(), data["uid"].astr());
|
||||
data["created"] >> xl->Created;
|
||||
data["expires"] >> xl->Expires;
|
||||
data["reason"] >> xl->Reason;
|
||||
data["uid"] >> xl->UID;
|
||||
xl->manager = xlm;
|
||||
|
||||
xlm->AddXLine(xl);
|
||||
|
||||
+33
-19
@@ -12,8 +12,9 @@
|
||||
#include "services.h"
|
||||
#include "modules.h"
|
||||
|
||||
BadWord::BadWord() : Serializable("BadWord")
|
||||
Anope::string BadWord::serialize_name() const
|
||||
{
|
||||
return "BadWord";
|
||||
}
|
||||
|
||||
Serializable::serialized_data BadWord::serialize()
|
||||
@@ -39,10 +40,15 @@ void BadWord::unserialize(serialized_data &data)
|
||||
ci->AddBadWord(data["word"].astr(), static_cast<BadWordType>(n));
|
||||
}
|
||||
|
||||
AutoKick::AutoKick() : Flags<AutoKickFlag>(AutoKickFlagString), Serializable("AutoKick")
|
||||
AutoKick::AutoKick() : Flags<AutoKickFlag>(AutoKickFlagString)
|
||||
{
|
||||
}
|
||||
|
||||
Anope::string AutoKick::serialize_name() const
|
||||
{
|
||||
return "AutoKick";
|
||||
}
|
||||
|
||||
Serializable::serialized_data AutoKick::serialize()
|
||||
{
|
||||
serialized_data data;
|
||||
@@ -78,12 +84,13 @@ void AutoKick::unserialize(serialized_data &data)
|
||||
ci->AddAkick(data["creator"].astr(), data["mask"].astr(), data["reason"].astr(), addtime, lastused);
|
||||
}
|
||||
|
||||
ModeLock::ModeLock() : Serializable("ModeLock")
|
||||
ModeLock::ModeLock(ChannelInfo *ch, bool s, ChannelModeName n, const Anope::string &p, const Anope::string &se, time_t c) : ci(ch), set(s), name(n), param(p), setter(se), created(c)
|
||||
{
|
||||
}
|
||||
|
||||
ModeLock::ModeLock(ChannelInfo *ch, bool s, ChannelModeName n, const Anope::string &p, const Anope::string &se, time_t c) : Serializable("ModeLock"), ci(ch), set(s), name(n), param(p), setter(se), created(c)
|
||||
Anope::string ModeLock::serialize_name() const
|
||||
{
|
||||
return "ModeLock";
|
||||
}
|
||||
|
||||
Serializable::serialized_data ModeLock::serialize()
|
||||
@@ -109,28 +116,32 @@ void ModeLock::unserialize(serialized_data &data)
|
||||
if (ci == NULL)
|
||||
return;
|
||||
|
||||
ModeLock ml;
|
||||
ChannelModeName name = CMODE_END;
|
||||
|
||||
ml.ci = ci;
|
||||
|
||||
data["set"] >> ml.set;
|
||||
Anope::string n;
|
||||
data["name"] >> n;
|
||||
for (unsigned i = 0; !ChannelModeNameStrings[i].empty(); ++i)
|
||||
if (n == ChannelModeNameStrings[i])
|
||||
if (ChannelModeNameStrings[i] == data["name"].astr())
|
||||
{
|
||||
ml.name = static_cast<ChannelModeName>(i);
|
||||
name = static_cast<ChannelModeName>(i);
|
||||
break;
|
||||
}
|
||||
if (name == CMODE_END)
|
||||
return;
|
||||
|
||||
bool set;
|
||||
data["set"] >> set;
|
||||
|
||||
time_t created;
|
||||
data["created"] >> created;
|
||||
|
||||
ModeLock ml(ci, set, name, "", data["setter"].astr(), created);
|
||||
data["param"] >> ml.param;
|
||||
data["setter"] >> ml.setter;
|
||||
data["created"] >> ml.created;
|
||||
|
||||
ci->mode_locks.insert(std::make_pair(ml.name, ml));
|
||||
}
|
||||
|
||||
LogSetting::LogSetting() : Serializable("LogSetting")
|
||||
Anope::string LogSetting::serialize_name() const
|
||||
{
|
||||
return "LogSetting";
|
||||
}
|
||||
|
||||
Serializable::serialized_data LogSetting::serialize()
|
||||
@@ -172,7 +183,7 @@ void LogSetting::unserialize(serialized_data &data)
|
||||
/** Default constructor
|
||||
* @param chname The channel name
|
||||
*/
|
||||
ChannelInfo::ChannelInfo(const Anope::string &chname) : Flags<ChannelInfoFlag, CI_END>(ChannelInfoFlagStrings), Serializable("ChannelInfo"), botflags(BotServFlagStrings)
|
||||
ChannelInfo::ChannelInfo(const Anope::string &chname) : Flags<ChannelInfoFlag, CI_END>(ChannelInfoFlagStrings), botflags(BotServFlagStrings)
|
||||
{
|
||||
if (chname.empty())
|
||||
throw CoreException("Empty channel passed to ChannelInfo constructor");
|
||||
@@ -189,8 +200,6 @@ ChannelInfo::ChannelInfo(const Anope::string &chname) : Flags<ChannelInfoFlag, C
|
||||
|
||||
this->name = chname;
|
||||
|
||||
this->mode_locks = def_mode_locks;
|
||||
|
||||
size_t t;
|
||||
/* Set default channel flags */
|
||||
for (t = CI_BEGIN + 1; t != CI_END; ++t)
|
||||
@@ -217,7 +226,7 @@ ChannelInfo::ChannelInfo(const Anope::string &chname) : Flags<ChannelInfoFlag, C
|
||||
/** Copy constructor
|
||||
* @param ci The ChannelInfo to copy settings to
|
||||
*/
|
||||
ChannelInfo::ChannelInfo(ChannelInfo &ci) : Flags<ChannelInfoFlag, CI_END>(ChannelInfoFlagStrings), Serializable("ChannelInfo"), botflags(BotServFlagStrings)
|
||||
ChannelInfo::ChannelInfo(ChannelInfo &ci) : Flags<ChannelInfoFlag, CI_END>(ChannelInfoFlagStrings), botflags(BotServFlagStrings)
|
||||
{
|
||||
*this = ci;
|
||||
|
||||
@@ -299,6 +308,11 @@ ChannelInfo::~ChannelInfo()
|
||||
--this->founder->channelcount;
|
||||
}
|
||||
|
||||
Anope::string ChannelInfo::serialize_name() const
|
||||
{
|
||||
return "ChannelInfo";
|
||||
}
|
||||
|
||||
Serializable::serialized_data ChannelInfo::serialize()
|
||||
{
|
||||
serialized_data data;
|
||||
|
||||
Reference in New Issue
Block a user