summaryrefslogtreecommitdiff
path: root/modules/protocol
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-11-24 14:27:23 -0500
committerAdam <Adam@anope.org>2014-11-24 14:27:23 -0500
commit42238034490fb5479d787bd1695750387d508200 (patch)
treec93c62e0e1c936e656ae5b9ee1b62380ce2a194c /modules/protocol
parentd492923610d9c9146b2a2b63de38deab2cfd4ca7 (diff)
Rewrite serializable to have field level granularity
Represent serializable objects in a digraph, and as a result made most object relationships implicitly defined, and use the graph to trace references between objects to determine relationships. Edges may also be marked as having a dependency of the object they point to, which allows for automatic cleanup and deletion of most objects when no longer needed. Additionally, this allows not having to require in-memory copies of everything when using external databases. db_sql has been rewritten for this and now always requires a database to function. db_sql with MySQL now requires InnoDB to make use of transactions and foreign key constraints.
Diffstat (limited to 'modules/protocol')
-rw-r--r--modules/protocol/bahamut.cpp51
-rw-r--r--modules/protocol/charybdis.cpp51
-rw-r--r--modules/protocol/hybrid.cpp60
-rw-r--r--modules/protocol/inspircd20.cpp85
-rw-r--r--modules/protocol/ngircd.cpp18
-rw-r--r--modules/protocol/plexus.cpp20
-rw-r--r--modules/protocol/ratbox.cpp22
-rw-r--r--modules/protocol/unreal.cpp104
8 files changed, 206 insertions, 205 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 5649dbbbe..6839b91e1 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -60,12 +60,12 @@ class BahamutIRCdProto : public IRCDProto
UplinkSocket::Message(source) << "SVSMODE " << u->nick << " " << u->timestamp << " " << buf;
}
- void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override
+ void SendGlobalNotice(ServiceBot *bi, const Server *dest, const Anope::string &msg) override
{
UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg;
}
- void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override
+ void SendGlobalPrivmsg(ServiceBot *bi, const Server *dest, const Anope::string &msg) override
{
UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg;
}
@@ -83,19 +83,19 @@ class BahamutIRCdProto : public IRCDProto
}
/* SQLINE */
- void SendSQLine(User *, const XLine *x) override
+ void SendSQLine(User *, XLine *x) override
{
- UplinkSocket::Message() << "SQLINE " << x->mask << " :" << x->GetReason();
+ UplinkSocket::Message() << "SQLINE " << x->GetMask() << " :" << x->GetReason();
}
/* UNSLINE */
- void SendSGLineDel(const XLine *x) override
+ void SendSGLineDel(XLine *x) override
{
- UplinkSocket::Message() << "UNSGLINE 0 :" << x->mask;
+ UplinkSocket::Message() << "UNSGLINE 0 :" << x->GetMask();
}
/* UNSZLINE */
- void SendSZLineDel(const XLine *x) override
+ void SendSZLineDel(XLine *x) override
{
/* this will likely fail so its only here for legacy */
UplinkSocket::Message() << "UNSZLINE 0 " << x->GetHost();
@@ -104,16 +104,16 @@ class BahamutIRCdProto : public IRCDProto
}
/* SZLINE */
- void SendSZLine(User *, const XLine *x) override
+ void SendSZLine(User *, XLine *x) override
{
// Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
+ time_t timeleft = x->GetExpires() - Anope::CurTime;
+ if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
/* this will likely fail so its only here for legacy */
UplinkSocket::Message() << "SZLINE " << x->GetHost() << " :" << x->GetReason();
/* this is how we are supposed to deal with it */
- UplinkSocket::Message() << "AKILL " << x->GetHost() << " * " << timeleft << " " << x->by << " " << Anope::CurTime << " :" << x->GetReason();
+ UplinkSocket::Message() << "AKILL " << x->GetHost() << " * " << timeleft << " " << x->GetBy() << " " << Anope::CurTime << " :" << x->GetReason();
}
/* SVSNOOP */
@@ -123,13 +123,13 @@ class BahamutIRCdProto : public IRCDProto
}
/* SGLINE */
- void SendSGLine(User *, const XLine *x) override
+ void SendSGLine(User *, XLine *x) override
{
- UplinkSocket::Message() << "SGLINE " << x->mask.length() << " :" << x->mask << ":" << x->GetReason();
+ UplinkSocket::Message() << "SGLINE " << x->GetMask().length() << " :" << x->GetMask() << ":" << x->GetReason();
}
/* RAKILL */
- void SendAkillDel(const XLine *x) override
+ void SendAkillDel(XLine *x) override
{
if (x->IsRegex() || x->HasNickOrReal())
return;
@@ -155,9 +155,9 @@ class BahamutIRCdProto : public IRCDProto
}
/* UNSQLINE */
- void SendSQLineDel(const XLine *x) override
+ void SendSQLineDel(XLine *x) override
{
- UplinkSocket::Message() << "UNSQLINE " << x->mask;
+ UplinkSocket::Message() << "UNSQLINE " << x->GetMask();
}
/* JOIN - SJOIN */
@@ -175,7 +175,7 @@ class BahamutIRCdProto : public IRCDProto
if (uc != NULL)
uc->status.Clear();
- BotInfo *setter = BotInfo::Find(user->GetUID());
+ ServiceBot *setter = ServiceBot::Find(user->GetUID());
for (size_t i = 0; i < cs.Modes().length(); ++i)
c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
@@ -197,16 +197,21 @@ class BahamutIRCdProto : public IRCDProto
return;
}
- const XLine *old = x;
+ XLine *old = x;
if (old->manager->HasEntry("*@" + u->host))
return;
/* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */
- x = new XLine("*@" + u->host, old->by, old->expires, old->reason, old->id);
+ x = new XLine(xline);
+ x->SetMask("*@" + u->host);
+ x->SetBy(old->GetBy());
+ x->SetExpires(old->GetExpires());
+ x->SetReason(old->GetReason());
+ x->SetID(old->GetID());
old->manager->AddXLine(x);
- Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->mask << " because " << u->GetMask() << "#" << u->realname << " matches " << old->mask;
+ Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask();
}
/* ZLine if we can instead */
@@ -221,10 +226,10 @@ class BahamutIRCdProto : public IRCDProto
}
// Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
+ time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800)
timeleft = 172800;
- UplinkSocket::Message() << "AKILL " << x->GetHost() << " " << x->GetUser() << " " << timeleft << " " << x->by << " " << Anope::CurTime << " :" << x->GetReason();
+ UplinkSocket::Message() << "AKILL " << x->GetHost() << " " << x->GetUser() << " " << timeleft << " " << x->GetBy() << " " << Anope::CurTime << " :" << x->GetReason();
}
/*
@@ -379,7 +384,7 @@ struct IRCDMessageNick : IRCDMessage
if (signon && signon == stamp && NickServ::service)
na = NickServ::service->FindNick(params[0]);
- User::OnIntroduce(params[0], params[4], params[5], "", params[8], s, params[9], signon, params[3], "", na ? *na->nc : NULL);
+ User::OnIntroduce(params[0], params[4], params[5], "", params[8], s, params[9], signon, params[3], "", na ? na->GetAccount() : NULL);
}
else
source.GetUser()->ChangeNick(params[0]);
diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp
index e69de2b12..5f24df8e6 100644
--- a/modules/protocol/charybdis.cpp
+++ b/modules/protocol/charybdis.cpp
@@ -47,14 +47,14 @@ class CharybdisProto : public IRCDProto
}
void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) override { ratbox->SendSVSKillInternal(source, targ, reason); }
- void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { ratbox->SendGlobalNotice(bi, dest, msg); }
- void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { ratbox->SendGlobalPrivmsg(bi, dest, msg); }
+ void SendGlobalNotice(ServiceBot *bi, const Server *dest, const Anope::string &msg) override { ratbox->SendGlobalNotice(bi, dest, msg); }
+ void SendGlobalPrivmsg(ServiceBot *bi, const Server *dest, const Anope::string &msg) override { ratbox->SendGlobalPrivmsg(bi, dest, msg); }
void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override { ratbox->SendGlobopsInternal(source, buf); }
- void SendSGLine(User *u, const XLine *x) override { ratbox->SendSGLine(u, x); }
- void SendSGLineDel(const XLine *x) override { ratbox->SendSGLineDel(x); }
+ void SendSGLine(User *u, XLine *x) override { ratbox->SendSGLine(u, x); }
+ void SendSGLineDel(XLine *x) override { ratbox->SendSGLineDel(x); }
void SendAkill(User *u, XLine *x) override { ratbox->SendAkill(u, x); }
- void SendAkillDel(const XLine *x) override { ratbox->SendAkillDel(x); }
- void SendSQLineDel(const XLine *x) override { ratbox->SendSQLineDel(x); }
+ void SendAkillDel(XLine *x) override { ratbox->SendAkillDel(x); }
+ void SendSQLineDel(XLine *x) override { ratbox->SendSQLineDel(x); }
void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { ratbox->SendJoin(user, c, status); }
void SendServer(const Server *server) override { ratbox->SendServer(server); }
void SendChannel(Channel *c) override { ratbox->SendChannel(c); }
@@ -63,9 +63,9 @@ class CharybdisProto : public IRCDProto
void SendLogin(User *u, NickServ::Nick *na) override { ratbox->SendLogin(u, na); }
void SendLogout(User *u) override { ratbox->SendLogout(u); }
- void SendSQLine(User *, const XLine *x) override
+ void SendSQLine(User *, XLine *x) override
{
- UplinkSocket::Message(Me) << "RESV * " << x->mask << " :" << x->GetReason();
+ UplinkSocket::Message(Me) << "RESV * " << x->GetMask() << " :" << x->GetReason();
}
void SendConnect() override
@@ -225,7 +225,7 @@ struct IRCDMessageEUID : IRCDMessage
if (params[9] != "*")
na = NickServ::FindNick(params[9]);
- User::OnIntroduce(params[0], params[4], params[8], params[5], params[6], source.GetServer(), params[10], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime, params[3], params[7], na ? *na->nc : NULL);
+ User::OnIntroduce(params[0], params[4], params[8], params[5], params[6], source.GetServer(), params[10], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime, params[3], params[7], na ? na->GetAccount() : NULL);
}
};
@@ -389,25 +389,26 @@ class ProtoCharybdis : public Module
void OnChannelSync(Channel *c) override
{
- if (!c->ci)
+ if (!c->ci || !mlocks)
return;
- ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks");
- if (use_server_side_mlock && modelocks && Servers::Capab.count("MLOCK") > 0)
+ if (use_server_side_mlock && Servers::Capab.count("MLOCK") > 0)
{
- Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "");
- UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes;
+ Anope::string modes = mlocks->GetMLockAsString(c->ci, false).replace_all_cs("+", "").replace_all_cs("-", "");
+ UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->GetName() << " " << modes;
}
}
EventReturn OnMLock(ChanServ::Channel *ci, ModeLock *lock) override
{
- ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks");
- ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name);
- if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
+ if (!mlocks)
+ return EVENT_CONTINUE;
+
+ ChannelMode *cm = ModeManager::FindChannelModeByName(lock->GetName());
+ if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
{
- Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar;
- UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes;
+ Anope::string modes = mlocks->GetMLockAsString(ci, false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar;
+ UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->GetName() << " " << modes;
}
return EVENT_CONTINUE;
@@ -415,12 +416,14 @@ class ProtoCharybdis : public Module
EventReturn OnUnMLock(ChanServ::Channel *ci, ModeLock *lock) override
{
- ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks");
- ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name);
- if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
+ if (!mlocks)
+ return EVENT_CONTINUE;
+
+ ChannelMode *cm = ModeManager::FindChannelModeByName(lock->GetName());
+ if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
{
- Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, "");
- UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes;
+ Anope::string modes = mlocks->GetMLockAsString(ci, false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, "");
+ UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->GetName() << " " << modes;
}
return EVENT_CONTINUE;
diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp
index eb774d541..cabf1b751 100644
--- a/modules/protocol/hybrid.cpp
+++ b/modules/protocol/hybrid.cpp
@@ -16,15 +16,15 @@ static Anope::string UplinkSID;
class HybridProto : public IRCDProto
{
- BotInfo *FindIntroduced()
+ ServiceBot *FindIntroduced()
{
- BotInfo *bi = Config->GetClient("OperServ");
+ ServiceBot *bi = Config->GetClient("OperServ");
if (bi && bi->introduced)
return bi;
- for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
- if (it->second->introduced)
- return it->second;
+ for (ServiceBot *bi2 : Serialize::GetObjects<ServiceBot *>(botinfo))
+ if (bi2->introduced)
+ return bi2;
return NULL;
}
@@ -51,12 +51,12 @@ class HybridProto : public IRCDProto
MaxModes = 4;
}
- void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override
+ void SendGlobalNotice(ServiceBot *bi, const Server *dest, const Anope::string &msg) override
{
UplinkSocket::Message(bi) << "NOTICE $$" << dest->GetName() << " :" << msg;
}
- void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override
+ void SendGlobalPrivmsg(ServiceBot *bi, const Server *dest, const Anope::string &msg) override
{
UplinkSocket::Message(bi) << "PRIVMSG $$" << dest->GetName() << " :" << msg;
}
@@ -66,38 +66,38 @@ class HybridProto : public IRCDProto
UplinkSocket::Message(source) << "GLOBOPS :" << buf;
}
- void SendSQLine(User *, const XLine *x) override
+ void SendSQLine(User *, XLine *x) override
{
- UplinkSocket::Message(FindIntroduced()) << "ENCAP * RESV " << (x->expires ? x->expires - Anope::CurTime : 0) << " " << x->mask << " 0 :" << x->reason;
+ UplinkSocket::Message(FindIntroduced()) << "ENCAP * RESV " << (x->GetExpires() ? x->GetExpires() - Anope::CurTime : 0) << " " << x->GetMask() << " 0 :" << x->GetReason();
}
- void SendSGLineDel(const XLine *x) override
+ void SendSGLineDel(XLine *x) override
{
- UplinkSocket::Message(Config->GetClient("OperServ")) << "UNXLINE * " << x->mask;
+ UplinkSocket::Message(Config->GetClient("OperServ")) << "UNXLINE * " << x->GetMask();
}
- void SendSGLine(User *, const XLine *x) override
+ void SendSGLine(User *, XLine *x) override
{
- UplinkSocket::Message(Config->GetClient("OperServ")) << "XLINE * " << x->mask << " 0 :" << x->GetReason();
+ UplinkSocket::Message(Config->GetClient("OperServ")) << "XLINE * " << x->GetMask() << " 0 :" << x->GetReason();
}
- void SendSZLineDel(const XLine *x) override
+ void SendSZLineDel(XLine *x) override
{
UplinkSocket::Message(Config->GetClient("OperServ")) << "UNDLINE * " << x->GetHost();
}
- void SendSZLine(User *, const XLine *x) override
+ void SendSZLine(User *, XLine *x) override
{
/* Calculate the time left before this would expire, capping it at 2 days */
- time_t timeleft = x->expires - Anope::CurTime;
+ time_t timeleft = x->GetExpires() - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
+ if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
UplinkSocket::Message(Config->GetClient("OperServ")) << "DLINE * " << timeleft << " " << x->GetHost() << " :" << x->GetReason();
}
- void SendAkillDel(const XLine *x) override
+ void SendAkillDel(XLine *x) override
{
if (x->IsRegex() || x->HasNickOrReal())
return;
@@ -105,9 +105,9 @@ class HybridProto : public IRCDProto
UplinkSocket::Message(Config->GetClient("OperServ")) << "UNKLINE * " << x->GetUser() << " " << x->GetHost();
}
- void SendSQLineDel(const XLine *x) override
+ void SendSQLineDel(XLine *x) override
{
- UplinkSocket::Message(Config->GetClient("OperServ")) << "UNRESV * " << x->mask;
+ UplinkSocket::Message(Config->GetClient("OperServ")) << "UNRESV * " << x->GetMask();
}
void SendJoin(User *user, Channel *c, const ChannelStatus *status) override
@@ -148,25 +148,25 @@ class HybridProto : public IRCDProto
return;
}
- const XLine *old = x;
+ XLine *old = x;
if (old->manager->HasEntry("*@" + u->host))
return;
/* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */
- XLine *xline = new XLine("*@" + u->host, old->by, old->expires, old->reason, old->id);
+ XLine *xl = new XLine("*@" + u->host, old->GetBy(), old->GetExpires(), old->GetReason(), old->id);
- old->manager->AddXLine(xline);
- x = xline;
+ old->manager->AddXLine(xl);
+ x = xl;
- Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->mask << " because " << u->GetMask() << "#"
- << u->realname << " matches " << old->mask;
+ Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#"
+ << u->realname << " matches " << old->GetMask();
}
/* Calculate the time left before this would expire, capping it at 2 days */
- time_t timeleft = x->expires - Anope::CurTime;
+ time_t timeleft = x->GetExpires() - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
+ if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
UplinkSocket::Message(Config->GetClient("OperServ")) << "KLINE * " << timeleft << " " << x->GetUser() << " " << x->GetHost() << " :" << x->GetReason();
@@ -227,7 +227,7 @@ class HybridProto : public IRCDProto
void SendLogin(User *u, NickServ::Nick *na) override
{
- IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %s", na->nc->display.c_str());
+ IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %s", na->GetAccount()->GetDisplay().c_str());
}
void SendLogout(User *u) override
@@ -557,7 +557,7 @@ struct IRCDMessageUID : IRCDMessage
User::OnIntroduce(params[0], params[4], params[5], "",
ip, source.GetServer(),
params[9], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : 0,
- params[3], params[7], na ? *na->nc : NULL);
+ params[3], params[7], na ? na->GetAccount() : NULL);
}
};
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index b25d4d5cb..eab1f75a7 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -84,23 +84,23 @@ class InspIRCd20Proto : public IRCDProto
SendServer(Me);
}
- void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override
+ void SendGlobalNotice(ServiceBot *bi, const Server *dest, const Anope::string &msg) override
{
UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg;
}
- void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override
+ void SendGlobalPrivmsg(ServiceBot *bi, const Server *dest, const Anope::string &msg) override
{
UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg;
}
- void SendAkillDel(const XLine *x) override
+ void SendAkillDel(XLine *x) override
{
/* InspIRCd may support regex bans */
if (x->IsRegex() && Servers::Capab.count("RLINE"))
{
- Anope::string mask = x->mask;
- size_t h = x->mask.find('#');
+ Anope::string mask = x->GetMask();
+ size_t h = mask.find('#');
if (h != Anope::string::npos)
mask = mask.replace(h, 1, ' ');
SendDelLine("R", mask);
@@ -154,18 +154,18 @@ class InspIRCd20Proto : public IRCDProto
void SendAkill(User *u, XLine *x) override
{
// Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
+ time_t timeleft = x->GetExpires() - Anope::CurTime;
+ if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
/* InspIRCd may support regex bans, if they do we can send this and forget about it */
if (x->IsRegex() && Servers::Capab.count("RLINE"))
{
- Anope::string mask = x->mask;
- size_t h = x->mask.find('#');
+ Anope::string mask = x->GetMask();
+ size_t h = mask.find('#');
if (h != Anope::string::npos)
mask = mask.replace(h, 1, ' ');
- SendAddLine("R", mask, timeleft, x->by, x->GetReason());
+ SendAddLine("R", mask, timeleft, x->GetBy(), x->GetReason());
return;
}
else if (x->IsRegex() || x->HasNickOrReal())
@@ -179,16 +179,16 @@ class InspIRCd20Proto : public IRCDProto
return;
}
- const XLine *old = x;
+ XLine *old = x;
if (old->manager->HasEntry("*@" + u->host))
return;
/* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */
- x = new XLine("*@" + u->host, old->by, old->expires, old->reason, old->id);
+ x = new XLine("*@" + u->host, old->GetBy(), old->GetExpires(), old->GetReason(), old->GetID());
old->manager->AddXLine(x);
- Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->mask << " because " << u->GetMask() << "#" << u->realname << " matches " << old->mask;
+ Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask();
}
/* ZLine if we can instead */
@@ -202,7 +202,7 @@ class InspIRCd20Proto : public IRCDProto
}
}
- SendAddLine("G", x->GetUser() + "@" + x->GetHost(), timeleft, x->by, x->GetReason());
+ SendAddLine("G", x->GetUser() + "@" + x->GetHost(), timeleft, x->GetBy(), x->GetReason());
}
void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) override
@@ -260,7 +260,7 @@ class InspIRCd20Proto : public IRCDProto
if (uc != NULL)
uc->status.Clear();
- BotInfo *setter = BotInfo::Find(user->nick);
+ ServiceBot *setter = ServiceBot::Find(user->nick);
for (size_t i = 0; i < cs.Modes().length(); ++i)
c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
@@ -270,19 +270,19 @@ class InspIRCd20Proto : public IRCDProto
}
/* UNSQLINE */
- void SendSQLineDel(const XLine *x) override
+ void SendSQLineDel(XLine *x) override
{
- SendDelLine("Q", x->mask);
+ SendDelLine("Q", x->GetMask());
}
/* SQLINE */
- void SendSQLine(User *, const XLine *x) override
+ void SendSQLine(User *, XLine *x) override
{
// Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
+ time_t timeleft = x->GetExpires() - Anope::CurTime;
+ if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
- SendAddLine("Q", x->mask, timeleft, x->by, x->GetReason());
+ SendAddLine("Q", x->GetMask(), timeleft, x->GetBy(), x->GetReason());
}
void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override
@@ -306,19 +306,19 @@ class InspIRCd20Proto : public IRCDProto
}
/* UNSZLINE */
- void SendSZLineDel(const XLine *x) override
+ void SendSZLineDel(XLine *x) override
{
SendDelLine("Z", x->GetHost());
}
/* SZLINE */
- void SendSZLine(User *, const XLine *x) override
+ void SendSZLine(User *, XLine *x) override
{
// Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
+ time_t timeleft = x->GetExpires() - Anope::CurTime;
+ if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
- SendAddLine("Z", x->GetHost(), timeleft, x->by, x->GetReason());
+ SendAddLine("Z", x->GetHost(), timeleft, x->GetBy(), x->GetReason());
}
void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) override
@@ -364,10 +364,10 @@ class InspIRCd20Proto : public IRCDProto
void SendLogin(User *u, NickServ::Nick *na) override
{
/* InspIRCd uses an account to bypass chmode +R, not umode +r, so we can't send this here */
- if (na->nc->HasExt("UNCONFIRMED"))
+ if (na->GetAccount()->HasFieldS("UNCONFIRMED"))
return;
- UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << na->nc->display;
+ UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << na->GetAccount()->GetDisplay();
}
void SendLogout(User *u) override
@@ -526,7 +526,7 @@ namespace InspIRCdExtban
const Anope::string &mask = e->GetMask();
Anope::string real_mask = mask.substr(2);
- return u->IsIdentified() && real_mask.equals_ci(u->Account()->display);
+ return u->IsIdentified() && real_mask.equals_ci(u->Account()->GetDisplay());
}
};
@@ -1265,7 +1265,7 @@ struct IRCDMessageIdle : IRCDMessage
void Run(MessageSource &source, const std::vector<Anope::string> &params) override
{
- BotInfo *bi = BotInfo::Find(params[0]);
+ ServiceBot *bi = ServiceBot::Find(params[0]);
if (bi)
UplinkSocket::Message(bi) << "IDLE " << source.GetSource() << " " << Anope::StartTime << " " << (Anope::CurTime - bi->lastmsg);
else
@@ -1309,7 +1309,7 @@ struct IRCDMessageMetadata : IRCDMessage
User *u = User::Find(params[0]);
if (!u)
return;
- u->Extend<bool>("ssl");
+ u->Extend<bool>("ssl", true);
Anope::string data = params[2].c_str();
size_t pos1 = data.find(' ') + 1;
size_t pos2 = data.find(' ', pos1);
@@ -1546,7 +1546,7 @@ struct IRCDMessageUID : IRCDMessage
++it;
}
- User *u = User::OnIntroduce(params[2], params[5], params[3], params[4], params[6], source.GetServer(), params[params.size() - 1], ts, modes, params[0], na ? *na->nc : NULL);
+ User *u = User::OnIntroduce(params[2], params[5], params[3], params[4], params[6], source.GetServer(), params[params.size() - 1], ts, modes, params[0], na ? na->GetAccount() : NULL);
if (u)
u->signon = convertTo<time_t>(params[7]);
}
@@ -1673,16 +1673,15 @@ class ProtoInspIRCd20 : public Module
void OnChanRegistered(ChanServ::Channel *ci) override
{
- ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks");
- if (use_server_side_mlock && ci->c && modelocks && !modelocks->GetMLockAsString(false).empty())
+ if (use_server_side_mlock && ci->c && mlocks && !mlocks->GetMLockAsString(ci, false).empty())
{
- Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "");
+ Anope::string modes = mlocks->GetMLockAsString(ci, false).replace_all_cs("+", "").replace_all_cs("-", "");
SendChannelMetadata(ci->c, "mlock", modes);
}
if (use_server_side_topiclock && Servers::Capab.count("TOPICLOCK") && ci->c)
{
- if (ci->HasExt("TOPICLOCK"))
+ if (ci->HasFieldS("TOPICLOCK"))
SendChannelMetadata(ci->c, "topiclock", "1");
}
}
@@ -1698,11 +1697,10 @@ class ProtoInspIRCd20 : public Module
EventReturn OnMLock(ChanServ::Channel *ci, ModeLock *lock) override
{
- ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks");
- ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name);
- if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM))
+ ChannelMode *cm = ModeManager::FindChannelModeByName(lock->GetName());
+ if (use_server_side_mlock && cm && ci->c && mlocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM))
{
- Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar;
+ Anope::string modes = mlocks->GetMLockAsString(ci, false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar;
SendChannelMetadata(ci->c, "mlock", modes);
}
@@ -1711,11 +1709,10 @@ class ProtoInspIRCd20 : public Module
EventReturn OnUnMLock(ChanServ::Channel *ci, ModeLock *lock) override
{
- ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks");
- ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name);
- if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM))
+ ChannelMode *cm = ModeManager::FindChannelModeByName(lock->GetName());
+ if (use_server_side_mlock && cm && ci->c && mlocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM))
{
- Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, "");
+ Anope::string modes = mlocks->GetMLockAsString(ci, false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, "");
SendChannelMetadata(ci->c, "mlock", modes);
}
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index dc875cdbb..bd027731b 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -35,15 +35,15 @@ class ngIRCdProto : public IRCDProto
void SendAkill(User *u, XLine *x) override
{
// Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
+ time_t timeleft = x->GetExpires() - Anope::CurTime;
+ if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
- UplinkSocket::Message(Me) << "GLINE " << x->mask << " " << timeleft << " :" << x->GetReason() << " (" << x->by << ")";
+ UplinkSocket::Message(Me) << "GLINE " << x->GetMask() << " " << timeleft << " :" << x->GetReason() << " (" << x->GetBy() << ")";
}
- void SendAkillDel(const XLine *x) override
+ void SendAkillDel(XLine *x) override
{
- UplinkSocket::Message(Me) << "GLINE " << x->mask;
+ UplinkSocket::Message(Me) << "GLINE " << x->GetMask();
}
void SendChannel(Channel *c) override
@@ -72,12 +72,12 @@ class ngIRCdProto : public IRCDProto
UplinkSocket::Message(Me) << "SVSNICK " << u->nick << " " << newnick;
}
- void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override
+ void SendGlobalNotice(ServiceBot *bi, const Server *dest, const Anope::string &msg) override
{
UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg;
}
- void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override
+ void SendGlobalPrivmsg(ServiceBot *bi, const Server *dest, const Anope::string &msg) override
{
UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg;
}
@@ -101,7 +101,7 @@ class ngIRCdProto : public IRCDProto
if (uc != NULL)
uc->status.Clear();
- BotInfo *setter = BotInfo::Find(user->GetUID());
+ ServiceBot *setter = ServiceBot::Find(user->GetUID());
for (size_t i = 0; i < cs.Modes().length(); ++i)
c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
@@ -120,7 +120,7 @@ class ngIRCdProto : public IRCDProto
void SendLogin(User *u, NickServ::Nick *na) override
{
- UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << na->nc->display;
+ UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << na->GetAccount()->GetDisplay();
}
void SendLogout(User *u) override
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp
index a804202b3..2ff32c935 100644
--- a/modules/protocol/plexus.cpp
+++ b/modules/protocol/plexus.cpp
@@ -35,13 +35,13 @@ class PlexusProto : public IRCDProto
}
void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) override { hybrid->SendSVSKillInternal(source, targ, reason); }
- void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { hybrid->SendGlobalNotice(bi, dest, msg); }
- void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { hybrid->SendGlobalPrivmsg(bi, dest, msg); }
- void SendSQLine(User *u, const XLine *x) override { hybrid->SendSQLine(u, x); }
- void SendSQLineDel(const XLine *x) override { hybrid->SendSQLineDel(x); }
- void SendSGLineDel(const XLine *x) override { hybrid->SendSGLineDel(x); }
- void SendSGLine(User *u, const XLine *x) override { hybrid->SendSGLine(u, x); }
- void SendAkillDel(const XLine *x) override { hybrid->SendAkillDel(x); }
+ void SendGlobalNotice(ServiceBot *bi, const Server *dest, const Anope::string &msg) override { hybrid->SendGlobalNotice(bi, dest, msg); }
+ void SendGlobalPrivmsg(ServiceBot *bi, const Server *dest, const Anope::string &msg) override { hybrid->SendGlobalPrivmsg(bi, dest, msg); }
+ void SendSQLine(User *u, XLine *x) override { hybrid->SendSQLine(u, x); }
+ void SendSQLineDel(XLine *x) override { hybrid->SendSQLineDel(x); }
+ void SendSGLineDel(XLine *x) override { hybrid->SendSGLineDel(x); }
+ void SendSGLine(User *u, XLine *x) override { hybrid->SendSGLine(u, x); }
+ void SendAkillDel(XLine *x) override { hybrid->SendAkillDel(x); }
void SendAkill(User *u, XLine *x) override { hybrid->SendAkill(u, x); }
void SendServer(const Server *server) override { hybrid->SendServer(server); }
void SendChannel(Channel *c) override { hybrid->SendChannel(c); }
@@ -67,7 +67,7 @@ class PlexusProto : public IRCDProto
if (uc != NULL)
uc->status.Clear();
- BotInfo *setter = BotInfo::Find(user->GetUID());
+ ServiceBot *setter = ServiceBot::Find(user->GetUID());
for (size_t i = 0; i < cs.Modes().length(); ++i)
c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
@@ -144,7 +144,7 @@ class PlexusProto : public IRCDProto
void SendLogin(User *u, NickServ::Nick *na) override
{
- UplinkSocket::Message(Me) << "ENCAP * SU " <&l