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

Moved some global functions to be member functions and misc cleanup

This commit is contained in:
Adam
2011-04-25 03:16:57 -04:00
parent 6922bd239c
commit 076ebafa1b
30 changed files with 229 additions and 306 deletions
+4 -8
View File
@@ -224,16 +224,16 @@ class CommandBSBot : public Command
return MOD_CONT;
}
/* The new nick is really different, so we remove the Q line for
the old nick. */
/* The new nick is really different, so we remove the Q line for the old nick. */
if (ircd->sqline)
{
XLine x(bi->nick);
ircdproto->SendSQLineDel(&x);
}
/* We check whether user with this nick is online, and kill it if so */
EnforceQlinedNick(nick, Config->s_BotServ);
/* Add a Q line for the new nick */
XLine x(nick, "Reserved for services");
ircdproto->SendSQLine(NULL, &x);
}
if (!user.empty())
@@ -241,8 +241,6 @@ class CommandBSBot : public Command
else
{
ircdproto->SendChangeBotNick(bi, nick);
XLine x(bi->nick, "Reserved for services");
ircdproto->SendSQLine(NULL, &x);
}
if (!nick.equals_cs(bi->nick))
@@ -258,8 +256,6 @@ class CommandBSBot : public Command
if (!user.empty())
{
ircdproto->SendClientIntroduction(bi, ircd->pseudoclient_mode);
XLine x(bi->nick, "Reserved for services");
ircdproto->SendSQLine(NULL, &x);
bi->RejoinAll();
}
+10 -3
View File
@@ -192,10 +192,17 @@ class CommandCSAKick : public Command
}
/* Check excepts BEFORE we get this far */
if (ModeManager::FindChannelModeByName(CMODE_EXCEPT) && is_excepted_mask(ci, mask))
if (ci->c)
{
source.Reply(_(CHAN_EXCEPTED), mask.c_str(), ci->name.c_str());
return;
std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> modes = ci->c->GetModeList(CMODE_EXCEPT);
for (; modes.first != modes.second; ++modes.first)
{
if (Anope::Match(modes.first->second, mask))
{
source.Reply(_(CHAN_EXCEPTED), mask.c_str(), ci->name.c_str());
return;
}
}
}
/* Check whether target nick has equal/higher access
+1 -1
View File
@@ -100,7 +100,7 @@ class CommandCSInfo : public Command
CheckOptStr(optbuf, CI_NO_EXPIRE, _("No expire"), ci, u->Account());
source.Reply(_(NICK_INFO_OPTIONS), optbuf.empty() ? _("None") : optbuf.c_str());
source.Reply(_(" Mode lock: %s"), get_mlock_modes(ci, 1).c_str());
source.Reply(_(" Mode lock: %s"), ci->GetMLockAsString(true).c_str());
if (!ci->HasFlag(CI_NO_EXPIRE))
source.Reply(_(" Expires on: %s"), do_strftime(ci->last_used + Config->CSExpire).c_str());
+2 -2
View File
@@ -25,7 +25,7 @@ class ENone : public Module
{
Anope::string buf = "plain:";
Anope::string cpass;
b64_encode(src, cpass);
Anope::B64Encode(src, cpass);
buf += cpass;
Log(LOG_DEBUG_2) << "(enc_none) hashed password from [" << src << "] to [" << buf << "]";
dest = buf;
@@ -38,7 +38,7 @@ class ENone : public Module
return EVENT_CONTINUE;
size_t pos = src.find(':');
Anope::string buf = src.substr(pos + 1);
b64_decode(buf, dest);
Anope::B64Decode(buf, dest);
return EVENT_ALLOW;
}
+1 -1
View File
@@ -69,7 +69,7 @@ class CommandNSGhost : public Command
{
Log(LOG_COMMAND, u, this) << "for " << nick;
Anope::string buf = "GHOST command used by " + u->nick;
kill_user(Config->s_NickServ, user, buf);
user->Kill(Config->s_NickServ, buf);
source.Reply(_("Ghost with your nick has been killed."), nick.c_str());
}
}
+1 -1
View File
@@ -46,7 +46,7 @@ class CommandOSNOOP : public Command
++it;
if (u2 && u2->HasMode(UMODE_OPER) && Anope::Match(u2->server->GetName(), server, true))
kill_user(Config->s_OperServ, u2, reason);
u2->Kill(Config->s_OperServ, reason);
}
}
else if (cmd.equals_ci("REVOKE"))
+1 -1
View File
@@ -606,7 +606,7 @@ class OSSession : public Module
if (!Config->SessionLimitDetailsLoc.empty())
u->SendMessage(operserv->Bot(), "%s", Config->SessionLimitDetailsLoc.c_str());
kill_user(Config->s_OperServ, u, "Session limit exceeded");
u->Kill(Config->s_OperServ, "Session limit exceeded");
++session->hits;
if (Config->MaxSessionKill && session->hits >= Config->MaxSessionKill && SGLine)
+8 -6
View File
@@ -436,7 +436,7 @@ class OSDefcon : public Module
}
if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS))
kill_user(Config->s_OperServ, u, DConfig.akillreason);
u->Kill(Config->s_OperServ, DConfig.akillreason);
return EVENT_STOP;
}
@@ -556,7 +556,7 @@ class OSDefcon : public Module
if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS))
{
kill_user(Config->s_OperServ, u, DConfig.akillreason);
u->Kill(Config->s_OperServ, DConfig.akillreason);
return;
}
}
@@ -574,7 +574,7 @@ class OSDefcon : public Module
if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS))
{
kill_user(Config->s_OperServ, u, DConfig.akillreason);
u->Kill(Config->s_OperServ, DConfig.akillreason);
return;
}
@@ -590,7 +590,7 @@ class OSDefcon : public Module
if (!Config->SessionLimitDetailsLoc.empty())
ircdproto->SendMessage(operserv->Bot(), u->nick, "%s", Config->SessionLimitDetailsLoc.c_str());
kill_user(Config->s_OperServ, u, "Defcon session limit exceeded");
u->Kill(Config->s_OperServ, "Defcon session limit exceeded");
++session->hits;
if (Config->MaxSessionKill && session->hits >= Config->MaxSessionKill)
{
@@ -651,7 +651,8 @@ void runDefCon()
{
Log(operserv->Bot(), "operserv/defcon") << "DEFCON: setting " << DConfig.chanmodes << " on all channels";
DefConModesSet = true;
MassChannelModes(operserv->Bot(), DConfig.chanmodes);
for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it)
it->second->SetModes(operserv->Bot(), false, "%s", DConfig.chanmodes.c_str());
}
}
}
@@ -666,7 +667,8 @@ void runDefCon()
if (!newmodes.empty())
{
Log(operserv->Bot(), "operserv/defcon") << "DEFCON: setting " << newmodes << " on all channels";
MassChannelModes(operserv->Bot(), newmodes);
for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it)
it->second->SetModes(operserv->Bot(), false, "%s", newmodes.c_str());
}
}
}
+6 -2
View File
@@ -212,7 +212,8 @@ class BahamutIRCdProto : public IRCDProto
void SendClientIntroduction(const User *u, const Anope::string &modes)
{
EnforceQlinedNick(u->nick, Config->s_BotServ);
XLine x(u->nick, "Reserved for services");
ircdproto->SendSQLine(NULL, &x);
send_cmd("", "NICK %s 1 %ld %s %s %s %s 0 0 :%s", u->nick.c_str(), static_cast<long>(u->timestamp), modes.c_str(), u->GetIdent().c_str(), u->host.c_str(), u->server->GetName().c_str(), u->realname.c_str());
}
@@ -248,7 +249,10 @@ class BahamutIRCdProto : public IRCDProto
void SendChannel(Channel *c)
{
send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), get_mlock_modes(c->ci, true).c_str());
Anope::string modes = c->GetModes(true, true);
if (modes.empty())
modes = "+";
send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), modes.c_str());
}
};
+4 -1
View File
@@ -244,7 +244,10 @@ class InspIRCdTS6Proto : public IRCDProto
void SendChannel(Channel *c)
{
send_cmd(Config->Numeric, "FJOIN %s %ld %s :", c->name.c_str(), static_cast<long>(c->creation_time), get_mlock_modes(c->ci, true).c_str());
Anope::string modes = c->GetModes(true, true);
if (modes.empty())
modes = "+";
send_cmd(Config->Numeric, "FJOIN %s %ld %s :", c->name.c_str(), static_cast<long>(c->creation_time), modes.c_str());
}
bool IsNickValid(const Anope::string &nick)
+6 -2
View File
@@ -166,7 +166,8 @@ class PlexusProto : public IRCDProto
void SendClientIntroduction(const User *u, const Anope::string &modes)
{
EnforceQlinedNick(u->nick, "");
XLine x(u->nick, "Reserved for services");
ircdproto->SendSQLine(NULL, &x);
send_cmd(Config->Numeric, "UID %s 1 %ld %s %s %s 255.255.255.255 %s 0 %s :%s", u->nick.c_str(), static_cast<long>(u->timestamp), modes.c_str(), u->GetIdent().c_str(), u->host.c_str(), u->GetUID().c_str(), u->host.c_str(), u->realname.c_str());
}
@@ -228,7 +229,10 @@ class PlexusProto : public IRCDProto
void SendChannel(Channel *c)
{
send_cmd(Config->Numeric, "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), get_mlock_modes(c->ci, true).c_str());
Anope::string modes = c->GetModes(true, true);
if (modes.empty())
modes = "+";
send_cmd(Config->Numeric, "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), modes.c_str());
}
};
+6 -2
View File
@@ -169,7 +169,8 @@ class RatboxProto : public IRCDProto
void SendClientIntroduction(const User *u, const Anope::string &modes)
{
EnforceQlinedNick(u->nick, "");
XLine x(u->nick, "Reserved for services");
ircdproto->SendSQLine(NULL, &x);
send_cmd(Config->Numeric, "UID %s 1 %ld %s %s %s 0 %s :%s", u->nick.c_str(), static_cast<long>(u->timestamp), modes.c_str(), u->GetIdent().c_str(), u->host.c_str(), u->GetUID().c_str(), u->realname.c_str());
}
@@ -223,7 +224,10 @@ class RatboxProto : public IRCDProto
void SendChannel(Channel *c)
{
send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), get_mlock_modes(c->ci, true).c_str());
Anope::string modes = c->GetModes(true, true);
if (modes.empty())
modes = "+";
send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), modes.c_str());
}
bool IsNickValid(const Anope::string &nick)
+3 -2
View File
@@ -141,7 +141,8 @@ class UnrealIRCdProto : public IRCDProto
void SendClientIntroduction(const User *u, const Anope::string &modes)
{
EnforceQlinedNick(u->nick, Config->ServerName);
XLine x(u->nick, "Reserved for services");
ircdproto->SendSQLine(NULL, &x);
send_cmd("", "& %s 1 %ld %s %s %s 0 %s %s * :%s", u->nick.c_str(), static_cast<long>(u->timestamp), u->GetIdent().c_str(), u->host.c_str(), Config->ServerName.c_str(), modes.c_str(), u->host.c_str(), u->realname.c_str());
}
@@ -513,7 +514,7 @@ class Unreal32IRCdMessage : public IRCdMessage
else if (params.size() == 11)
{
Anope::string decoded_ip;
b64_decode(params[9], decoded_ip);
Anope::B64Decode(params[9], decoded_ip);
sockaddrs ip;
ip.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str());