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

Reworked live SQL support yet again

This commit is contained in:
Adam
2012-04-23 05:08:26 -04:00
parent 63c639e108
commit 573e49a7ea
172 changed files with 2517 additions and 2217 deletions
+8 -7
View File
@@ -154,7 +154,7 @@ class BahamutIRCdProto : public IRCDProto
}
/* JOIN - SJOIN */
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
void SendJoin(const User *user, Channel *c, const ChannelStatus *status) anope_override
{
UplinkSocket::Message(user) << "SJOIN " << c->creation_time << " " << c->name;
if (status)
@@ -168,7 +168,7 @@ class BahamutIRCdProto : public IRCDProto
if (uc != NULL)
uc->Status->ClearFlags();
BotInfo *setter = findbot(user->nick);
const BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
@@ -188,7 +188,7 @@ class BahamutIRCdProto : public IRCDProto
return;
}
XLine *old = x;
const XLine *old = x;
if (old->manager->HasEntry("*@" + u->host))
return;
@@ -279,13 +279,13 @@ class BahamutIRCdProto : public IRCDProto
void SendLogin(User *u) anope_override
{
BotInfo *ns = findbot(Config->NickServ);
const BotInfo *ns = findbot(Config->NickServ);
ircdproto->SendMode(ns, u, "+d %d", u->timestamp);
}
void SendLogout(User *u) anope_override
{
BotInfo *ns = findbot(Config->NickServ);
const BotInfo *ns = findbot(Config->NickServ);
ircdproto->SendMode(ns, u, "+d 1");
}
};
@@ -332,10 +332,11 @@ class BahamutIRCdMessage : public IRCdMessage
User *user = do_nick(source, params[0], params[4], params[5], params[6], params[9], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, ip.addr(), "", "", params[3]);
if (user && nickserv)
{
NickAlias *na;
const NickAlias *na;
if (user->timestamp == convertTo<time_t>(params[7]) && (na = findnick(user->nick)))
{
user->Login(na->nc);
NickCore *nc = na->nc;
user->Login(nc);
if (!Config->NoNicknameOwnership && na->nc->HasFlag(NI_UNCONFIRMED) == false)
user->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
+8 -8
View File
@@ -51,7 +51,7 @@ class InspIRCdTS6Proto : public IRCDProto
void SendAkillDel(const XLine *x) anope_override
{
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
/* InspIRCd may support regex bans */
if (x->IsRegex() && has_rlinemod)
@@ -92,7 +92,7 @@ class InspIRCdTS6Proto : public IRCDProto
if (timeleft > 172800 || !x->Expires)
timeleft = 172800;
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
/* InspIRCd may support regex bans, if they do we can send this and forget about it */
if (x->IsRegex() && has_rlinemod)
{
@@ -114,7 +114,7 @@ class InspIRCdTS6Proto : public IRCDProto
return;
}
XLine *old = x;
const XLine *old = x;
if (old->manager->HasEntry("*@" + u->host))
return;
@@ -169,7 +169,7 @@ class InspIRCdTS6Proto : public IRCDProto
}
/* JOIN */
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
void SendJoin(const User *user, Channel *c, const ChannelStatus *status) anope_override
{
UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :," << user->GetUID();
/* Note that we can send this with the FJOIN but choose not to
@@ -187,7 +187,7 @@ class InspIRCdTS6Proto : public IRCDProto
if (uc != NULL)
uc->Status->ClearFlags();
BotInfo *setter = findbot(user->nick);
const BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
@@ -231,7 +231,7 @@ class InspIRCdTS6Proto : public IRCDProto
/* SVSHOLD - set */
void SendSVSHold(const Anope::string &nick) anope_override
{
BotInfo *bi = findbot(Config->NickServ);
const BotInfo *bi = findbot(Config->NickServ);
if (bi)
UplinkSocket::Message(bi) << "SVSHOLD " << nick << " " << Config->NSReleaseTimeout << " :Being held for registered user";
}
@@ -239,7 +239,7 @@ class InspIRCdTS6Proto : public IRCDProto
/* SVSHOLD - release */
void SendSVSHoldDel(const Anope::string &nick) anope_override
{
BotInfo *bi = findbot(Config->NickServ);
const BotInfo *bi = findbot(Config->NickServ);
if (bi)
UplinkSocket::Message(bi) << "SVSHOLD " << nick;
}
@@ -497,7 +497,7 @@ class InspircdIRCdMessage : public IRCdMessage
bool event_idle(const Anope::string &source, const std::vector<Anope::string> &params)
{
BotInfo *bi = findbot(params[0]);
const BotInfo *bi = findbot(params[0]);
if (bi)
UplinkSocket::Message(bi) << "IDLE " << source << " " << start_time << " " << (Anope::CurTime - bi->lastmsg);
return true;
+12 -6
View File
@@ -13,6 +13,11 @@
#include "module.h"
struct ExtensibleString : Anope::string, ExtensibleItem
{
ExtensibleString(const Anope::string &s) : Anope::string(s) { }
};
IRCDVar myIrcd = {
"InspIRCd 1.1", /* ircd name */
"+I", /* Modes used by pseudoclients */
@@ -48,7 +53,7 @@ static bool has_hidechansmod = false;
/* CHGHOST */
void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost)
{
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
if (has_chghostmod)
{
if (nick.empty() || vhost.empty())
@@ -64,7 +69,7 @@ void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost)
bool event_idle(const Anope::string &source, const std::vector<Anope::string> &params)
{
BotInfo *bi = findbot(params[0]);
const BotInfo *bi = findbot(params[0]);
UplinkSocket::Message(bi) << "IDLE " << source << " " << start_time << " " << (bi ? Anope::CurTime - bi->lastmsg : 0);
return true;
}
@@ -128,7 +133,7 @@ class InspIRCdProto : public IRCDProto
return;
}
XLine *old = x;
const XLine *old = x;
if (old->manager->HasEntry("*@" + u->host))
return;
@@ -210,7 +215,7 @@ class InspIRCdProto : public IRCDProto
}
/* JOIN */
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
void SendJoin(const User *user, Channel *c, const ChannelStatus *status) anope_override
{
UplinkSocket::Message(user) << "JOIN " << c->name << " " << c->creation_time;
if (status)
@@ -224,7 +229,7 @@ class InspIRCdProto : public IRCDProto
if (uc != NULL)
uc->Status->ClearFlags();
BotInfo *setter = findbot(user->nick);
const BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
@@ -386,7 +391,8 @@ class InspircdIRCdMessage : public IRCdMessage
Anope::string *svidbuf = na ? na->nc->GetExt<ExtensibleString *>("authenticationtoken") : NULL;
if (na && svidbuf && *svidbuf == params[0])
{
user->Login(na->nc);
NickCore *nc = na->nc;
user->Login(nc);
if (!Config->NoNicknameOwnership && na->nc->HasFlag(NI_UNCONFIRMED) == false)
user->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
+3 -3
View File
@@ -220,7 +220,7 @@ bool event_metadata(const Anope::string &source, const std::vector<Anope::string
{
u->Login(nc);
NickAlias *user_na = findnick(u->nick);
const NickAlias *user_na = findnick(u->nick);
if (!Config->NoNicknameOwnership && nickserv && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
@@ -266,7 +266,7 @@ class InspIRCdExtBan : public ChannelModeList
public:
InspIRCdExtBan(ChannelModeName mName, char modeChar) : ChannelModeList(mName, modeChar) { }
bool Matches(User *u, const Entry *e) anope_override
bool Matches(const User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->mask;
@@ -721,7 +721,7 @@ class ProtoInspIRCd : public Module
Config->Numeric = numeric;
}
for (botinfo_map::iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
it->second->GenerateUID();
}
+3 -3
View File
@@ -232,7 +232,7 @@ bool event_metadata(const Anope::string &source, const std::vector<Anope::string
{
u->Login(nc);
NickAlias *user_na = findnick(u->nick);
const NickAlias *user_na = findnick(u->nick);
if (!Config->NoNicknameOwnership && nickserv && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
@@ -278,7 +278,7 @@ class InspIRCdExtBan : public ChannelModeList
public:
InspIRCdExtBan(ChannelModeName mName, char modeChar) : ChannelModeList(mName, modeChar) { }
bool Matches(User *u, const Entry *e) anope_override
bool Matches(const User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->mask;
@@ -740,7 +740,7 @@ class ProtoInspIRCd : public Module
Config->Numeric = numeric;
}
for (botinfo_map::iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
it->second->GenerateUID();
}
+13 -12
View File
@@ -52,13 +52,13 @@ class PlexusProto : public IRCDProto
void SendSGLineDel(const XLine *x) anope_override
{
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
UplinkSocket::Message(bi) << "UNXLINE * " << x->Mask;
}
void SendSGLine(User *, const XLine *x) anope_override
{
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
UplinkSocket::Message(bi) << "XLINE * " << x->Mask << " 0 :" << x->GetReason();
}
@@ -67,7 +67,7 @@ class PlexusProto : public IRCDProto
if (x->IsRegex() || x->HasNickOrReal())
return;
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
UplinkSocket::Message(bi) << "UNKLINE * " << x->GetUser() << " " << x->GetHost();
}
@@ -76,7 +76,7 @@ class PlexusProto : public IRCDProto
UplinkSocket::Message(Me) << "UNRESV * " << x->Mask;
}
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
void SendJoin(const User *user, Channel *c, const ChannelStatus *status) anope_override
{
UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" << user->GetUID();
if (status)
@@ -90,7 +90,7 @@ class PlexusProto : public IRCDProto
if (uc != NULL)
uc->Status->ClearFlags();
BotInfo *setter = findbot(user->nick);
const BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
@@ -99,7 +99,7 @@ class PlexusProto : public IRCDProto
void SendAkill(User *u, XLine *x) anope_override
{
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
if (x->IsRegex() || x->HasNickOrReal())
{
@@ -112,14 +112,15 @@ class PlexusProto : public IRCDProto
return;
}
XLine *old = x;
const 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->UID);
old->manager->AddXLine(x);
XLine *xline = new XLine("*@" + u->host, old->By, old->Expires, old->Reason, old->UID);
old->manager->AddXLine(xline);
x = xline;
Log(bi, "akill") << "AKILL: Added an akill for " << x->Mask << " because " << u->GetMask() << "#" << u->realname << " matches " << old->Mask;
}
@@ -146,7 +147,7 @@ class PlexusProto : public IRCDProto
void SendVhostDel(User *u) anope_override
{
BotInfo *bi = findbot(Config->HostServ);
const BotInfo *bi = findbot(Config->HostServ);
if (u->HasMode(UMODE_CLOAK))
u->RemoveMode(bi, UMODE_CLOAK);
else
@@ -538,7 +539,7 @@ bool event_encap(const Anope::string &source, const std::vector<Anope::string> &
else if (params[1].equals_cs("SU"))
{
User *u = finduser(params[2]);
NickAlias *user_na = findnick(params[2]);
const NickAlias *user_na = findnick(params[2]);
NickCore *nc = findcore(params[3]);
if (u && nc)
{
@@ -665,7 +666,7 @@ class ProtoPlexus : public Module
Config->Numeric = numeric;
}
for (botinfo_map::iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
it->second->GenerateUID();
}
+11 -10
View File
@@ -52,13 +52,13 @@ class RatboxProto : public IRCDProto
void SendSGLineDel(const XLine *x) anope_override
{
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
UplinkSocket::Message(bi) << "UNXLINE * " << x->Mask;
}
void SendSGLine(User *, const XLine *x) anope_override
{
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
UplinkSocket::Message(bi) << "XLINE * " << x->Mask << " 0 :" << x->GetReason();
}
@@ -67,7 +67,7 @@ class RatboxProto : public IRCDProto
if (x->IsRegex() || x->HasNickOrReal())
return;
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
UplinkSocket::Message(bi) << "UNKLINE * " << x->GetUser() << " " << x->GetHost();
}
@@ -76,7 +76,7 @@ class RatboxProto : public IRCDProto
UplinkSocket::Message(Me) << "UNRESV * " << x->Mask;
}
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
void SendJoin(const User *user, Channel *c, const ChannelStatus *status) anope_override
{
/* Note that we must send our modes with the SJOIN and
* can not add them to the mode stacker because ratbox
@@ -94,7 +94,7 @@ class RatboxProto : public IRCDProto
void SendAkill(User *u, XLine *x) anope_override
{
BotInfo *bi = findbot(Config->OperServ);
const BotInfo *bi = findbot(Config->OperServ);
if (x->IsRegex() || x->HasNickOrReal())
{
@@ -107,14 +107,15 @@ class RatboxProto : public IRCDProto
return;
}
XLine *old = x;
const 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->UID);
old->manager->AddXLine(x);
XLine *xline = new XLine("*@" + u->host, old->By, old->Expires, old->Reason, old->UID);
old->manager->AddXLine(xline);
x = xline;
Log(bi, "akill") << "AKILL: Added an akill for " << x->Mask << " because " << u->GetMask() << "#" << u->realname << " matches " << old->Mask;
}
@@ -454,7 +455,7 @@ bool event_encap(const Anope::string &source, const std::vector<Anope::string> &
return true;
u->Login(nc);
NickAlias *user_na = findnick(u->nick);
const NickAlias *user_na = findnick(u->nick);
if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
@@ -577,7 +578,7 @@ class ProtoRatbox : public Module
Config->Numeric = numeric;
}
for (botinfo_map::iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
it->second->GenerateUID();
}
+13 -12
View File
@@ -73,7 +73,7 @@ class UnrealIRCdProto : public IRCDProto
void SendVhostDel(User *u) anope_override
{
BotInfo *bi = findbot(Config->HostServ);
const BotInfo *bi = findbot(Config->HostServ);
u->RemoveMode(bi, UMODE_CLOAK);
u->RemoveMode(bi, UMODE_VHOST);
ModeManager::ProcessModes();
@@ -93,14 +93,15 @@ class UnrealIRCdProto : public IRCDProto
return;
}
XLine *old = x;
const 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->UID);
old->manager->AddXLine(x);
XLine *xline = new XLine("*@" + u->host, old->By, old->Expires, old->Reason, old->UID);
old->manager->AddXLine(xline);
x = xline;
Log(findbot(Config->OperServ), "akill") << "AKILL: Added an akill for " << x->Mask << " because " << u->GetMask() << "#" << u->realname << " matches " << old->Mask;
}
@@ -164,7 +165,7 @@ class UnrealIRCdProto : public IRCDProto
}
/* JOIN */
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
void SendJoin(const User *user, Channel *c, const ChannelStatus *status) anope_override
{
UplinkSocket::Message(Me) << "~ " << c->creation_time << " " << c->name << " :" << user->nick;
if (status)
@@ -178,7 +179,7 @@ class UnrealIRCdProto : public IRCDProto
if (uc != NULL)
uc->Status->ClearFlags();
BotInfo *setter = findbot(user->nick);
const BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
@@ -349,7 +350,7 @@ class UnrealIRCdProto : public IRCDProto
if (!u->Account())
return;
BotInfo *ns = findbot(Config->NickServ);
const BotInfo *ns = findbot(Config->NickServ);
if (Capab.count("ESVID") > 0)
ircdproto->SendMode(ns, u, "+d %s", u->Account()->display.c_str());
else
@@ -358,7 +359,7 @@ class UnrealIRCdProto : public IRCDProto
void SendLogout(User *u) anope_override
{
BotInfo *ns = findbot(Config->NickServ);
const BotInfo *ns = findbot(Config->NickServ);
ircdproto->SendMode(ns, u, "+d 1");
}
@@ -368,7 +369,7 @@ class UnrealIRCdProto : public IRCDProto
* so we will join and part us now
*/
BotInfo *bi = c->ci->WhoSends();
if (bi == NULL)
if (!bi)
;
else if (c->FindUser(bi) == NULL)
{
@@ -388,7 +389,7 @@ class UnrealExtBan : public ChannelModeList
public:
UnrealExtBan(ChannelModeName mName, char modeChar) : ChannelModeList(mName, modeChar) { }
bool Matches(User *u, const Entry *e) anope_override
bool Matches(const User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->mask;
@@ -578,7 +579,7 @@ class Unreal32IRCdMessage : public IRCdMessage
User *user = do_nick(source, params[0], params[3], params[4], params[5], params[10], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, ip.addr(), vhost, "", params[7]);
if (user)
{
NickAlias *na = NULL;
const NickAlias *na = NULL;
if (params[6] == "0")
;
@@ -612,7 +613,7 @@ class Unreal32IRCdMessage : public IRCdMessage
User *user = do_nick(source, params[0], params[3], params[4], params[5], params[9], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, "", vhost, "", params[7]);
if (user)
{
NickAlias *na = NULL;
const NickAlias *na = NULL;
if (params[6] == "0")
;