From 42238034490fb5479d787bd1695750387d508200 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 24 Nov 2014 14:27:23 -0500 Subject: 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. --- modules/protocol/bahamut.cpp | 51 +++++++++++--------- modules/protocol/charybdis.cpp | 51 ++++++++++---------- modules/protocol/hybrid.cpp | 60 +++++++++++------------ modules/protocol/inspircd20.cpp | 85 ++++++++++++++++---------------- modules/protocol/ngircd.cpp | 18 +++---- modules/protocol/plexus.cpp | 20 ++++---- modules/protocol/ratbox.cpp | 22 ++++----- modules/protocol/unreal.cpp | 104 +++++++++++++++++++--------------------- 8 files changed, 206 insertions(+), 205 deletions(-) (limited to 'modules/protocol') 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(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(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"); - 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(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(c->creation_time) << " " << c->ci->GetName() << " " << modes; } } EventReturn OnMLock(ChanServ::Channel *ci, ModeLock *lock) override { - ModeLocks *modelocks = ci->GetExt("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(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(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"); - 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(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(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(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(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 ¶ms) 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("ssl"); + u->Extend("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(params[7]); } @@ -1673,16 +1673,15 @@ class ProtoInspIRCd20 : public Module void OnChanRegistered(ChanServ::Channel *ci) override { - ModeLocks *modelocks = ci->GetExt("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"); - 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"); - 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 " << u->GetUID() << " " << na->nc->display; + UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << na->GetAccount()->GetDisplay(); } void SendLogout(User *u) override @@ -282,7 +282,7 @@ struct IRCDMessageUID : IRCDMessage if (params[8] != "0" && !na) na = NickServ::FindNick(params[8]); - User::OnIntroduce(params[0], params[4], params[9], params[5], ip, source.GetServer(), params[10], ts, params[3], params[7], na ? *na->nc : NULL); + User::OnIntroduce(params[0], params[4], params[9], params[5], ip, source.GetServer(), params[10], ts, params[3], params[7], na ? na->GetAccount() : NULL); } }; diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index a0d2cf9a2..4156d1fbf 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -29,14 +29,14 @@ class RatboxProto : 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 SendSGLine(User *u, const XLine *x) override { hybrid->SendSGLine(u, x); } - void SendSGLineDel(const XLine *x) override { hybrid->SendSGLineDel(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 SendSGLine(User *u, XLine *x) override { hybrid->SendSGLine(u, x); } + void SendSGLineDel(XLine *x) override { hybrid->SendSGLineDel(x); } void SendAkill(User *u, XLine *x) override { hybrid->SendAkill(u, x); } - void SendAkillDel(const XLine *x) override { hybrid->SendAkillDel(x); } - void SendSQLineDel(const XLine *x) override { hybrid->SendSQLineDel(x); } + void SendAkillDel(XLine *x) override { hybrid->SendAkillDel(x); } + void SendSQLineDel(XLine *x) override { hybrid->SendSQLineDel(x); } void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { hybrid->SendJoin(user, c, status); } void SendServer(const Server *server) override { hybrid->SendServer(server); } void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override { hybrid->SendModeInternal(source, u, buf); } @@ -83,10 +83,10 @@ class RatboxProto : public IRCDProto void SendLogin(User *u, NickServ::Nick *na) override { - if (na->nc->HasExt("UNCONFIRMED")) + if (na->GetAccount()->HasFieldS("UNCONFIRMED")) return; - UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << na->nc->display; + UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << na->GetAccount()->GetDisplay(); } void SendLogout(User *u) override @@ -96,7 +96,7 @@ class RatboxProto : public IRCDProto void SendTopic(const MessageSource &source, Channel *c) override { - BotInfo *bi = source.GetBot(); + ServiceBot *bi = source.GetBot(); bool needjoin = c->FindUser(bi) == NULL; if (needjoin) @@ -134,7 +134,7 @@ struct IRCDMessageEncap : IRCDMessage * their server isn't syncing) and then we receive this.. so tell them about it. */ if (u->server->IsSynced()) - u->SendMessage(Config->GetClient("NickServ"), _("You have been logged in as \002%s\002."), nc->display.c_str()); + u->SendMessage(Config->GetClient("NickServ"), _("You have been logged in as \002%s\002."), nc->GetDisplay().c_str()); } } }; diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 721ba50c3..918bf09f6 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -38,7 +38,7 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message() << "SVSNOOP " << server->GetName() << " " << (set ? "+" : "-"); } - void SendAkillDel(const XLine *x) override + void SendAkillDel(XLine *x) override { if (x->IsRegex() || x->HasNickOrReal()) return; @@ -54,7 +54,7 @@ class UnrealIRCdProto : public IRCDProto } } - UplinkSocket::Message() << "TKL - G " << x->GetUser() << " " << x->GetHost() << " " << x->by; + UplinkSocket::Message() << "TKL - G " << x->GetUser() << " " << x->GetHost() << " " << x->GetBy(); } void SendTopic(const MessageSource &source, Channel *c) override @@ -62,19 +62,19 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message(source) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; } - 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 SendVhostDel(User *u) override { - BotInfo *HostServ = Config->GetClient("HostServ"); + ServiceBot *HostServ = Config->GetClient("HostServ"); u->RemoveMode(HostServ, "CLOAK"); u->RemoveMode(HostServ, "VHOST"); ModeManager::ProcessModes(); @@ -94,17 +94,17 @@ class UnrealIRCdProto : 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); - old->manager->AddXLine(xline); - x = xline; + XLine *xl = new XLine("*@" + u->host, old->GetBy(), old->GetExpires(), old->GetReason(), old->GetID()); + 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(); } /* ZLine if we can instead */ @@ -119,10 +119,10 @@ class UnrealIRCdProto : public IRCDProto } // 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() << "TKL + G " << x->GetUser() << " " << x->GetHost() << " " << x->by << " " << Anope::CurTime + timeleft << " " << x->created << " :" << x->GetReason(); + UplinkSocket::Message() << "TKL + G " << x->GetUser() << " " << x->GetHost() << " " << x->GetBy() << " " << Anope::CurTime + timeleft << " " << x->GetCreated() << " :" << x->GetReason(); } void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override @@ -167,7 +167,7 @@ class UnrealIRCdProto : 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); @@ -178,9 +178,9 @@ class UnrealIRCdProto : public IRCDProto /* unsqline */ - void SendSQLineDel(const XLine *x) override + void SendSQLineDel(XLine *x) override { - UplinkSocket::Message() << "UNSQLINE " << x->mask; + UplinkSocket::Message() << "UNSQLINE " << x->GetMask(); } /* SQLINE */ @@ -188,9 +188,9 @@ class UnrealIRCdProto : public IRCDProto ** - Unreal will translate this to TKL for us ** */ - 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(); } /* @@ -199,7 +199,7 @@ class UnrealIRCdProto : public IRCDProto ** parv[1] = nick ** parv[2] = options */ - void SendSVSO(BotInfo *source, const Anope::string &nick, const Anope::string &flag) override + void SendSVSO(ServiceBot *source, const Anope::string &nick, const Anope::string &flag) override { UplinkSocket::Message(source) << "SVSO " << nick << " " << flag; } @@ -255,36 +255,36 @@ class UnrealIRCdProto : public IRCDProto /* * SVSNLINE - :realname mask */ - void SendSGLineDel(const XLine *x) override + void SendSGLineDel(XLine *x) override { - UplinkSocket::Message() << "SVSNLINE - :" << x->mask; + UplinkSocket::Message() << "SVSNLINE - :" << x->GetMask(); } /* UNSZLINE */ - void SendSZLineDel(const XLine *x) override + void SendSZLineDel(XLine *x) override { - UplinkSocket::Message() << "TKL - Z * " << x->GetHost() << " " << x->by; + UplinkSocket::Message() << "TKL - Z * " << x->GetHost() << " " << x->GetBy(); } /* 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; - UplinkSocket::Message() << "TKL + Z * " << x->GetHost() << " " << x->by << " " << Anope::CurTime + timeleft << " " << x->created << " :" << x->GetReason(); + UplinkSocket::Message() << "TKL + Z * " << x->GetHost() << " " << x->GetBy() << " " << Anope::CurTime + timeleft << " " << x->GetCreated() << " :" << x->GetReason(); } /* SGLINE */ /* * SVSNLINE + reason_where_is_space :realname mask with spaces */ - void SendSGLine(User *, const XLine *x) override + void SendSGLine(User *, XLine *x) override { Anope::string edited_reason = x->GetReason(); edited_reason = edited_reason.replace_all_cs(" ", "_"); - UplinkSocket::Message() << "SVSNLINE + " << edited_reason << " :" << x->mask; + UplinkSocket::Message() << "SVSNLINE + " << edited_reason << " :" << x->GetMask(); } /* svsjoin @@ -346,7 +346,7 @@ class UnrealIRCdProto : public IRCDProto void SendLogin(User *u, NickServ::Nick *na) override { if (Servers::Capab.count("ESVID") > 0) - 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()); else IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %d", u->signon); } @@ -361,7 +361,7 @@ class UnrealIRCdProto : public IRCDProto /* Unreal does not support updating a channels TS without actually joining a user, * so we will join and part us now */ - BotInfo *bi = c->ci->WhoSends(); + ServiceBot *bi = c->ci->WhoSends(); if (!bi) ; else if (c->FindUser(bi) == NULL) @@ -382,7 +382,7 @@ class UnrealIRCdProto : public IRCDProto if (p == Anope::string::npos) return; - UplinkSocket::Message(BotInfo::Find(message.source)) << "SASL " << message.target.substr(0, p) << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : " " + message.ext); + UplinkSocket::Message(ServiceBot::Find(message.source)) << "SASL " << message.target.substr(0, p) << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : " " + message.ext); } void SendSVSLogin(const Anope::string &uid, const Anope::string &acc) override @@ -536,7 +536,7 @@ namespace UnrealExtban const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); - return u->Account() && Anope::Match(u->Account()->display, real_mask); + return u->Account() && Anope::Match(u->Account()->GetDisplay(), real_mask); } }; } @@ -925,7 +925,7 @@ struct IRCDMessageNick : IRCDMessage na = NickServ::FindNick(params[6]); } - User::OnIntroduce(params[0], params[3], params[4], vhost, ip, s, params[10], user_ts, params[7], "", na ? *na->nc : NULL); + User::OnIntroduce(params[0], params[3], params[4], vhost, ip, s, params[10], user_ts, params[7], "", na ? na->GetAccount() : NULL); } else source.GetUser()->ChangeNick(params[0]); @@ -1261,6 +1261,7 @@ class ProtoUnreal : public Module , message_join(this) , message_kick(this) , message_kill(this) + , message_svskill(this, "SVSKILL") , message_motd(this) , message_notice(this) , message_part(this) @@ -1269,7 +1270,6 @@ class ProtoUnreal : public Module , message_quit(this) , message_squit(this) , message_stats(this) - , message_svskill(this, "SVSKILL") , message_time(this) , message_version(this) , message_whois(this) @@ -1315,38 +1315,35 @@ class ProtoUnreal : public Module if (!c->ci) return; - ModeLocks *modelocks = c->ci->GetExt("modelocks"); - if (use_server_side_mlock && Servers::Capab.count("MLOCK") > 0 && modelocks) + if (use_server_side_mlock && Servers::Capab.count("MLOCK") > 0 && mlocks) { - Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); - UplinkSocket::Message(Me) << "MLOCK " << static_cast(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(c->creation_time) << " " << c->ci->GetName() << " " << modes; } } void OnChanRegistered(ChanServ::Channel *ci) override { - ModeLocks *modelocks = ci->GetExt("modelocks"); - if (!ci->c || !use_server_side_mlock || !modelocks || !Servers::Capab.count("MLOCK")) + if (!ci->c || !use_server_side_mlock || !mlocks || !Servers::Capab.count("MLOCK")) return; - Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); - UplinkSocket::Message(Me) << "MLOCK " << static_cast(ci->c->creation_time) << " " << ci->name << " " << modes; + Anope::string modes = mlocks->GetMLockAsString(ci, false).replace_all_cs("+", "").replace_all_cs("-", ""); + UplinkSocket::Message(Me) << "MLOCK " << static_cast(ci->c->creation_time) << " " << ci->GetName() << " " << modes; } void OnDelChan(ChanServ::Channel *ci) override { if (!ci->c || !use_server_side_mlock || !Servers::Capab.count("MLOCK")) return; - UplinkSocket::Message(Me) << "MLOCK " << static_cast(ci->c->creation_time) << " " << ci->name << " :"; + UplinkSocket::Message(Me) << "MLOCK " << static_cast(ci->c->creation_time) << " " << ci->GetName() << " :"; } EventReturn OnMLock(ChanServ::Channel *ci, ModeLock *lock) override { - ModeLocks *modelocks = ci->GetExt("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) + ChannelMode *cm = ModeManager::FindChannelModeByName(lock->GetName()); + if (use_server_side_mlock && cm && mlocks && 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(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(ci->c->creation_time) << " " << ci->GetName() << " " << modes; } return EVENT_CONTINUE; @@ -1354,12 +1351,11 @@ class ProtoUnreal : public Module EventReturn OnUnMLock(ChanServ::Channel *ci, ModeLock *lock) override { - ModeLocks *modelocks = ci->GetExt("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) + ChannelMode *cm = ModeManager::FindChannelModeByName(lock->GetName()); + if (use_server_side_mlock && cm && mlocks && 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(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(ci->c->creation_time) << " " << ci->GetName() << " " << modes; } return EVENT_CONTINUE; -- cgit