mirror of
https://github.com/anope/anope.git
synced 2026-07-06 21:23:13 +02:00
Changed the protocol handling system to use a vector of strings instead of C style arrays. Burned the old process/split_buf/memory.c code
This commit is contained in:
+142
-152
@@ -293,15 +293,15 @@ class BahamutIRCdProto : public IRCDProto
|
||||
} ircd_proto;
|
||||
|
||||
/* EVENT: SJOIN */
|
||||
int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
bool event_sjoin(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = findchan(av[1]);
|
||||
time_t ts = Anope::string(av[0]).is_pos_number_only() ? convertTo<time_t>(av[0]) : 0;
|
||||
Channel *c = findchan(params[1]);
|
||||
time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : 0;
|
||||
bool keep_their_modes = false;
|
||||
|
||||
if (!c)
|
||||
{
|
||||
c = new Channel(av[1], ts);
|
||||
c = new Channel(params[1], ts);
|
||||
c->SetFlag(CH_SYNCING);
|
||||
}
|
||||
/* Our creation time is newer than what the server gave us */
|
||||
@@ -318,16 +318,21 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
keep_their_modes = false;
|
||||
|
||||
/* If we need to keep their modes, and this SJOIN string contains modes */
|
||||
if (keep_their_modes && ac >= 4)
|
||||
if (keep_their_modes && params.size() >= 4)
|
||||
{
|
||||
/* Set the modes internally */
|
||||
ChanSetInternalModes(c, ac - 3, av + 2);
|
||||
Anope::string modes;
|
||||
for (unsigned i = 2; i < params.size(); ++i)
|
||||
modes += " " + params[i];
|
||||
if (!modes.empty())
|
||||
modes.erase(modes.begin());
|
||||
c->SetModesInternal(NULL, modes);
|
||||
}
|
||||
|
||||
/* For a reason unknown to me, bahamut will send a SJOIN from the user joining a channel
|
||||
* if the channel already existed
|
||||
*/
|
||||
if (!c->HasFlag(CH_SYNCING) && ac == 2)
|
||||
if (!c->HasFlag(CH_SYNCING) && params.size() == 2)
|
||||
{
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
@@ -355,7 +360,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
}
|
||||
else
|
||||
{
|
||||
spacesepstream sep(av[ac - 1]);
|
||||
spacesepstream sep(params[params.size() - 1]);
|
||||
Anope::string buf;
|
||||
while (sep.GetToken(buf))
|
||||
{
|
||||
@@ -418,7 +423,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
c->Sync();
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -439,17 +444,17 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
** parv[0] = new nickname
|
||||
** parv[1] = hopcount
|
||||
*/
|
||||
int anope_event_nick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_nick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *user;
|
||||
|
||||
if (ac != 2)
|
||||
if (params.size() != 2)
|
||||
{
|
||||
user = do_nick(source, av[0], av[4], av[5], av[6], av[9], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : 0, av[8], "", "", av[3]);
|
||||
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, params[8], "", "", params[3]);
|
||||
if (user)
|
||||
{
|
||||
NickAlias *na;
|
||||
if (user->timestamp == convertTo<time_t>(av[7]) && (na = findnick(user->nick)))
|
||||
if (user->timestamp == convertTo<time_t>(params[7]) && (na = findnick(user->nick)))
|
||||
{
|
||||
user->Login(na->nc);
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
@@ -459,214 +464,199 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av)
|
||||
}
|
||||
}
|
||||
else
|
||||
do_nick(source, av[0], "", "", "", "", Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0, "", "", "", "");
|
||||
return MOD_CONT;
|
||||
do_nick(source, params[0], "", "", "", "", Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0, "", "", "", "");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT : CAPAB */
|
||||
int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
bool event_capab(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
CapabParse(ac, av);
|
||||
return MOD_CONT;
|
||||
CapabParse(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT : OS */
|
||||
int anope_event_os(const Anope::string &source, int ac, const char **av)
|
||||
bool event_os(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
m_privmsg(source, Config->s_OperServ, av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
m_privmsg(source, Config->s_OperServ, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT : NS */
|
||||
int anope_event_ns(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ns(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
m_privmsg(source, Config->s_NickServ, av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
m_privmsg(source, Config->s_NickServ, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT : MS */
|
||||
int anope_event_ms(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ms(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
m_privmsg(source, Config->s_MemoServ, av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
m_privmsg(source, Config->s_MemoServ, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT : HS */
|
||||
int anope_event_hs(const Anope::string &source, int ac, const char **av)
|
||||
bool event_hs(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
m_privmsg(source, Config->s_HostServ, av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
m_privmsg(source, Config->s_HostServ, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT : CS */
|
||||
int anope_event_cs(const Anope::string &source, int ac, const char **av)
|
||||
bool event_cs(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
m_privmsg(source, Config->s_ChanServ, av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
m_privmsg(source, Config->s_ChanServ, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_436(const Anope::string &source, int ac, const char **av)
|
||||
bool event_436(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
|
||||
m_nickcoll(av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
m_nickcoll(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT : SERVER */
|
||||
int anope_event_server(const Anope::string &source, int ac, const char **av)
|
||||
bool event_server(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], "");
|
||||
return MOD_CONT;
|
||||
do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[2], "");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT : PRIVMSG */
|
||||
int anope_event_privmsg(const Anope::string &source, int ac, const char **av)
|
||||
bool event_privmsg(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
m_privmsg(source, av[0], av[1]);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 1)
|
||||
m_privmsg(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_part(const Anope::string &source, int ac, const char **av)
|
||||
bool event_part(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1 || ac > 2)
|
||||
return MOD_CONT;
|
||||
do_part(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
do_part(source, params[0], params.size() > 1 ? params[1] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_whois(const Anope::string &source, int ac, const char **av)
|
||||
bool event_whois(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!source.empty() && ac >= 1)
|
||||
m_whois(source, av[0]);
|
||||
return MOD_CONT;
|
||||
if (!source.empty() && params.size() > 0)
|
||||
m_whois(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_topic(const Anope::string &source, int ac, const char **av)
|
||||
bool event_topic(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 4)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 4)
|
||||
return true;
|
||||
|
||||
Channel *c = findchan(av[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
if (!c)
|
||||
{
|
||||
Log() << "TOPIC for nonexistant channel " << av[0];
|
||||
return MOD_CONT;
|
||||
Log() << "TOPIC for nonexistant channel " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
c->ChangeTopicInternal(av[1], av[3], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : Anope::CurTime);
|
||||
c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_squit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_squit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
do_squit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 0)
|
||||
do_squit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_quit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_quit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
do_quit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 0)
|
||||
do_quit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT: MODE */
|
||||
int anope_event_mode(const Anope::string &source, int ac, const char **av)
|
||||
bool event_mode(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 2)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 3)
|
||||
return true;
|
||||
|
||||
if (*av[0] == '#' || *av[0] == '&')
|
||||
do_cmode(source, ac, av);
|
||||
if (params[0][0] == '#' || params[0][0] == '&')
|
||||
do_cmode(source, params[0], params[2], params[1]);
|
||||
else
|
||||
do_umode(source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_umode(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT: KILL */
|
||||
int anope_event_kill(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kill(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
|
||||
m_kill(av[0], av[1]);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 1)
|
||||
m_kill(params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT: KICK */
|
||||
int anope_event_kick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 3)
|
||||
return MOD_CONT;
|
||||
do_kick(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 2)
|
||||
do_kick(source, params[0], params[1], params[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT: JOIN */
|
||||
int anope_event_join(const Anope::string &source, int ac, const char **av)
|
||||
bool event_join(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
do_join(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() >= 2)
|
||||
do_join(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT: MOTD */
|
||||
int anope_event_motd(const Anope::string &source, int ac, const char **av)
|
||||
bool event_motd(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (source.empty())
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
|
||||
m_motd(source);
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_away(const Anope::string &source, int ac, const char **av)
|
||||
bool event_away(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (source.empty())
|
||||
return MOD_CONT;
|
||||
m_away(source, ac ? av[0] : "");
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
m_away(source, !params.empty() ? params[0] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_ping(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ping(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
ircdproto->SendPong(ac > 1 ? av[1] : Config->ServerName, av[0]);
|
||||
return MOD_CONT;
|
||||
if (params.size() < 1)
|
||||
return true;
|
||||
ircdproto->SendPong(params.size() > 1 ? params[1] : Config->ServerName, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_error(const Anope::string &source, int ac, const char **av)
|
||||
bool event_error(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac >= 1)
|
||||
Log(LOG_DEBUG) << av[0];
|
||||
return MOD_CONT;
|
||||
if (params.size() > 0)
|
||||
Log(LOG_DEBUG) << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_burst(const Anope::string &source, int ac, const char **av)
|
||||
bool event_burst(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Server *s = Server::Find(source);
|
||||
|
||||
if (!ac)
|
||||
if (params.empty())
|
||||
{
|
||||
/* for future use - start burst */
|
||||
}
|
||||
@@ -681,7 +671,7 @@ int anope_event_burst(const Anope::string &source, int ac, const char **av)
|
||||
if (s)
|
||||
s->Sync(true);
|
||||
}
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChannelModeFlood::IsValid(const Anope::string &value) const
|
||||
@@ -695,32 +685,32 @@ bool ChannelModeFlood::IsValid(const Anope::string &value) const
|
||||
|
||||
void moduleAddIRCDMsgs()
|
||||
{
|
||||
Anope::AddMessage("436", anope_event_436);
|
||||
Anope::AddMessage("AWAY", anope_event_away);
|
||||
Anope::AddMessage("JOIN", anope_event_join);
|
||||
Anope::AddMessage("KICK", anope_event_kick);
|
||||
Anope::AddMessage("KILL", anope_event_kill);
|
||||
Anope::AddMessage("MODE", anope_event_mode);
|
||||
Anope::AddMessage("MOTD", anope_event_motd);
|
||||
Anope::AddMessage("NICK", anope_event_nick);
|
||||
Anope::AddMessage("PART", anope_event_part);
|
||||
Anope::AddMessage("PING", anope_event_ping);
|
||||
Anope::AddMessage("PRIVMSG", anope_event_privmsg);
|
||||
Anope::AddMessage("QUIT", anope_event_quit);
|
||||
Anope::AddMessage("SERVER", anope_event_server);
|
||||
Anope::AddMessage("SQUIT", anope_event_squit);
|
||||
Anope::AddMessage("TOPIC", anope_event_topic);
|
||||
Anope::AddMessage("WHOIS", anope_event_whois);
|
||||
Anope::AddMessage("SVSMODE", anope_event_mode);
|
||||
Anope::AddMessage("CAPAB", anope_event_capab);
|
||||
Anope::AddMessage("CS", anope_event_cs);
|
||||
Anope::AddMessage("HS", anope_event_hs);
|
||||
Anope::AddMessage("MS", anope_event_ms);
|
||||
Anope::AddMessage("NS", anope_event_ns);
|
||||
Anope::AddMessage("OS", anope_event_os);
|
||||
Anope::AddMessage("SJOIN", anope_event_sjoin);
|
||||
Anope::AddMessage("ERROR", anope_event_error);
|
||||
Anope::AddMessage("BURST", anope_event_burst);
|
||||
Anope::AddMessage("436", event_436);
|
||||
Anope::AddMessage("AWAY", event_away);
|
||||
Anope::AddMessage("JOIN", event_join);
|
||||
Anope::AddMessage("KICK", event_kick);
|
||||
Anope::AddMessage("KILL", event_kill);
|
||||
Anope::AddMessage("MODE", event_mode);
|
||||
Anope::AddMessage("MOTD", event_motd);
|
||||
Anope::AddMessage("NICK", event_nick);
|
||||
Anope::AddMessage("PART", event_part);
|
||||
Anope::AddMessage("PING", event_ping);
|
||||
Anope::AddMessage("PRIVMSG", event_privmsg);
|
||||
Anope::AddMessage("QUIT", event_quit);
|
||||
Anope::AddMessage("SERVER", event_server);
|
||||
Anope::AddMessage("SQUIT", event_squit);
|
||||
Anope::AddMessage("TOPIC", event_topic);
|
||||
Anope::AddMessage("WHOIS", event_whois);
|
||||
Anope::AddMessage("SVSMODE", event_mode);
|
||||
Anope::AddMessage("CAPAB", event_capab);
|
||||
Anope::AddMessage("CS", event_cs);
|
||||
Anope::AddMessage("HS", event_hs);
|
||||
Anope::AddMessage("MS", event_ms);
|
||||
Anope::AddMessage("NS", event_ns);
|
||||
Anope::AddMessage("OS", event_os);
|
||||
Anope::AddMessage("SJOIN", event_sjoin);
|
||||
Anope::AddMessage("ERROR", event_error);
|
||||
Anope::AddMessage("BURST", event_burst);
|
||||
}
|
||||
|
||||
static void AddModes()
|
||||
|
||||
+220
-256
@@ -66,11 +66,11 @@ void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost)
|
||||
ircdproto->SendGlobops(OperServ, "CHGHOST not loaded!");
|
||||
}
|
||||
|
||||
int anope_event_idle(const Anope::string &source, int ac, const char **av)
|
||||
bool event_idle(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac == 1)
|
||||
send_cmd(av[0], "IDLE %s %ld 0", source.c_str(), static_cast<long>(Anope::CurTime));
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
send_cmd(params[0], "IDLE %s %ld 0", source.c_str(), static_cast<long>(Anope::CurTime));
|
||||
return true;
|
||||
}
|
||||
|
||||
static Anope::string currentpass;
|
||||
@@ -296,112 +296,105 @@ class InspIRCdProto : public IRCDProto
|
||||
|
||||
} ircd_proto;
|
||||
|
||||
int anope_event_ftopic(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ftopic(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
/* :source FTOPIC channel ts setby :topic */
|
||||
if (ac < 4)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 4)
|
||||
return true;
|
||||
|
||||
Channel *c = findchan(av[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
if (!c)
|
||||
{
|
||||
Log() << "TOPIC for nonexistant channel " << av[0];
|
||||
return MOD_CONT;
|
||||
Log() << "TOPIC for nonexistant channel " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
c->ChangeTopicInternal(av[2], av[3], Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : Anope::CurTime);
|
||||
c->ChangeTopicInternal(params[2], params[3], Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_mode(const Anope::string &source, int ac, const char **av)
|
||||
bool event_mode(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 2)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 2)
|
||||
return true;
|
||||
|
||||
if (*av[0] == '#' || *av[0] == '&')
|
||||
do_cmode(source, ac, av);
|
||||
if (params[0][0] == '#' || params[0][0] == '&')
|
||||
do_cmode(source, params[0], params[1], params[2]);
|
||||
else
|
||||
{
|
||||
/* InspIRCd lets opers change another
|
||||
users modes, we have to kludge this
|
||||
as it slightly breaks RFC1459
|
||||
users modes
|
||||
*/
|
||||
if (source.equals_ci(av[0]))
|
||||
do_umode(source, ac, av);
|
||||
else
|
||||
do_umode(av[0], ac, av);
|
||||
do_umode(source, params[0], params[1]);
|
||||
}
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_opertype(const Anope::string &source, int ac, const char **av)
|
||||
bool event_opertype(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
/* opertype is equivalent to mode +o because servers
|
||||
dont do this directly */
|
||||
User *u;
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (u && !is_oper(u))
|
||||
{
|
||||
const char *newav[2];
|
||||
newav[0] = source.c_str();
|
||||
newav[1] = "+o";
|
||||
return anope_event_mode(source, 2, newav);
|
||||
std::vector<Anope::string> newparams;
|
||||
newparams.push_back(source);
|
||||
newparams.push_back("+o");
|
||||
return event_mode(source, newparams);
|
||||
}
|
||||
else
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_fmode(const Anope::string &source, int ac, const char **av)
|
||||
bool event_fmode(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
const char *newav[128];
|
||||
int n, o;
|
||||
Channel *c;
|
||||
|
||||
/* :source FMODE #test 12345678 +nto foo */
|
||||
if (ac < 3)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 3)
|
||||
return true;
|
||||
|
||||
Channel *c = findchan(params[0]);
|
||||
/* Checking the TS for validity to avoid desyncs */
|
||||
if ((c = findchan(av[0])))
|
||||
if (c)
|
||||
{
|
||||
time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0;
|
||||
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
|
||||
if (c->creation_time > ts)
|
||||
{
|
||||
/* Our TS is bigger, we should lower it */
|
||||
c->creation_time = ts;
|
||||
c->Reset();
|
||||
}
|
||||
else if (c->creation_time < ts)
|
||||
/* The TS we got is bigger, we should ignore this message. */
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
/* Got FMODE for a non-existing channel */
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
|
||||
/* TS's are equal now, so we can proceed with parsing */
|
||||
n = o = 0;
|
||||
while (n < ac)
|
||||
std::vector<Anope::string> newparams;
|
||||
for (unsigned n = 0; n < params.size(); ++n)
|
||||
{
|
||||
if (n != 1)
|
||||
{
|
||||
newav[o] = av[n];
|
||||
++o;
|
||||
Log(LOG_DEBUG) << "Param: " << newav[o - 1];
|
||||
newparams.push_back(params[n]);
|
||||
Log(LOG_DEBUG) << "Param: " << params[n];
|
||||
}
|
||||
++n;
|
||||
}
|
||||
|
||||
return anope_event_mode(source, ac - 1, newav);
|
||||
return event_mode(source, newparams);
|
||||
}
|
||||
|
||||
int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
bool event_fjoin(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = findchan(av[0]);
|
||||
time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0;
|
||||
Channel *c = findchan(params[0]);
|
||||
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
|
||||
bool keep_their_modes = true;
|
||||
|
||||
if (!c)
|
||||
{
|
||||
c = new Channel(av[0], ts);
|
||||
c = new Channel(params[0], ts);
|
||||
c->SetFlag(CH_SYNCING);
|
||||
}
|
||||
/* Our creation time is newer than what the server gave us */
|
||||
@@ -417,7 +410,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
else if (ts > c->creation_time)
|
||||
keep_their_modes = false;
|
||||
|
||||
spacesepstream sep(av[ac - 1]);
|
||||
spacesepstream sep(params[params.size() - 1]);
|
||||
Anope::string buf;
|
||||
while (sep.GetToken(buf))
|
||||
{
|
||||
@@ -481,291 +474,262 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
c->Sync();
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Events */
|
||||
int anope_event_ping(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ping(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
ircdproto->SendPong(Config->ServerName, av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
ircdproto->SendPong(Config->ServerName, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_436(const Anope::string &source, int ac, const char **av)
|
||||
bool event_436(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
|
||||
m_nickcoll(av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
m_nickcoll(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_away(const Anope::string &source, int ac, const char **av)
|
||||
bool event_away(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (source.empty())
|
||||
return MOD_CONT;
|
||||
m_away(source, ac ? av[0] : "");
|
||||
return MOD_CONT;
|
||||
if (!source.empty())
|
||||
m_away(source, !params.empty() ? params[0] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Taken from hybrid.c, topic syntax is identical */
|
||||
|
||||
int anope_event_topic(const Anope::string &source, int ac, const char **av)
|
||||
bool event_topic(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = findchan(av[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
|
||||
if (!c)
|
||||
{
|
||||
Log() << "TOPIC " << merge_args(ac - 1, av + 1) << " for nonexistent channel " << av[0];
|
||||
return MOD_CONT;
|
||||
Log() << "TOPIC " << (params.size() > 1 ? params[1] : "") << " for nonexistent channel " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
c->ChangeTopicInternal(source, (ac > 1 && *av[1] ? av[1] : ""), Anope::CurTime);
|
||||
c->ChangeTopicInternal(source, (params.size() > 1 ? params[1] : ""), Anope::CurTime);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_squit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_squit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
do_squit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
do_squit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_rsquit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_rsquit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1 || ac > 3)
|
||||
return MOD_CONT;
|
||||
if (params.empty() || params.size() > 3)
|
||||
return true;
|
||||
|
||||
/* Horrible workaround to an insp bug (#) in how RSQUITs are sent - mark */
|
||||
if (ac > 1 && Config->ServerName.equals_cs(av[0]))
|
||||
do_squit(source, ac - 1, av + 1);
|
||||
if (params.size() > 1 && Config->ServerName.equals_cs(params[0]))
|
||||
do_squit(source, params[1]);
|
||||
else
|
||||
do_squit(source, ac, av);
|
||||
do_squit(source, params[0]);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_quit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_quit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
do_quit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
do_quit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_kill(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kill(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
|
||||
m_kill(av[0], av[1]);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 1)
|
||||
m_kill(params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_kick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 3)
|
||||
return MOD_CONT;
|
||||
do_kick(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 2)
|
||||
do_kick(source, params[0], params[1], params[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_join(const Anope::string &source, int ac, const char **av)
|
||||
bool event_join(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
do_join(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 1)
|
||||
do_join(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_motd(const Anope::string &source, int ac, const char **av)
|
||||
bool event_motd(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (source.empty())
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
|
||||
m_motd(source);
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_setname(const Anope::string &source, int ac, const char **av)
|
||||
bool event_setname(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.empty())
|
||||
return true;
|
||||
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETNAME for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetRealname(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetRealname(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chgname(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chgname(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.size() < 2)
|
||||
return true;
|
||||
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "FNAME for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetRealname(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetRealname(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_setident(const Anope::string &source, int ac, const char **av)
|
||||
bool event_setident(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (!params.empty())
|
||||
return true;
|
||||
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETIDENT for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetIdent(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetIdent(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chgident(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chgident(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.size() < 2)
|
||||
return true;
|
||||
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(av[0]);
|
||||
User *u = finduser(params[0]);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "CHGIDENT for nonexistent user " << av[0];
|
||||
return MOD_CONT;
|
||||
Log(LOG_DEBUG) << "CHGIDENT for nonexistent user " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetIdent(av[1]);
|
||||
return MOD_CONT;
|
||||
u->SetIdent(params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_sethost(const Anope::string &source, int ac, const char **av)
|
||||
bool event_sethost(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.empty())
|
||||
return true;
|
||||
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETHOST for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetDisplayedHost(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetDisplayedHost(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int anope_event_nick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_nick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *user;
|
||||
|
||||
if (ac != 1)
|
||||
if (params.size() == 8)
|
||||
{
|
||||
if (ac == 8)
|
||||
time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : 0;
|
||||
|
||||
User *user = do_nick("", params[1], params[4], params[2], source, params[7], ts, params[6], params[3], "", params[5]);
|
||||
if (user)
|
||||
{
|
||||
time_t ts = Anope::string(av[0]).is_pos_number_only() ? convertTo<time_t>(av[0]) : 0;
|
||||
user->SetCloakedHost(params[3]);
|
||||
|
||||
user = do_nick("", av[1], av[4], av[2], source, av[7], ts, av[6], av[3], "", av[5]);
|
||||
if (user)
|
||||
NickAlias *na = findnick(user->nick);
|
||||
Anope::string svidbuf;
|
||||
if (na && na->nc->GetExtRegular("authenticationtoken", svidbuf) && svidbuf == params[0])
|
||||
{
|
||||
user->SetCloakedHost(av[3]);
|
||||
|
||||
NickAlias *na = findnick(user->nick);
|
||||
Anope::string svidbuf;
|
||||
if (na && na->nc->GetExtRegular("authenticationtoken", svidbuf) && svidbuf == av[0])
|
||||
{
|
||||
user->Login(na->nc);
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
}
|
||||
else
|
||||
validate_user(user);
|
||||
user->Login(na->nc);
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
}
|
||||
else
|
||||
validate_user(user);
|
||||
}
|
||||
}
|
||||
else
|
||||
do_nick(source, av[0], "", "", "", "", 0, "", "", "", "");
|
||||
return MOD_CONT;
|
||||
else if (params.size() == 1)
|
||||
do_nick(source, params[0], "", "", "", "", 0, "", "", "", "");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int anope_event_chghost(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chghost(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.empty())
|
||||
return true;
|
||||
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "FHOST for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetDisplayedHost(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetDisplayedHost(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT: SERVER */
|
||||
int anope_event_server(const Anope::string &source, int ac, const char **av)
|
||||
bool event_server(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], "");
|
||||
return MOD_CONT;
|
||||
do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[2], "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_privmsg(const Anope::string &source, int ac, const char **av)
|
||||
bool event_privmsg(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
m_privmsg(source, av[0], av[1]);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 1)
|
||||
m_privmsg(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_part(const Anope::string &source, int ac, const char **av)
|
||||
bool event_part(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1 || ac > 2)
|
||||
return MOD_CONT;
|
||||
do_part(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
do_part(source, params[0], params.size() > 1 ? params[1] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_whois(const Anope::string &source, int ac, const char **av)
|
||||
bool event_whois(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!source.empty() && ac >= 1)
|
||||
m_whois(source, av[0]);
|
||||
return MOD_CONT;
|
||||
if (!source.empty() && !params.empty())
|
||||
m_whois(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
bool event_capab(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!strcasecmp(av[0], "START"))
|
||||
if (params[0].equals_cs("START"))
|
||||
{
|
||||
/* reset CAPAB */
|
||||
has_servicesmod = false;
|
||||
@@ -775,24 +739,24 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
has_chgidentmod = false;
|
||||
has_hidechansmod = false;
|
||||
}
|
||||
else if (!strcasecmp(av[0], "MODULES"))
|
||||
else if (params[0].equals_cs("MODULES"))
|
||||
{
|
||||
if (strstr(av[1], "m_globops.so"))
|
||||
if (params[1].find("m_globops.so") != Anope::string::npos)
|
||||
has_globopsmod = true;
|
||||
if (strstr(av[1], "m_services.so"))
|
||||
if (params[1].find("m_services.so") != Anope::string::npos)
|
||||
has_servicesmod = true;
|
||||
if (strstr(av[1], "m_svshold.so"))
|
||||
if (params[1].find("m_svshold.so") != Anope::string::npos)
|
||||
has_svsholdmod = true;
|
||||
if (strstr(av[1], "m_chghost.so"))
|
||||
if (params[1].find("m_chghost.so") != Anope::string::npos)
|
||||
has_chghostmod = true;
|
||||
if (strstr(av[1], "m_chgident.so"))
|
||||
if (params[1].find("m_chgident.so") != Anope::string::npos)
|
||||
has_chgidentmod = true;
|
||||
if (strstr(av[1], "m_hidechans.so"))
|
||||
if (params[1].find("m_hidechans.so") != Anope::string::npos)
|
||||
has_hidechansmod = true;
|
||||
}
|
||||
else if (!strcasecmp(av[0], "CAPABILITIES"))
|
||||
else if (params[0].equals_cs("CAPABILITIES"))
|
||||
{
|
||||
spacesepstream ssep(av[1]);
|
||||
spacesepstream ssep(params[1]);
|
||||
Anope::string capab;
|
||||
while (ssep.GetToken(capab))
|
||||
{
|
||||
@@ -950,14 +914,14 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (capab.find("MAXMODES=") != std::string::npos)
|
||||
else if (capab.find("MAXMODES=") != Anope::string::npos)
|
||||
{
|
||||
Anope::string maxmodes(capab.begin() + 9, capab.end());
|
||||
ircd->maxmodes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(av[0], "END"))
|
||||
else if (params[0].equals_cs("END"))
|
||||
{
|
||||
if (!has_globopsmod)
|
||||
{
|
||||
@@ -989,49 +953,49 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
ircd->svshold = has_svsholdmod;
|
||||
}
|
||||
|
||||
CapabParse(ac, av);
|
||||
return MOD_CONT;
|
||||
CapabParse(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_endburst(const Anope::string &source, int ac, const char **av)
|
||||
bool event_endburst(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Me->GetLinks().front()->Sync(true);
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
void moduleAddIRCDMsgs()
|
||||
{
|
||||
Anope::AddMessage("ENDBURST", anope_event_endburst);
|
||||
Anope::AddMessage("436", anope_event_436);
|
||||
Anope::AddMessage("AWAY", anope_event_away);
|
||||
Anope::AddMessage("JOIN", anope_event_join);
|
||||
Anope::AddMessage("KICK", anope_event_kick);
|
||||
Anope::AddMessage("KILL", anope_event_kill);
|
||||
Anope::AddMessage("MODE", anope_event_mode);
|
||||
Anope::AddMessage("MOTD", anope_event_motd);
|
||||
Anope::AddMessage("NICK", anope_event_nick);
|
||||
Anope::AddMessage("CAPAB", anope_event_capab);
|
||||
Anope::AddMessage("PART", anope_event_part);
|
||||
Anope::AddMessage("PING", anope_event_ping);
|
||||
Anope::AddMessage("PRIVMSG", anope_event_privmsg);
|
||||
Anope::AddMessage("QUIT", anope_event_quit);
|
||||
Anope::AddMessage("SERVER", anope_event_server);
|
||||
Anope::AddMessage("SQUIT", anope_event_squit);
|
||||
Anope::AddMessage("RSQUIT", anope_event_rsquit);
|
||||
Anope::AddMessage("TOPIC", anope_event_topic);
|
||||
Anope::AddMessage("WHOIS", anope_event_whois);
|
||||
Anope::AddMessage("SVSMODE", anope_event_mode);
|
||||
Anope::AddMessage("FHOST", anope_event_chghost);
|
||||
Anope::AddMessage("CHGIDENT", anope_event_chgident);
|
||||
Anope::AddMessage("FNAME", anope_event_chgname);
|
||||
Anope::AddMessage("SETHOST", anope_event_sethost);
|
||||
Anope::AddMessage("SETIDENT", anope_event_setident);
|
||||
Anope::AddMessage("SETNAME", anope_event_setname);
|
||||
Anope::AddMessage("FJOIN", anope_event_fjoin);
|
||||
Anope::AddMessage("FMODE", anope_event_fmode);
|
||||
Anope::AddMessage("FTOPIC", anope_event_ftopic);
|
||||
Anope::AddMessage("OPERTYPE", anope_event_opertype);
|
||||
Anope::AddMessage("IDLE", anope_event_idle);
|
||||
Anope::AddMessage("ENDBURST", event_endburst);
|
||||
Anope::AddMessage("436", event_436);
|
||||
Anope::AddMessage("AWAY", event_away);
|
||||
Anope::AddMessage("JOIN", event_join);
|
||||
Anope::AddMessage("KICK", event_kick);
|
||||
Anope::AddMessage("KILL", event_kill);
|
||||
Anope::AddMessage("MODE", event_mode);
|
||||
Anope::AddMessage("MOTD", event_motd);
|
||||
Anope::AddMessage("NICK", event_nick);
|
||||
Anope::AddMessage("CAPAB", event_capab);
|
||||
Anope::AddMessage("PART", event_part);
|
||||
Anope::AddMessage("PING", event_ping);
|
||||
Anope::AddMessage("PRIVMSG", event_privmsg);
|
||||
Anope::AddMessage("QUIT", event_quit);
|
||||
Anope::AddMessage("SERVER", event_server);
|
||||
Anope::AddMessage("SQUIT", event_squit);
|
||||
Anope::AddMessage("RSQUIT", event_rsquit);
|
||||
Anope::AddMessage("TOPIC", event_topic);
|
||||
Anope::AddMessage("WHOIS", event_whois);
|
||||
Anope::AddMessage("SVSMODE", event_mode);
|
||||
Anope::AddMessage("FHOST", event_chghost);
|
||||
Anope::AddMessage("CHGIDENT", event_chgident);
|
||||
Anope::AddMessage("FNAME", event_chgname);
|
||||
Anope::AddMessage("SETHOST", event_sethost);
|
||||
Anope::AddMessage("SETIDENT", event_setident);
|
||||
Anope::AddMessage("SETNAME", event_setname);
|
||||
Anope::AddMessage("FJOIN", event_fjoin);
|
||||
Anope::AddMessage("FMODE", event_fmode);
|
||||
Anope::AddMessage("FTOPIC", event_ftopic);
|
||||
Anope::AddMessage("OPERTYPE", event_opertype);
|
||||
Anope::AddMessage("IDLE", event_idle);
|
||||
}
|
||||
|
||||
bool ChannelModeFlood::IsValid(const Anope::string &value) const
|
||||
|
||||
+218
-222
@@ -68,12 +68,12 @@ void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost)
|
||||
send_cmd(HostServ ? HostServ->GetUID() : TS6SID, "CHGHOST %s %s", nick.c_str(), vhost.c_str());
|
||||
}
|
||||
|
||||
int anope_event_idle(const Anope::string &source, int ac, const char **av)
|
||||
bool event_idle(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
BotInfo *bi = findbot(av[0]);
|
||||
BotInfo *bi = findbot(params[0]);
|
||||
|
||||
send_cmd(bi ? bi->GetUID() : av[0], "IDLE %s %ld %ld", source.c_str(), static_cast<long>(start_time), bi ? (static_cast<long>(Anope::CurTime - bi->lastmsg)) : 0);
|
||||
return MOD_CONT;
|
||||
send_cmd(bi ? bi->GetUID() : params[0], "IDLE %s %ld %ld", source.c_str(), static_cast<long>(start_time), bi ? (static_cast<long>(Anope::CurTime - bi->lastmsg)) : 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
static Anope::string currentpass;
|
||||
@@ -306,28 +306,28 @@ class InspIRCdProto : public IRCDProto
|
||||
}
|
||||
} ircd_proto;
|
||||
|
||||
int anope_event_ftopic(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ftopic(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
/* :source FTOPIC channel ts setby :topic */
|
||||
if (ac < 4)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 4)
|
||||
return true;
|
||||
|
||||
Channel *c = findchan(av[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
if (!c)
|
||||
{
|
||||
Log(LOG_DEBUG) << "TOPIC " << merge_args(ac - 1, av + 1) << " for nonexistent channel " << av[0];
|
||||
return MOD_CONT;
|
||||
Log(LOG_DEBUG) << "TOPIC " << params[3] << " for nonexistent channel " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
c->ChangeTopicInternal(av[2], av[3], Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : Anope::CurTime);
|
||||
c->ChangeTopicInternal(params[2], params[3], Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_mode(const Anope::string &source, int ac, const char **av)
|
||||
bool event_mode(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (*av[0] == '#' || *av[0] == '&')
|
||||
do_cmode(source, ac, av);
|
||||
if (params[0][0] == '#' || params[0][0] == '&')
|
||||
do_cmode(source, params[0], params[2], params[1]);
|
||||
else
|
||||
{
|
||||
/* InspIRCd lets opers change another
|
||||
@@ -335,7 +335,7 @@ int anope_event_mode(const Anope::string &source, int ac, const char **av)
|
||||
as it slightly breaks RFC1459
|
||||
*/
|
||||
User *u = finduser(source);
|
||||
User *u2 = finduser(av[0]);
|
||||
User *u2 = finduser(params[0]);
|
||||
|
||||
// This can happen with server-origin modes.
|
||||
if (!u)
|
||||
@@ -343,71 +343,68 @@ int anope_event_mode(const Anope::string &source, int ac, const char **av)
|
||||
|
||||
// if it's still null, drop it like fire.
|
||||
// most likely situation was that server introduced a nick which we subsequently akilled
|
||||
if (!u)
|
||||
return MOD_CONT;
|
||||
if (!u || !u2)
|
||||
return true;
|
||||
|
||||
av[0] = u2->nick.c_str();
|
||||
do_umode(u->nick, ac, av);
|
||||
do_umode(u->nick, u2->nick, params[1]);
|
||||
}
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_opertype(const Anope::string &source, int ac, const char **av)
|
||||
bool event_opertype(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
/* opertype is equivalent to mode +o because servers
|
||||
dont do this directly */
|
||||
User *u;
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (u && !is_oper(u))
|
||||
{
|
||||
const char *newav[2];
|
||||
newav[0] = source.c_str();
|
||||
newav[1] = "+o";
|
||||
return anope_event_mode(source, 2, newav);
|
||||
std::vector<Anope::string> newparams;
|
||||
newparams.push_back(source);
|
||||
newparams.push_back(Anope::CurTime);
|
||||
newparams.push_back("+o");
|
||||
return event_mode(source, newparams);
|
||||
}
|
||||
else
|
||||
return MOD_CONT;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_fmode(const Anope::string &source, int ac, const char **av)
|
||||
bool event_fmode(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
const char *newav[128];
|
||||
int n, o;
|
||||
Channel *c;
|
||||
|
||||
/* :source FMODE #test 12345678 +nto foo */
|
||||
if (ac < 3)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 3)
|
||||
return true;
|
||||
|
||||
Channel *c = findchan(params[0]);
|
||||
/* Checking the TS for validity to avoid desyncs */
|
||||
if ((c = findchan(av[0])))
|
||||
if ((c = findchan(params[0])))
|
||||
{
|
||||
time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0;
|
||||
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
|
||||
if (c->creation_time > ts)
|
||||
{
|
||||
/* Our TS is bigger, we should lower it */
|
||||
c->creation_time = ts;
|
||||
c->Reset();
|
||||
}
|
||||
else if (c->creation_time < ts)
|
||||
/* The TS we got is bigger, we should ignore this message. */
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
/* Got FMODE for a non-existing channel */
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
|
||||
/* TS's are equal now, so we can proceed with parsing */
|
||||
n = o = 0;
|
||||
while (n < ac)
|
||||
std::vector<Anope::string> newparams;
|
||||
for (unsigned n = 0; n < params.size(); ++n)
|
||||
{
|
||||
if (n != 1)
|
||||
{
|
||||
newav[o] = av[n];
|
||||
++o;
|
||||
Log(LOG_DEBUG) << "Param: " << newav[o - 1];
|
||||
newparams.push_back(params[n]);
|
||||
Log(LOG_DEBUG) << "Param: " << params[n];
|
||||
}
|
||||
++n;
|
||||
}
|
||||
|
||||
return anope_event_mode(source, ac - 1, newav);
|
||||
return event_mode(source, newparams);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -418,15 +415,15 @@ int anope_event_fmode(const Anope::string &source, int ac, const char **av)
|
||||
* 2: channel modes + params (NOTE: this may definitely be more than one param!)
|
||||
* last: users
|
||||
*/
|
||||
int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
bool event_fjoin(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = findchan(av[0]);
|
||||
time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0;
|
||||
Channel *c = findchan(params[0]);
|
||||
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
|
||||
bool keep_their_modes = true;
|
||||
|
||||
if (!c)
|
||||
{
|
||||
c = new Channel(av[0], ts);
|
||||
c = new Channel(params[0], ts);
|
||||
c->SetFlag(CH_SYNCING);
|
||||
}
|
||||
/* Our creation time is newer than what the server gave us */
|
||||
@@ -443,13 +440,18 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
keep_their_modes = false;
|
||||
|
||||
/* If we need to keep their modes, and this FJOIN string contains modes */
|
||||
if (keep_their_modes && ac >= 4)
|
||||
if (keep_their_modes && params.size() >= 3)
|
||||
{
|
||||
Anope::string modes;
|
||||
for (unsigned i = 2; i < params.size() - 1; ++i)
|
||||
modes += " " + params[i];
|
||||
if (!modes.empty())
|
||||
modes.erase(modes.begin());
|
||||
/* Set the modes internally */
|
||||
ChanSetInternalModes(c, ac - 3, av + 2);
|
||||
c->SetModesInternal(NULL, modes);
|
||||
}
|
||||
|
||||
spacesepstream sep(av[ac - 1]);
|
||||
spacesepstream sep(params[params.size() - 1]);
|
||||
Anope::string buf;
|
||||
while (sep.GetToken(buf))
|
||||
{
|
||||
@@ -512,190 +514,185 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
c->Sync();
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Events */
|
||||
int anope_event_ping(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ping(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac == 1)
|
||||
ircdproto->SendPong("", av[0]);
|
||||
if (params.size() == 1)
|
||||
ircdproto->SendPong("", params[0]);
|
||||
else if (params.size() == 2)
|
||||
ircdproto->SendPong(params[1], params[0]);
|
||||
|
||||
if (ac == 2)
|
||||
ircdproto->SendPong(av[1], av[0]);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_time(const Anope::string &source, int ac, const char **av)
|
||||
bool event_time(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac !=2)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 2)
|
||||
return true;
|
||||
|
||||
send_cmd(TS6SID, "TIME %s %s %ld", source.c_str(), av[1], static_cast<long>(Anope::CurTime));
|
||||
send_cmd(TS6SID, "TIME %s %s %ld", source.c_str(), params[1].c_str(), static_cast<long>(Anope::CurTime));
|
||||
|
||||
/* We handled it, don't pass it on to the core..
|
||||
* The core doesn't understand our syntax anyways.. ~ Viper */
|
||||
return MOD_STOP;
|
||||
}
|
||||
|
||||
int anope_event_436(const Anope::string &source, int ac, const char **av)
|
||||
bool event_436(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
m_nickcoll(av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
m_nickcoll(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_away(const Anope::string &source, int ac, const char **av)
|
||||
bool event_away(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
m_away(source, ac ? av[0] : "");
|
||||
return MOD_CONT;
|
||||
m_away(source, !params.empty() ? params[0] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Taken from hybrid.c, topic syntax is identical */
|
||||
int anope_event_topic(const Anope::string &source, int ac, const char **av)
|
||||
bool event_topic(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = findchan(av[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
|
||||
if (!c)
|
||||
{
|
||||
Log() << "TOPIC " << merge_args(ac - 1, av + 1) << " for nonexistent channel " << av[0];
|
||||
return MOD_CONT;
|
||||
Log() << "TOPIC " << params[1] << " for nonexistent channel " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
c->ChangeTopicInternal(source, (ac > 1 && *av[1] ? av[1] : ""), Anope::CurTime);
|
||||
c->ChangeTopicInternal(source, (params.size() > 1 ? params[1] : ""), Anope::CurTime);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_squit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_squit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_squit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_squit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_rsquit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_rsquit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
/* On InspIRCd we must send a SQUIT when we recieve RSQUIT for a server we have juped */
|
||||
Server *s = Server::Find(av[0]);
|
||||
Server *s = Server::Find(params[0]);
|
||||
if (s && s->HasFlag(SERVER_JUPED))
|
||||
send_cmd(TS6SID, "SQUIT %s :%s", s->GetSID().c_str(), ac > 1 ? av[1] : "");
|
||||
send_cmd(TS6SID, "SQUIT %s :%s", s->GetSID().c_str(), params.size() > 1 ? params[1].c_str() : "");
|
||||
|
||||
do_squit(source, ac, av);
|
||||
do_squit(source, params[0]);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_quit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_quit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_quit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_quit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_kill(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kill(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = finduser(av[0]);
|
||||
BotInfo *bi = findbot(av[0]);
|
||||
m_kill(u ? u->nick : (bi ? bi->nick : av[0]), av[1]);
|
||||
return MOD_CONT;
|
||||
User *u = finduser(params[0]);
|
||||
BotInfo *bi = findbot(params[0]);
|
||||
m_kill(u ? u->nick : (bi ? bi->nick : params[0]), params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_kick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_kick(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 2)
|
||||
do_kick(source, params[0], params[1], params[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_join(const Anope::string &source, int ac, const char **av)
|
||||
bool event_join(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_join(source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_join(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_motd(const Anope::string &source, int ac, const char **av)
|
||||
bool event_motd(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
m_motd(source);
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_setname(const Anope::string &source, int ac, const char **av)
|
||||
bool event_setname(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETNAME for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetRealname(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetRealname(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chgname(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chgname(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
User *u = finduser(source);
|
||||
|
||||
u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "FNAME for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetRealname(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetRealname(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_setident(const Anope::string &source, int ac, const char **av)
|
||||
bool event_setident(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
User *u = finduser(source);
|
||||
|
||||
u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETIDENT for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetIdent(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetIdent(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chgident(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chgident(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
User *u = finduser(params[0]);
|
||||
|
||||
u = finduser(av[0]);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "CHGIDENT for nonexistent user " << av[0];
|
||||
return MOD_CONT;
|
||||
Log(LOG_DEBUG) << "CHGIDENT for nonexistent user " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetIdent(av[1]);
|
||||
return MOD_CONT;
|
||||
u->SetIdent(params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_sethost(const Anope::string &source, int ac, const char **av)
|
||||
bool event_sethost(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
User *u = finduser(source);
|
||||
|
||||
u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETHOST for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetDisplayedHost(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetDisplayedHost(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_nick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_nick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_nick(source, av[0], "", "", "", "", 0, "", "", "", "");
|
||||
return MOD_CONT;
|
||||
do_nick(source, params[0], "", "", "", "", 0, "", "", "", "");
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -712,11 +709,11 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av)
|
||||
* last: realname
|
||||
*/
|
||||
|
||||
int anope_event_uid(const Anope::string &source, int ac, const char **av)
|
||||
bool event_uid(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *user;
|
||||
Server *s = Server::Find(source);
|
||||
int ts = strtoul(av[1], NULL, 10);
|
||||
time_t ts = convertTo<time_t>(params[1]);
|
||||
|
||||
/* Check if the previously introduced user was Id'd for the nickgroup of the nick he s currently using.
|
||||
* If not, validate the user. ~ Viper*/
|
||||
@@ -737,10 +734,10 @@ int anope_event_uid(const Anope::string &source, int ac, const char **av)
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
}
|
||||
|
||||
Anope::string modes = av[8];
|
||||
for (int i = 9; i < ac - 1; ++i)
|
||||
modes += Anope::string(" ") + av[i];
|
||||
user = do_nick("", av[2], av[5], av[3], s->GetName(), av[ac - 1], ts, av[6], av[4], av[0], modes);
|
||||
Anope::string modes = params[8];
|
||||
for (unsigned i = 9; i < params.size() - 1; ++i)
|
||||
modes += " " + params[i];
|
||||
user = do_nick("", params[2], params[5], params[3], s->GetName(), params[params.size() - 1], ts, params[6], params[4], params[0], modes);
|
||||
if (user)
|
||||
{
|
||||
if (!user->server->IsSynced())
|
||||
@@ -749,22 +746,21 @@ int anope_event_uid(const Anope::string &source, int ac, const char **av)
|
||||
validate_user(user);
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chghost(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chghost(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
User *u = finduser(source);
|
||||
|
||||
u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "FHOST for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetDisplayedHost(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetDisplayedHost(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -775,53 +771,53 @@ int anope_event_chghost(const Anope::string &source, int ac, const char **av)
|
||||
* 3: numeric
|
||||
* 4: desc
|
||||
*/
|
||||
int anope_event_server(const Anope::string &source, int ac, const char **av)
|
||||
bool event_server(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_server(source, av[0], Anope::string(av[2]).is_pos_number_only() ? convertTo<unsigned>(av[2]) : 0, av[4], av[3]);
|
||||
return MOD_CONT;
|
||||
do_server(source, params[0], Anope::string(params[2]).is_pos_number_only() ? convertTo<unsigned>(params[2]) : 0, params[4], params[3]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_privmsg(const Anope::string &source, int ac, const char **av)
|
||||
bool event_privmsg(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!finduser(source))
|
||||
return MOD_CONT; // likely a message from a server, which can happen.
|
||||
return true; // likely a message from a server, which can happen.
|
||||
|
||||
m_privmsg(source, av[0], av[1]);
|
||||
return MOD_CONT;
|
||||
m_privmsg(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_part(const Anope::string &source, int ac, const char **av)
|
||||
bool event_part(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_part(source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_part(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_whois(const Anope::string &source, int ac, const char **av)
|
||||
bool event_whois(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
m_whois(source, av[0]);
|
||||
return MOD_CONT;
|
||||
m_whois(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_metadata(const Anope::string &source, int ac, const char **av)
|
||||
bool event_metadata(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 3)
|
||||
return MOD_CONT;
|
||||
else if (!strcmp(av[1], "accountname"))
|
||||
if (params.size() < 3)
|
||||
return true;
|
||||
if (params[1].equals_cs("accountname"))
|
||||
{
|
||||
User *u = finduser(av[0]);
|
||||
NickCore *nc = findcore(av[2]);
|
||||
User *u = finduser(params[0]);
|
||||
NickCore *nc = findcore(params[2]);
|
||||
if (u && nc)
|
||||
{
|
||||
u->Login(nc);
|
||||
}
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
bool event_capab(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!strcasecmp(av[0], "START"))
|
||||
if (params[0].equals_cs("START"))
|
||||
{
|
||||
/* reset CAPAB */
|
||||
has_servicesmod = false;
|
||||
@@ -831,26 +827,26 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
has_chgidentmod = false;
|
||||
has_hidechansmod = false;
|
||||
}
|
||||
else if (!strcasecmp(av[0], "MODULES"))
|
||||
else if (params[0].equals_cs("MODULES"))
|
||||
{
|
||||
if (strstr(av[1], "m_globops.so"))
|
||||
if (params[1].find("m_globops.so") != Anope::string::npos)
|
||||
has_globopsmod = true;
|
||||
if (strstr(av[1], "m_services_account.so"))
|
||||
if (params[1].find("m_services_account.so") != Anope::string::npos)
|
||||
has_servicesmod = true;
|
||||
if (strstr(av[1], "m_svshold.so"))
|
||||
if (params[1].find("m_svshold.so") != Anope::string::npos)
|
||||
has_svsholdmod = true;
|
||||
if (strstr(av[1], "m_chghost.so"))
|
||||
if (params[1].find("m_chghost.so") != Anope::string::npos)
|
||||
has_chghostmod = true;
|
||||
if (strstr(av[1], "m_chgident.so"))
|
||||
if (params[1].find("m_chgident.so") != Anope::string::npos)
|
||||
has_chgidentmod = true;
|
||||
if (strstr(av[1], "m_hidechans.so"))
|
||||
if (params[1].find("m_hidechans.so") != Anope::string::npos)
|
||||
has_hidechansmod = true;
|
||||
if (strstr(av[1], "m_servprotect.so"))
|
||||
if (params[1].find("m_servprotect.so") != Anope::string::npos)
|
||||
ircd->pseudoclient_mode = "+Ik";
|
||||
}
|
||||
else if (!strcasecmp(av[0], "CAPABILITIES"))
|
||||
else if (params[0].equals_cs("CAPABILITIES"))
|
||||
{
|
||||
spacesepstream ssep(av[1]);
|
||||
spacesepstream ssep(params[1]);
|
||||
Anope::string capab;
|
||||
while (ssep.GetToken(capab))
|
||||
{
|
||||
@@ -1116,7 +1112,7 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(av[0], "END"))
|
||||
else if (params[0].equals_cs("END"))
|
||||
{
|
||||
if (!has_globopsmod)
|
||||
{
|
||||
@@ -1148,12 +1144,12 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
ircd->svshold = has_svsholdmod;
|
||||
}
|
||||
|
||||
CapabParse(ac, av);
|
||||
CapabParse(params);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_endburst(const Anope::string &source, int ac, const char **av)
|
||||
bool event_endburst(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = prev_u_intro;
|
||||
Server *s = Server::Find(source);
|
||||
@@ -1182,45 +1178,45 @@ int anope_event_endburst(const Anope::string &source, int ac, const char **av)
|
||||
Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName();
|
||||
|
||||
s->Sync(true);
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
void moduleAddIRCDMsgs()
|
||||
{
|
||||
Anope::AddMessage("ENDBURST", anope_event_endburst);
|
||||
Anope::AddMessage("436", anope_event_436);
|
||||
Anope::AddMessage("AWAY", anope_event_away);
|
||||
Anope::AddMessage("JOIN", anope_event_join);
|
||||
Anope::AddMessage("KICK", anope_event_kick);
|
||||
Anope::AddMessage("KILL", anope_event_kill);
|
||||
Anope::AddMessage("MODE", anope_event_mode);
|
||||
Anope::AddMessage("MOTD", anope_event_motd);
|
||||
Anope::AddMessage("NICK", anope_event_nick);
|
||||
Anope::AddMessage("UID", anope_event_uid);
|
||||
Anope::AddMessage("CAPAB", anope_event_capab);
|
||||
Anope::AddMessage("PART", anope_event_part);
|
||||
Anope::AddMessage("PING", anope_event_ping);
|
||||
Anope::AddMessage("TIME", anope_event_time);
|
||||
Anope::AddMessage("PRIVMSG", anope_event_privmsg);
|
||||
Anope::AddMessage("QUIT", anope_event_quit);
|
||||
Anope::AddMessage("SERVER", anope_event_server);
|
||||
Anope::AddMessage("SQUIT", anope_event_squit);
|
||||
Anope::AddMessage("RSQUIT", anope_event_rsquit);
|
||||
Anope::AddMessage("TOPIC", anope_event_topic);
|
||||
Anope::AddMessage("WHOIS", anope_event_whois);
|
||||
Anope::AddMessage("SVSMODE", anope_event_mode);
|
||||
Anope::AddMessage("FHOST", anope_event_chghost);
|
||||
Anope::AddMessage("CHGIDENT", anope_event_chgident);
|
||||
Anope::AddMessage("FNAME", anope_event_chgname);
|
||||
Anope::AddMessage("SETHOST", anope_event_sethost);
|
||||
Anope::AddMessage("SETIDENT", anope_event_setident);
|
||||
Anope::AddMessage("SETNAME", anope_event_setname);
|
||||
Anope::AddMessage("FJOIN", anope_event_fjoin);
|
||||
Anope::AddMessage("FMODE", anope_event_fmode);
|
||||
Anope::AddMessage("FTOPIC", anope_event_ftopic);
|
||||
Anope::AddMessage("OPERTYPE", anope_event_opertype);
|
||||
Anope::AddMessage("IDLE", anope_event_idle);
|
||||
Anope::AddMessage("METADATA", anope_event_metadata);
|
||||
Anope::AddMessage("ENDBURST", event_endburst);
|
||||
Anope::AddMessage("436", event_436);
|
||||
Anope::AddMessage("AWAY", event_away);
|
||||
Anope::AddMessage("JOIN", event_join);
|
||||
Anope::AddMessage("KICK", event_kick);
|
||||
Anope::AddMessage("KILL", event_kill);
|
||||
Anope::AddMessage("MODE", event_mode);
|
||||
Anope::AddMessage("MOTD", event_motd);
|
||||
Anope::AddMessage("NICK", event_nick);
|
||||
Anope::AddMessage("UID", event_uid);
|
||||
Anope::AddMessage("CAPAB", event_capab);
|
||||
Anope::AddMessage("PART", event_part);
|
||||
Anope::AddMessage("PING", event_ping);
|
||||
Anope::AddMessage("TIME", event_time);
|
||||
Anope::AddMessage("PRIVMSG", event_privmsg);
|
||||
Anope::AddMessage("QUIT", event_quit);
|
||||
Anope::AddMessage("SERVER", event_server);
|
||||
Anope::AddMessage("SQUIT", event_squit);
|
||||
Anope::AddMessage("RSQUIT", event_rsquit);
|
||||
Anope::AddMessage("TOPIC", event_topic);
|
||||
Anope::AddMessage("WHOIS", event_whois);
|
||||
Anope::AddMessage("SVSMODE", event_mode);
|
||||
Anope::AddMessage("FHOST", event_chghost);
|
||||
Anope::AddMessage("CHGIDENT", event_chgident);
|
||||
Anope::AddMessage("FNAME", event_chgname);
|
||||
Anope::AddMessage("SETHOST", event_sethost);
|
||||
Anope::AddMessage("SETIDENT", event_setident);
|
||||
Anope::AddMessage("SETNAME", event_setname);
|
||||
Anope::AddMessage("FJOIN", event_fjoin);
|
||||
Anope::AddMessage("FMODE", event_fmode);
|
||||
Anope::AddMessage("FTOPIC", event_ftopic);
|
||||
Anope::AddMessage("OPERTYPE", event_opertype);
|
||||
Anope::AddMessage("IDLE", event_idle);
|
||||
Anope::AddMessage("METADATA", event_metadata);
|
||||
}
|
||||
|
||||
bool ChannelModeFlood::IsValid(const Anope::string &value) const
|
||||
|
||||
+218
-222
@@ -66,12 +66,12 @@ void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost)
|
||||
send_cmd(HostServ ? HostServ->GetUID() : TS6SID, "CHGHOST %s %s", nick.c_str(), vhost.c_str());
|
||||
}
|
||||
|
||||
int anope_event_idle(const Anope::string &source, int ac, const char **av)
|
||||
bool event_idle(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
BotInfo *bi = findbot(av[0]);
|
||||
BotInfo *bi = findbot(params[0]);
|
||||
|
||||
send_cmd(bi ? bi->GetUID() : av[0], "IDLE %s %ld %ld", source.c_str(), static_cast<long>(start_time), bi ? (static_cast<long>(Anope::CurTime - bi->lastmsg)) : 0);
|
||||
return MOD_CONT;
|
||||
send_cmd(bi ? bi->GetUID() : params[0], "IDLE %s %ld %ld", source.c_str(), static_cast<long>(start_time), bi ? (static_cast<long>(Anope::CurTime - bi->lastmsg)) : 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
static Anope::string currentpass;
|
||||
@@ -304,28 +304,28 @@ class InspIRCdProto : public IRCDProto
|
||||
}
|
||||
} ircd_proto;
|
||||
|
||||
int anope_event_ftopic(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ftopic(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
/* :source FTOPIC channel ts setby :topic */
|
||||
if (ac < 4)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 4)
|
||||
return true;
|
||||
|
||||
Channel *c = findchan(av[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
if (!c)
|
||||
{
|
||||
Log(LOG_DEBUG) << "TOPIC " << merge_args(ac - 1, av + 1) << " for nonexistent channel " << av[0];
|
||||
return MOD_CONT;
|
||||
Log(LOG_DEBUG) << "TOPIC " << params[3] << " for nonexistent channel " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
c->ChangeTopicInternal(av[2], av[3], Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : Anope::CurTime);
|
||||
c->ChangeTopicInternal(params[2], params[3], Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_mode(const Anope::string &source, int ac, const char **av)
|
||||
bool event_mode(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (*av[0] == '#' || *av[0] == '&')
|
||||
do_cmode(source, ac, av);
|
||||
if (params[0][0] == '#' || params[0][0] == '&')
|
||||
do_cmode(source, params[0], params[2], params[1]);
|
||||
else
|
||||
{
|
||||
/* InspIRCd lets opers change another
|
||||
@@ -333,7 +333,7 @@ int anope_event_mode(const Anope::string &source, int ac, const char **av)
|
||||
as it slightly breaks RFC1459
|
||||
*/
|
||||
User *u = finduser(source);
|
||||
User *u2 = finduser(av[0]);
|
||||
User *u2 = finduser(params[0]);
|
||||
|
||||
// This can happen with server-origin modes.
|
||||
if (!u)
|
||||
@@ -341,16 +341,15 @@ int anope_event_mode(const Anope::string &source, int ac, const char **av)
|
||||
|
||||
// if it's still null, drop it like fire.
|
||||
// most likely situation was that server introduced a nick which we subsequently akilled
|
||||
if (!u)
|
||||
return MOD_CONT;
|
||||
if (!u || !u2)
|
||||
return true;
|
||||
|
||||
av[0] = u2->nick.c_str();
|
||||
do_umode(u->nick, ac, av);
|
||||
do_umode(u->nick, u2->nick, params[1]);
|
||||
}
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_opertype(const Anope::string &source, int ac, const char **av)
|
||||
bool event_opertype(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
/* opertype is equivalent to mode +o because servers
|
||||
dont do this directly */
|
||||
@@ -358,54 +357,48 @@ int anope_event_opertype(const Anope::string &source, int ac, const char **av)
|
||||
u = finduser(source);
|
||||
if (u && !is_oper(u))
|
||||
{
|
||||
const char *newav[2];
|
||||
newav[0] = source.c_str();
|
||||
newav[1] = "+o";
|
||||
return anope_event_mode(source, 2, newav);
|
||||
std::vector<Anope::string> newparams;
|
||||
newparams.push_back(source);
|
||||
newparams.push_back(Anope::CurTime);
|
||||
newparams.push_back("+o");
|
||||
return event_mode(source, newparams);
|
||||
}
|
||||
else
|
||||
return MOD_CONT;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_fmode(const Anope::string &source, int ac, const char **av)
|
||||
bool event_fmode(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
const char *newav[128];
|
||||
int n, o;
|
||||
Channel *c;
|
||||
|
||||
/* :source FMODE #test 12345678 +nto foo */
|
||||
if (ac < 3)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 3)
|
||||
return true;
|
||||
|
||||
Channel *c = findchan(params[0]);
|
||||
if (!c)
|
||||
return true;
|
||||
|
||||
/* Checking the TS for validity to avoid desyncs */
|
||||
if ((c = findchan(av[0])))
|
||||
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
|
||||
if (c->creation_time > ts)
|
||||
{
|
||||
time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0;
|
||||
if (c->creation_time > ts)
|
||||
/* Our TS is bigger, we should lower it */
|
||||
c->creation_time = ts;
|
||||
else if (c->creation_time < ts)
|
||||
/* The TS we got is bigger, we should ignore this message. */
|
||||
return MOD_CONT;
|
||||
/* Our TS is bigger, we should lower it */
|
||||
c->creation_time = ts;
|
||||
c->Reset();
|
||||
}
|
||||
else
|
||||
/* Got FMODE for a non-existing channel */
|
||||
return MOD_CONT;
|
||||
else if (c->creation_time < ts)
|
||||
/* The TS we got is bigger, we should ignore this message. */
|
||||
return true;
|
||||
|
||||
/* TS's are equal now, so we can proceed with parsing */
|
||||
n = o = 0;
|
||||
while (n < ac)
|
||||
{
|
||||
if (n != 1)
|
||||
{
|
||||
newav[o] = av[n];
|
||||
++o;
|
||||
Log(LOG_DEBUG) << "Param: " << newav[o - 1];
|
||||
}
|
||||
++n;
|
||||
}
|
||||
std::vector<Anope::string> newparams;
|
||||
newparams.push_back(params[0]);
|
||||
newparams.push_back(params[1]);
|
||||
Anope::string modes = params[2];
|
||||
for (unsigned n = 3; n < params.size(); ++n)
|
||||
modes += " " + params[n];
|
||||
newparams.push_back(modes);
|
||||
|
||||
return anope_event_mode(source, ac - 1, newav);
|
||||
return event_mode(source, newparams);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -416,15 +409,15 @@ int anope_event_fmode(const Anope::string &source, int ac, const char **av)
|
||||
* 2: channel modes + params (NOTE: this may definitely be more than one param!)
|
||||
* last: users
|
||||
*/
|
||||
int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
bool event_fjoin(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = findchan(av[0]);
|
||||
time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0;
|
||||
Channel *c = findchan(params[0]);
|
||||
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
|
||||
bool keep_their_modes = true;
|
||||
|
||||
if (!c)
|
||||
{
|
||||
c = new Channel(av[0], ts);
|
||||
c = new Channel(params[0], ts);
|
||||
c->SetFlag(CH_SYNCING);
|
||||
}
|
||||
/* Our creation time is newer than what the server gave us */
|
||||
@@ -441,13 +434,18 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
keep_their_modes = false;
|
||||
|
||||
/* If we need to keep their modes, and this FJOIN string contains modes */
|
||||
if (keep_their_modes && ac >= 4)
|
||||
if (keep_their_modes && params.size() >= 3)
|
||||
{
|
||||
Anope::string modes;
|
||||
for (unsigned i = 2; i < params.size() - 1; ++i)
|
||||
modes += " " + params[i];
|
||||
if (!modes.empty())
|
||||
modes.erase(modes.begin());
|
||||
/* Set the modes internally */
|
||||
ChanSetInternalModes(c, ac - 3, av + 2);
|
||||
c->SetModesInternal(NULL, modes);
|
||||
}
|
||||
|
||||
spacesepstream sep(av[ac - 1]);
|
||||
spacesepstream sep(params[params.size() - 1]);
|
||||
Anope::string buf;
|
||||
while (sep.GetToken(buf))
|
||||
{
|
||||
@@ -510,112 +508,111 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
c->Sync();
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Events */
|
||||
int anope_event_ping(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ping(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac == 1)
|
||||
ircdproto->SendPong("", av[0]);
|
||||
if (params.size() == 1)
|
||||
ircdproto->SendPong("", params[0]);
|
||||
else if (params.size() == 2)
|
||||
ircdproto->SendPong(params[1], params[0]);
|
||||
|
||||
if (ac == 2)
|
||||
ircdproto->SendPong(av[1], av[0]);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_time(const Anope::string &source, int ac, const char **av)
|
||||
bool event_time(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac !=2)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 2)
|
||||
return true;
|
||||
|
||||
send_cmd(TS6SID, "TIME %s %s %ld", source.c_str(), av[1], static_cast<long>(Anope::CurTime));
|
||||
send_cmd(TS6SID, "TIME %s %s %ld", source.c_str(), params[1].c_str(), static_cast<long>(Anope::CurTime));
|
||||
|
||||
/* We handled it, don't pass it on to the core..
|
||||
* The core doesn't understand our syntax anyways.. ~ Viper */
|
||||
return MOD_STOP;
|
||||
}
|
||||
|
||||
int anope_event_436(const Anope::string &source, int ac, const char **av)
|
||||
bool event_436(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
m_nickcoll(av[0]);
|
||||
return MOD_CONT;
|
||||
m_nickcoll(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_away(const Anope::string &source, int ac, const char **av)
|
||||
bool event_away(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
m_away(source, ac ? av[0] : "");
|
||||
return MOD_CONT;
|
||||
m_away(source, !params.empty() ? params[0] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Taken from hybrid.c, topic syntax is identical */
|
||||
int anope_event_topic(const Anope::string &source, int ac, const char **av)
|
||||
bool event_topic(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = findchan(av[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
|
||||
if (!c)
|
||||
{
|
||||
Log() << "TOPIC " << merge_args(ac - 1, av + 1) << " for nonexistent channel " << av[0];
|
||||
return MOD_CONT;
|
||||
Log() << "TOPIC " << (params.size() > 1 ? params[1] : "") << " for nonexistent channel " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
c->ChangeTopicInternal(source, (ac > 1 && *av[1] ? av[1] : ""), Anope::CurTime);
|
||||
c->ChangeTopicInternal(source, (params.size() > 1 ? params[1] : ""), Anope::CurTime);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_squit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_squit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_squit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_squit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_rsquit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_rsquit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
/* On InspIRCd we must send a SQUIT when we recieve RSQUIT for a server we have juped */
|
||||
Server *s = Server::Find(av[0]);
|
||||
Server *s = Server::Find(params[0]);
|
||||
if (s && s->HasFlag(SERVER_JUPED))
|
||||
send_cmd(TS6SID, "SQUIT %s :%s", s->GetSID().c_str(), ac > 1 ? av[1] : "");
|
||||
send_cmd(TS6SID, "SQUIT %s :%s", s->GetSID().c_str(), params.size() > 1 ? params[1].c_str() : "");
|
||||
|
||||
do_squit(source, ac, av);
|
||||
do_squit(source, params[0]);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_quit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_quit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_quit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_quit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_kill(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kill(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = finduser(av[0]);
|
||||
BotInfo *bi = findbot(av[0]);
|
||||
m_kill(u ? u->nick : (bi ? bi->nick : av[0]), av[1]);
|
||||
return MOD_CONT;
|
||||
User *u = finduser(params[0]);
|
||||
BotInfo *bi = findbot(params[0]);
|
||||
m_kill(u ? u->nick : (bi ? bi->nick : params[0]), params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_kick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_kick(source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_kick(source, params[0], params[1], params[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_join(const Anope::string &source, int ac, const char **av)
|
||||
bool event_join(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_join(source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_join(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_motd(const Anope::string &source, int ac, const char **av)
|
||||
bool event_motd(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
m_motd(source);
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_setname(const Anope::string &source, int ac, const char **av)
|
||||
bool event_setname(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
|
||||
@@ -623,14 +620,14 @@ int anope_event_setname(const Anope::string &source, int ac, const char **av)
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETNAME for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetRealname(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetRealname(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chgname(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chgname(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
|
||||
@@ -638,14 +635,14 @@ int anope_event_chgname(const Anope::string &source, int ac, const char **av)
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "FNAME for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetRealname(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetRealname(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_setident(const Anope::string &source, int ac, const char **av)
|
||||
bool event_setident(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
|
||||
@@ -653,28 +650,28 @@ int anope_event_setident(const Anope::string &source, int ac, const char **av)
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETIDENT for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetIdent(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetIdent(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chgident(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chgident(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = finduser(source);
|
||||
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "FIDENT for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetIdent(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetIdent(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_sethost(const Anope::string &source, int ac, const char **av)
|
||||
bool event_sethost(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
|
||||
@@ -682,17 +679,17 @@ int anope_event_sethost(const Anope::string &source, int ac, const char **av)
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETHOST for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetDisplayedHost(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetDisplayedHost(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_nick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_nick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_nick(source, av[0], "", "", "", "", 0, "", "", "", "");
|
||||
return MOD_CONT;
|
||||
do_nick(source, params[0], "", "", "", "", 0, "", "", "", "");
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -709,11 +706,11 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av)
|
||||
* last: realname
|
||||
*/
|
||||
|
||||
int anope_event_uid(const Anope::string &source, int ac, const char **av)
|
||||
bool event_uid(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *user;
|
||||
Server *s = Server::Find(source);
|
||||
time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0;
|
||||
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
|
||||
|
||||
/* Check if the previously introduced user was Id'd for the nickgroup of the nick he s currently using.
|
||||
* If not, validate the user. ~ Viper*/
|
||||
@@ -734,10 +731,10 @@ int anope_event_uid(const Anope::string &source, int ac, const char **av)
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
}
|
||||
|
||||
Anope::string modes = av[8];
|
||||
for (int i = 9; i < ac - 1; ++i)
|
||||
modes += Anope::string(" ") + av[i];
|
||||
user = do_nick("", av[2], av[5], av[3], s->GetName(), av[ac - 1], ts, av[6], av[4], av[0], modes);
|
||||
Anope::string modes = params[8];
|
||||
for (unsigned i = 9; i < params.size() - 1; ++i)
|
||||
modes += Anope::string(" ") + params[i];
|
||||
user = do_nick("", params[2], params[5], params[3], s->GetName(), params[params.size() - 1], ts, params[6], params[4], params[0], modes);
|
||||
if (user)
|
||||
{
|
||||
if (!user->server->IsSynced())
|
||||
@@ -746,22 +743,20 @@ int anope_event_uid(const Anope::string &source, int ac, const char **av)
|
||||
validate_user(user);
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chghost(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chghost(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "FHOST for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetDisplayedHost(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetDisplayedHost(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -772,55 +767,56 @@ int anope_event_chghost(const Anope::string &source, int ac, const char **av)
|
||||
* 3: numeric
|
||||
* 4: desc
|
||||
*/
|
||||
int anope_event_server(const Anope::string &source, int ac, const char **av)
|
||||
bool event_server(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_server(source, av[0], Anope::string(av[2]).is_pos_number_only() ? convertTo<unsigned>(av[2]) : 0, av[4], av[3]);
|
||||
return MOD_CONT;
|
||||
do_server(source, params[0], Anope::string(params[2]).is_pos_number_only() ? convertTo<unsigned>(params[2]) : 0, params[4], params[3]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_privmsg(const Anope::string &source, int ac, const char **av)
|
||||
bool event_privmsg(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!finduser(source))
|
||||
return MOD_CONT; // likely a message from a server, which can happen.
|
||||
return true; // likely a message from a server, which can happen.
|
||||
|
||||
m_privmsg(source, av[0], av[1]);
|
||||
return MOD_CONT;
|
||||
m_privmsg(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_part(const Anope::string &source, int ac, const char **av)
|
||||
bool event_part(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
do_part(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
do_part(source, params[0], params.size() > 1 ? params[1] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_whois(const Anope::string &source, int ac, const char **av)
|
||||
bool event_whois(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
m_whois(source, av[0]);
|
||||
return MOD_CONT;
|
||||
m_whois(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_metadata(const Anope::string &source, int ac, const char **av)
|
||||
bool event_metadata(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 3)
|
||||
return MOD_CONT;
|
||||
else if (!strcmp(av[1], "accountname"))
|
||||
if (params.size() < 3)
|
||||
return true;
|
||||
else if (params[1].equals_cs("accountname"))
|
||||
{
|
||||
User *u = finduser(av[0]);
|
||||
NickCore *nc = findcore(av[2]);
|
||||
User *u = finduser(params[0]);
|
||||
NickCore *nc = findcore(params[2]);
|
||||
if (u && nc)
|
||||
{
|
||||
u->Login(nc);
|
||||
}
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
bool event_capab(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!strcasecmp(av[0], "START"))
|
||||
if (params[0].equals_cs("START"))
|
||||
{
|
||||
if (ac < 2 || (Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]): 0) < 1202)
|
||||
if (params.size() < 2 || (Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]): 0) < 1202)
|
||||
{
|
||||
send_cmd("", "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START");
|
||||
quitmsg = "Protocol mismatch, no or invalid protocol version given in CAPAB START";
|
||||
@@ -834,9 +830,9 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
has_chghostmod = false;
|
||||
has_chgidentmod = false;
|
||||
}
|
||||
else if (!strcasecmp(av[0], "CHANMODES"))
|
||||
else if (params[0].equals_cs("CHANMODES"))
|
||||
{
|
||||
spacesepstream ssep(av[1]);
|
||||
spacesepstream ssep(params[1]);
|
||||
Anope::string capab;
|
||||
|
||||
while (ssep.GetToken(capab))
|
||||
@@ -945,9 +941,9 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
Log() << "Unrecognized mode string in CAPAB CHANMODES: " << capab;
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(av[0], "USERMODES"))
|
||||
if (params[0].equals_cs("USERMODES"))
|
||||
{
|
||||
spacesepstream ssep(av[1]);
|
||||
spacesepstream ssep(params[1]);
|
||||
Anope::string capab;
|
||||
|
||||
while (ssep.GetToken(capab))
|
||||
@@ -1001,18 +997,18 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
Log() << "Unrecognized mode string in CAPAB USERMODES: " << capab;
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(av[0], "MODULES"))
|
||||
else if (params[0].equals_cs("MODULES"))
|
||||
{
|
||||
spacesepstream ssep(av[1]);
|
||||
spacesepstream ssep(params[1]);
|
||||
Anope::string module;
|
||||
|
||||
while (ssep.GetToken(module))
|
||||
if (module.equals_cs("m_svshold.so"))
|
||||
has_svsholdmod = true;
|
||||
}
|
||||
else if (!strcasecmp(av[0], "MODSUPPORT"))
|
||||
else if (params[0].equals_cs("MODSUPPORT"))
|
||||
{
|
||||
spacesepstream ssep(av[1]);
|
||||
spacesepstream ssep(params[1]);
|
||||
Anope::string module;
|
||||
|
||||
while (ssep.GetToken(module))
|
||||
@@ -1027,9 +1023,9 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
ircd->pseudoclient_mode = "+Ik";
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(av[0], "CAPABILITIES"))
|
||||
else if (params[0].equals_cs("CAPABILITIES"))
|
||||
{
|
||||
spacesepstream ssep(av[1]);
|
||||
spacesepstream ssep(params[1]);
|
||||
Anope::string capab;
|
||||
while (ssep.GetToken(capab))
|
||||
{
|
||||
@@ -1096,7 +1092,7 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(av[0], "END"))
|
||||
else if (params[0].equals_cs("END"))
|
||||
{
|
||||
if (!has_servicesmod)
|
||||
{
|
||||
@@ -1121,12 +1117,12 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
ircd->svshold = has_svsholdmod;
|
||||
}
|
||||
|
||||
CapabParse(ac, av);
|
||||
CapabParse(params);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_endburst(const Anope::string &source, int ac, const char **av)
|
||||
bool event_endburst(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = prev_u_intro;
|
||||
Server *s = Server::Find(source);
|
||||
@@ -1155,45 +1151,45 @@ int anope_event_endburst(const Anope::string &source, int ac, const char **av)
|
||||
Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName();
|
||||
|
||||
s->Sync(true);
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
void moduleAddIRCDMsgs()
|
||||
{
|
||||
Anope::AddMessage("ENDBURST", anope_event_endburst);
|
||||
Anope::AddMessage("436", anope_event_436);
|
||||
Anope::AddMessage("AWAY", anope_event_away);
|
||||
Anope::AddMessage("JOIN", anope_event_join);
|
||||
Anope::AddMessage("KICK", anope_event_kick);
|
||||
Anope::AddMessage("KILL", anope_event_kill);
|
||||
Anope::AddMessage("MODE", anope_event_mode);
|
||||
Anope::AddMessage("MOTD", anope_event_motd);
|
||||
Anope::AddMessage("NICK", anope_event_nick);
|
||||
Anope::AddMessage("UID", anope_event_uid);
|
||||
Anope::AddMessage("CAPAB", anope_event_capab);
|
||||
Anope::AddMessage("PART", anope_event_part);
|
||||
Anope::AddMessage("PING", anope_event_ping);
|
||||
Anope::AddMessage("TIME", anope_event_time);
|
||||
Anope::AddMessage("PRIVMSG", anope_event_privmsg);
|
||||
Anope::AddMessage("QUIT", anope_event_quit);
|
||||
Anope::AddMessage("SERVER", anope_event_server);
|
||||
Anope::AddMessage("SQUIT", anope_event_squit);
|
||||
Anope::AddMessage("RSQUIT", anope_event_rsquit);
|
||||
Anope::AddMessage("TOPIC", anope_event_topic);
|
||||
Anope::AddMessage("WHOIS", anope_event_whois);
|
||||
Anope::AddMessage("SVSMODE", anope_event_mode);
|
||||
Anope::AddMessage("FHOST", anope_event_chghost);
|
||||
Anope::AddMessage("FIDENT", anope_event_chgident);
|
||||
Anope::AddMessage("FNAME", anope_event_chgname);
|
||||
Anope::AddMessage("SETHOST", anope_event_sethost);
|
||||
Anope::AddMessage("SETIDENT", anope_event_setident);
|
||||
Anope::AddMessage("SETNAME", anope_event_setname);
|
||||
Anope::AddMessage("FJOIN", anope_event_fjoin);
|
||||
Anope::AddMessage("FMODE", anope_event_fmode);
|
||||
Anope::AddMessage("FTOPIC", anope_event_ftopic);
|
||||
Anope::AddMessage("OPERTYPE", anope_event_opertype);
|
||||
Anope::AddMessage("IDLE", anope_event_idle);
|
||||
Anope::AddMessage("METADATA", anope_event_metadata);
|
||||
Anope::AddMessage("ENDBURST", event_endburst);
|
||||
Anope::AddMessage("436", event_436);
|
||||
Anope::AddMessage("AWAY", event_away);
|
||||
Anope::AddMessage("JOIN", event_join);
|
||||
Anope::AddMessage("KICK", event_kick);
|
||||
Anope::AddMessage("KILL", event_kill);
|
||||
Anope::AddMessage("MODE", event_mode);
|
||||
Anope::AddMessage("MOTD", event_motd);
|
||||
Anope::AddMessage("NICK", event_nick);
|
||||
Anope::AddMessage("UID", event_uid);
|
||||
Anope::AddMessage("CAPAB", event_capab);
|
||||
Anope::AddMessage("PART", event_part);
|
||||
Anope::AddMessage("PING", event_ping);
|
||||
Anope::AddMessage("TIME", event_time);
|
||||
Anope::AddMessage("PRIVMSG", event_privmsg);
|
||||
Anope::AddMessage("QUIT", event_quit);
|
||||
Anope::AddMessage("SERVER", event_server);
|
||||
Anope::AddMessage("SQUIT", event_squit);
|
||||
Anope::AddMessage("RSQUIT", event_rsquit);
|
||||
Anope::AddMessage("TOPIC", event_topic);
|
||||
Anope::AddMessage("WHOIS", event_whois);
|
||||
Anope::AddMessage("SVSMODE", event_mode);
|
||||
Anope::AddMessage("FHOST", event_chghost);
|
||||
Anope::AddMessage("FIDENT", event_chgident);
|
||||
Anope::AddMessage("FNAME", event_chgname);
|
||||
Anope::AddMessage("SETHOST", event_sethost);
|
||||
Anope::AddMessage("SETIDENT", event_setident);
|
||||
Anope::AddMessage("SETNAME", event_setname);
|
||||
Anope::AddMessage("FJOIN", event_fjoin);
|
||||
Anope::AddMessage("FMODE", event_fmode);
|
||||
Anope::AddMessage("FTOPIC", event_ftopic);
|
||||
Anope::AddMessage("OPERTYPE", event_opertype);
|
||||
Anope::AddMessage("IDLE", event_idle);
|
||||
Anope::AddMessage("METADATA", event_metadata);
|
||||
}
|
||||
|
||||
bool ChannelModeFlood::IsValid(const Anope::string &value) const
|
||||
|
||||
+176
-200
@@ -276,15 +276,15 @@ class RatboxProto : public IRCDProto
|
||||
}
|
||||
} ircd_proto;
|
||||
|
||||
int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
bool event_sjoin(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = findchan(av[1]);
|
||||
time_t ts = Anope::string(av[0]).is_pos_number_only() ? convertTo<time_t>(av[0]) : 0;
|
||||
Channel *c = findchan(params[1]);
|
||||
time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : 0;
|
||||
bool keep_their_modes = true;
|
||||
|
||||
if (!c)
|
||||
{
|
||||
c = new Channel(av[1], ts);
|
||||
c = new Channel(params[1], ts);
|
||||
c->SetFlag(CH_SYNCING);
|
||||
}
|
||||
/* Our creation time is newer than what the server gave us */
|
||||
@@ -301,13 +301,18 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
keep_their_modes = false;
|
||||
|
||||
/* If we need to keep their modes, and this SJOIN string contains modes */
|
||||
if (keep_their_modes && ac >= 4)
|
||||
if (keep_their_modes && params.size() >= 3)
|
||||
{
|
||||
Anope::string modes;
|
||||
for (unsigned i = 2; i < params.size() - 1; ++i)
|
||||
modes += " " + params[i];
|
||||
if (!modes.empty())
|
||||
modes.erase(modes.begin());
|
||||
/* Set the modes internally */
|
||||
ChanSetInternalModes(c, ac - 3, av + 2);
|
||||
c->SetModesInternal(NULL, modes);
|
||||
}
|
||||
|
||||
spacesepstream sep(av[ac - 1]);
|
||||
spacesepstream sep(params[params.size() - 1]);
|
||||
Anope::string buf;
|
||||
while (sep.GetToken(buf))
|
||||
{
|
||||
@@ -369,47 +374,45 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
c->Sync();
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Non TS6
|
||||
|
||||
av[0] = nick
|
||||
av[1] = hop
|
||||
av[2] = ts
|
||||
av[3] = modes
|
||||
av[4] = user
|
||||
av[5] = host
|
||||
av[6] = server
|
||||
av[7] = info
|
||||
params[0] = nick
|
||||
params[1] = hop
|
||||
params[2] = ts
|
||||
params[3] = modes
|
||||
params[4] = user
|
||||
params[5] = host
|
||||
params[6] = server
|
||||
params[7] = info
|
||||
|
||||
TS6
|
||||
av[0] = nick
|
||||
av[1] = hop
|
||||
av[2] = ts
|
||||
av[3] = modes
|
||||
av[4] = user
|
||||
av[5] = host
|
||||
av[6] = IP
|
||||
av[7] = UID
|
||||
av[8] = info
|
||||
params[0] = nick
|
||||
params[1] = hop
|
||||
params[2] = ts
|
||||
params[3] = modes
|
||||
params[4] = user
|
||||
params[5] = host
|
||||
params[6] = IP
|
||||
params[7] = UID
|
||||
params[8] = info
|
||||
|
||||
*/
|
||||
int anope_event_nick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_nick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *user;
|
||||
|
||||
if (ac == 9)
|
||||
if (params.size() == 9)
|
||||
{
|
||||
Server *s = Server::Find(source);
|
||||
/* Source is always the server */
|
||||
user = do_nick("", av[0], av[4], av[5], s->GetName(), av[8], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : 0, av[6], "*", av[7], av[3]);
|
||||
User *user = do_nick("", params[0], params[4], params[5], s->GetName(), params[8], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[6], "*", params[7], params[3]);
|
||||
if (user)
|
||||
{
|
||||
NickAlias *na = findnick(user->nick);
|
||||
Anope::string svidbuf;
|
||||
if (na && na->nc->GetExtRegular("authenticationtoken", svidbuf) && svidbuf == av[2])
|
||||
if (na && na->nc->GetExtRegular("authenticationtoken", svidbuf) && svidbuf == params[2])
|
||||
{
|
||||
user->Login(na->nc);
|
||||
}
|
||||
@@ -417,298 +420,271 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av)
|
||||
validate_user(user);
|
||||
}
|
||||
}
|
||||
else if (ac == 2)
|
||||
do_nick(source, av[0], "", "", "", "", Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0, "", "", "", "");
|
||||
return MOD_CONT;
|
||||
else if (params.size() == 2)
|
||||
do_nick(source, params[0], "", "", "", "", Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0, "", "", "", "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_topic(const Anope::string &source, int ac, const char **av)
|
||||
bool event_topic(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = findchan(av[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
if (!c)
|
||||
{
|
||||
Log() << "TOPIC for nonexistant channel " << av[0];
|
||||
return MOD_CONT;
|
||||
Log() << "TOPIC for nonexistant channel " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ac == 4)
|
||||
if (params.size() == 4)
|
||||
{
|
||||
c->ChangeTopicInternal(av[1], av[3], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : Anope::CurTime);
|
||||
c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
c->ChangeTopicInternal(source, (ac > 1 && *av[1] ? av[1] : ""));
|
||||
c->ChangeTopicInternal(source, (params.size() > 1 ? params[1] : ""));
|
||||
}
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_tburst(const Anope::string &source, int ac, const char **av)
|
||||
bool event_tburst(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 4)
|
||||
return MOD_CONT;
|
||||
if (params.size() != 4)
|
||||
return true;
|
||||
|
||||
Anope::string setter = myStrGetToken(av[2], '!', 0);
|
||||
time_t topic_time = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : Anope::CurTime;
|
||||
Channel *c = findchan(av[0]);
|
||||
Anope::string setter = myStrGetToken(params[2], '!', 0);
|
||||
time_t topic_time = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime;
|
||||
Channel *c = findchan(params[0]);
|
||||
|
||||
if (!c)
|
||||
{
|
||||
Log() << "TOPIC " << merge_args(ac - 1, av + 1) << " for nonexistent channel " << av[0];
|
||||
return MOD_CONT;
|
||||
Log() << "TOPIC " << params[3] << " for nonexistent channel " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
c->ChangeTopicInternal(setter, ac > 3 && *av[3] ? av[3] : "", topic_time);
|
||||
c->ChangeTopicInternal(setter, params.size() > 3 ? params[3] : "", topic_time);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_436(const Anope::string &source, int ac, const char **av)
|
||||
bool event_436(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 1)
|
||||
return true;
|
||||
|
||||
m_nickcoll(av[0]);
|
||||
return MOD_CONT;
|
||||
m_nickcoll(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_ping(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ping(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
ircdproto->SendPong(ac > 1 ? av[1] : Config->ServerName, av[0]);
|
||||
return MOD_CONT;
|
||||
if (params.size() < 1)
|
||||
return true;
|
||||
ircdproto->SendPong(params.size() > 1 ? params[1] : Config->ServerName, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_away(const Anope::string &source, int ac, const char **av)
|
||||
bool event_away(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = NULL;
|
||||
|
||||
u = finduser(source);
|
||||
m_away(u ? u->nick : source, ac ? av[0] : "");
|
||||
return MOD_CONT;
|
||||
User *u = finduser(source);
|
||||
m_away(u ? u->nick : source, !params.empty() ? params[0] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_kill(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kill(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
|
||||
m_kill(av[0], av[1]);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 1)
|
||||
m_kill(params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_kick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 3)
|
||||
return MOD_CONT;
|
||||
do_kick(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 2)
|
||||
do_kick(source, params[0], params[1], params[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_join(const Anope::string &source, int ac, const char **av)
|
||||
bool event_join(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 1)
|
||||
{
|
||||
anope_event_sjoin(source, ac, av);
|
||||
return MOD_CONT;
|
||||
}
|
||||
if (params.size() != 1)
|
||||
event_sjoin(source, params);
|
||||
else
|
||||
do_join(source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_join(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_motd(const Anope::string &source, int ac, const char **av)
|
||||
bool event_motd(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (source.empty())
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
|
||||
m_motd(source);
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_privmsg(const Anope::string &source, int ac, const char **av)
|
||||
bool event_privmsg(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
|
||||
// XXX: this is really the same as charybdis
|
||||
m_privmsg(source, av[0], av[1]);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 1)
|
||||
m_privmsg(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_part(const Anope::string &source, int ac, const char **av)
|
||||
bool event_part(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (!params.empty())
|
||||
do_part(source, params[0], params.size() > 1 ? params[1] : "");
|
||||
|
||||
if (ac < 1 || ac > 2)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(source);
|
||||
do_part(u ? u->nick : source, ac, av);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_whois(const Anope::string &source, int ac, const char **av)
|
||||
bool event_whois(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!source.empty() && ac >= 1)
|
||||
if (!source.empty() && !params.empty())
|
||||
{
|
||||
BotInfo *bi = findbot(av[0]);
|
||||
m_whois(source, bi->GetUID());
|
||||
m_whois(source, params[0]);
|
||||
}
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT: SERVER */
|
||||
int anope_event_server(const Anope::string &source, int ac, const char **av)
|
||||
bool event_server(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!stricmp(av[1], "1"))
|
||||
do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], TS6UPLINK);
|
||||
if (params[1].equals_cs("1"))
|
||||
do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[2], TS6UPLINK);
|
||||
else
|
||||
do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], "");
|
||||
return MOD_CONT;
|
||||
do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[2], "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_sid(const Anope::string &source, int ac, const char **av)
|
||||
bool event_sid(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
/* :42X SID trystan.nomadirc.net 2 43X :ircd-ratbox test server */
|
||||
Server *s = Server::Find(source);
|
||||
|
||||
do_server(s->GetName(), av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[3], av[2]);
|
||||
return MOD_CONT;
|
||||
do_server(s->GetName(), params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[3], params[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_squit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_squit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
|
||||
do_squit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
do_squit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_quit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_quit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
User *u = finduser(source);
|
||||
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(source);
|
||||
|
||||
do_quit(u ? u->nick : source, ac, av);
|
||||
return MOD_CONT;
|
||||
do_quit(u ? u->nick : source, !params.empty() ? params[0] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_mode(const Anope::string &source, int ac, const char **av)
|
||||
bool event_mode(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u, *u2;
|
||||
if (params.size() < 2)
|
||||
return true;
|
||||
|
||||
if (ac < 2)
|
||||
return MOD_CONT;
|
||||
|
||||
if (*av[0] == '#' || *av[0] == '&')
|
||||
do_cmode(source, ac, av);
|
||||
if (params[0][0] == '#' || params[0][0] == '&')
|
||||
do_cmode(source, params[0], params[2], params[1]);
|
||||
else
|
||||
{
|
||||
u = finduser(source);
|
||||
u2 = finduser(av[0]);
|
||||
av[0] = u2->nick.c_str();
|
||||
do_umode(u->nick, ac, av);
|
||||
User *u = finduser(source);
|
||||
User *u2 = finduser(params[0]);
|
||||
if (!u || !u2)
|
||||
return true;
|
||||
do_umode(u->nick, u2->nick, params[1]);
|
||||
}
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_tmode(const Anope::string &source, int ac, const char **av)
|
||||
bool event_tmode(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (*av[1] == '#' || *av[1] == '&')
|
||||
do_cmode(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params[1][0] == '#' || params[1][0] == '&')
|
||||
do_cmode(source, params[0], params[1], params[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Event: PROTOCTL */
|
||||
int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
bool event_capab(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
CapabParse(ac, av);
|
||||
return MOD_CONT;
|
||||
CapabParse(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_pass(const Anope::string &source, int ac, const char **av)
|
||||
bool event_pass(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
TS6UPLINK = av[3];
|
||||
return MOD_CONT;
|
||||
TS6UPLINK = params[3];
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_bmask(const Anope::string &source, int ac, const char **av)
|
||||
bool event_bmask(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c;
|
||||
ChannelModeList *cms;
|
||||
|
||||
/* :42X BMASK 1106409026 #ircops b :*!*@*.aol.com */
|
||||
/* 0 1 2 3 */
|
||||
c = findchan(av[1]);
|
||||
Channel *c = findchan(params[1]);
|
||||
|
||||
if (c)
|
||||
{
|
||||
Anope::string bans = av[3];
|
||||
Anope::string bans = params[3];
|
||||
int count = myNumToken(bans, ' '), i;
|
||||
for (i = 0; i <= count - 1; ++i)
|
||||
{
|
||||
Anope::string b = myStrGetToken(bans, ' ', i);
|
||||
if (!stricmp(av[2], "b"))
|
||||
if (params[2].equals_cs("b"))
|
||||
{
|
||||
cms = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('b'));
|
||||
cms->AddMask(c, b);
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('b'));
|
||||
cml->AddMask(c, b);
|
||||
}
|
||||
if (!stricmp(av[2], "e"))
|
||||
else if (params[2].equals_cs("e"))
|
||||
{
|
||||
cms = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('e'));
|
||||
cms->AddMask(c, b);
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('e'));
|
||||
cml->AddMask(c, b);
|
||||
}
|
||||
if (!stricmp(av[2], "I"))
|
||||
if (params[2].equals_cs("I"))
|
||||
{
|
||||
cms = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('I'));
|
||||
cms->AddMask(c, b);
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('I'));
|
||||
cml->AddMask(c, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_error(const Anope::string &source, int ac, const char **av)
|
||||
bool event_error(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac >= 1)
|
||||
Log(LOG_DEBUG) << av[0];
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
Log(LOG_DEBUG) << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
void moduleAddIRCDMsgs()
|
||||
{
|
||||
Anope::AddMessage("436", anope_event_436);
|
||||
Anope::AddMessage("AWAY", anope_event_away);
|
||||
Anope::AddMessage("JOIN", anope_event_join);
|
||||
Anope::AddMessage("KICK", anope_event_kick);
|
||||
Anope::AddMessage("KILL", anope_event_kill);
|
||||
Anope::AddMessage("MODE", anope_event_mode);
|
||||
Anope::AddMessage("TMODE", anope_event_tmode);
|
||||
Anope::AddMessage("MOTD", anope_event_motd);
|
||||
Anope::AddMessage("NICK", anope_event_nick);
|
||||
Anope::AddMessage("BMASK", anope_event_bmask);
|
||||
Anope::AddMessage("UID", anope_event_nick);
|
||||
Anope::AddMessage("PART", anope_event_part);
|
||||
Anope::AddMessage("PASS", anope_event_pass);
|
||||
Anope::AddMessage("PING", anope_event_ping);
|
||||
Anope::AddMessage("PRIVMSG", anope_event_privmsg);
|
||||
Anope::AddMessage("QUIT", anope_event_quit);
|
||||
Anope::AddMessage("SERVER", anope_event_server);
|
||||
Anope::AddMessage("SQUIT", anope_event_squit);
|
||||
Anope::AddMessage("TOPIC", anope_event_topic);
|
||||
Anope::AddMessage("TB", anope_event_tburst);
|
||||
Anope::AddMessage("WHOIS", anope_event_whois);
|
||||
Anope::AddMessage("CAPAB", anope_event_capab);
|
||||
Anope::AddMessage("SJOIN", anope_event_sjoin);
|
||||
Anope::AddMessage("ERROR", anope_event_error);
|
||||
Anope::AddMessage("SID", anope_event_sid);
|
||||
Anope::AddMessage("436", event_436);
|
||||
Anope::AddMessage("AWAY", event_away);
|
||||
Anope::AddMessage("JOIN", event_join);
|
||||
Anope::AddMessage("KICK", event_kick);
|
||||
Anope::AddMessage("KILL", event_kill);
|
||||
Anope::AddMessage("MODE", event_mode);
|
||||
Anope::AddMessage("TMODE", event_tmode);
|
||||
Anope::AddMessage("MOTD", event_motd);
|
||||
Anope::AddMessage("NICK", event_nick);
|
||||
Anope::AddMessage("BMASK", event_bmask);
|
||||
Anope::AddMessage("UID", event_nick);
|
||||
Anope::AddMessage("PART", event_part);
|
||||
Anope::AddMessage("PASS", event_pass);
|
||||
Anope::AddMessage("PING", event_ping);
|
||||
Anope::AddMessage("PRIVMSG", event_privmsg);
|
||||
Anope::AddMessage("QUIT", event_quit);
|
||||
Anope::AddMessage("SERVER", event_server);
|
||||
Anope::AddMessage("SQUIT", event_squit);
|
||||
Anope::AddMessage("TOPIC", event_topic);
|
||||
Anope::AddMessage("TB", event_tburst);
|
||||
Anope::AddMessage("WHOIS", event_whois);
|
||||
Anope::AddMessage("CAPAB", event_capab);
|
||||
Anope::AddMessage("SJOIN", event_sjoin);
|
||||
Anope::AddMessage("ERROR", event_error);
|
||||
Anope::AddMessage("SID", event_sid);
|
||||
}
|
||||
|
||||
static void AddModes()
|
||||
|
||||
+273
-303
@@ -45,11 +45,6 @@ IRCDVar myIrcd[] = {
|
||||
{NULL}
|
||||
};
|
||||
|
||||
void unreal_cmd_netinfo(int ac, const char **av)
|
||||
{
|
||||
send_cmd("", "AO %ld %ld %d %s 0 0 0 :%s", static_cast<long>(maxusercnt), static_cast<long>(Anope::CurTime), Anope::string(av[2]).is_number_only() ? convertTo<int>(av[2]) : 0, av[3], av[7]);
|
||||
}
|
||||
|
||||
/* PROTOCTL */
|
||||
/*
|
||||
NICKv2 = Nick Version 2
|
||||
@@ -393,11 +388,11 @@ class UnrealIRCdProto : public IRCDProto
|
||||
} ircd_proto;
|
||||
|
||||
/* Event: PROTOCTL */
|
||||
int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
bool event_capab(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
for (int i = 0; i < ac; ++i)
|
||||
for (unsigned i = 0; i < params.size(); ++i)
|
||||
{
|
||||
Anope::string capab = av[i];
|
||||
Anope::string capab = params[i];
|
||||
|
||||
if (capab.find("CHANMODES") != Anope::string::npos)
|
||||
{
|
||||
@@ -537,35 +532,34 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
|
||||
}
|
||||
}
|
||||
|
||||
CapabParse(ac, av);
|
||||
CapabParse(params);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Events */
|
||||
int anope_event_ping(const Anope::string &source, int ac, const char **av)
|
||||
bool event_ping(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
ircdproto->SendPong(ac > 1 ? av[1] : Config->ServerName, av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
ircdproto->SendPong(params.size() > 1 ? params[1] : Config->ServerName, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** This is here because:
|
||||
*
|
||||
* If we had servers three servers, A, B & C linked like so: A<->B<->C
|
||||
* If Anope is (linked to) A and B splits from A and then reconnects
|
||||
* If Anope is linked to A and B splits from A and then reconnects
|
||||
* B introduces itself, introduces C, sends EOS for C, introduces Bs clients
|
||||
* introduces Cs clients, sends EOS for B. This causes all of Cs clients to be introduced
|
||||
* with their server "not syncing". We now send a PING immediatly when receiving a new server
|
||||
* and then finish sync once we get a pong back from that server
|
||||
*/
|
||||
int anope_event_pong(const Anope::string &source, int ac, const char **av)
|
||||
bool event_pong(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Server *s = Server::Find(source);
|
||||
if (s && !s->IsSynced())
|
||||
s->Sync(false);
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* netinfo
|
||||
@@ -578,19 +572,17 @@ int anope_event_pong(const Anope::string &source, int ac, const char **av)
|
||||
* argv[6] = free(**)
|
||||
* argv[7] = ircnet
|
||||
*/
|
||||
int anope_event_netinfo(const Anope::string &source, int ac, const char **av)
|
||||
bool event_netinfo(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
unreal_cmd_netinfo(ac, av);
|
||||
return MOD_CONT;
|
||||
send_cmd("", "AO %ld %ld %d %s 0 0 0 :%s", static_cast<long>(maxusercnt), static_cast<long>(Anope::CurTime), Anope::string(params[2]).is_number_only() ? convertTo<int>(params[2]) : 0, params[3].c_str(), params[7].c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_436(const Anope::string &source, int ac, const char **av)
|
||||
bool event_436(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
|
||||
m_nickcoll(av[0]);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
m_nickcoll(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -598,12 +590,12 @@ int anope_event_436(const Anope::string &source, int ac, const char **av)
|
||||
** parv[0] = sender prefix
|
||||
** parv[1] = away message
|
||||
*/
|
||||
int anope_event_away(const Anope::string &source, int ac, const char **av)
|
||||
bool event_away(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (source.empty())
|
||||
return MOD_CONT;
|
||||
m_away(source, ac ? av[0] : "");
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
m_away(source, !params.empty() ? params[0] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -614,57 +606,52 @@ int anope_event_away(const Anope::string &source, int ac, const char **av)
|
||||
** parv[2] = topic time
|
||||
** parv[3] = topic text
|
||||
*/
|
||||
int anope_event_topic(const Anope::string &source, int ac, const char **av)
|
||||
bool event_topic(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 4)
|
||||
return MOD_CONT;
|
||||
if (params.size() != 4)
|
||||
return true;
|
||||
|
||||
Channel *c = findchan(av[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
if (!c)
|
||||
{
|
||||
Log() << "TOPIC for nonexistant channel " << av[0];
|
||||
return MOD_CONT;
|
||||
Log() << "TOPIC for nonexistant channel " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
c->ChangeTopicInternal(av[1], av[3], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : Anope::CurTime);
|
||||
c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_squit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_squit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
do_squit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() != 2)
|
||||
do_squit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_quit(const Anope::string &source, int ac, const char **av)
|
||||
bool event_quit(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
do_quit(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
do_quit(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_mode(const Anope::string &source, int ac, const char **av)
|
||||
bool event_mode(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 2)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 2)
|
||||
return true;
|
||||
|
||||
bool server_source = Server::Find(source) != NULL;
|
||||
Anope::string modes = params[1];
|
||||
for (unsigned i = 2; i < params.size() - (server_source ? 1 : 0); ++i)
|
||||
modes += " " + params[i];
|
||||
|
||||
if (*av[0] == '#' || *av[0] == '&')
|
||||
do_cmode(source, ac, av);
|
||||
if (params[0][0] == '#' || params[0][0] == '&')
|
||||
do_cmode(source, params[0], modes, server_source ? params[params.size() - 1] : "");
|
||||
else
|
||||
do_umode(source, ac, av);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
/* This is used to strip the TS from the end of the mode stirng */
|
||||
int anope_event_gmode(const Anope::string &source, int ac, const char **av)
|
||||
{
|
||||
if (Server::Find(source))
|
||||
--ac;
|
||||
return anope_event_mode(source, ac, av);
|
||||
do_umode(source, params[0], modes);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Unreal sends USER modes with this */
|
||||
@@ -673,145 +660,129 @@ int anope_event_gmode(const Anope::string &source, int ac, const char **av)
|
||||
parv[0] - sender
|
||||
parv[1] - modes to change
|
||||
*/
|
||||
int anope_event_umode2(const Anope::string &source, int ac, const char **av)
|
||||
bool event_umode2(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1)
|
||||
return MOD_CONT;
|
||||
if (params.size() < 1)
|
||||
return true;
|
||||
|
||||
const char *newav[2];
|
||||
newav[0] = source.c_str();
|
||||
newav[1] = av[0];
|
||||
do_umode(source, 2, newav);
|
||||
return MOD_CONT;
|
||||
do_umode(source, source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_kill(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kill(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
if (params.size() != 2)
|
||||
return true;
|
||||
|
||||
m_kill(av[0], av[1]);
|
||||
return MOD_CONT;
|
||||
m_kill(params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_kick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_kick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 3)
|
||||
return MOD_CONT;
|
||||
do_kick(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() != 3)
|
||||
return true;
|
||||
do_kick(source, params[0], params[1], params[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_join(const Anope::string &source, int ac, const char **av)
|
||||
bool event_join(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
do_join(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (!params.empty())
|
||||
do_join(source, params[0], "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_motd(const Anope::string &source, int ac, const char **av)
|
||||
bool event_motd(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (source.empty())
|
||||
return MOD_CONT;
|
||||
|
||||
m_motd(source);
|
||||
return MOD_CONT;
|
||||
if (!source.empty())
|
||||
m_motd(source);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_setname(const Anope::string &source, int ac, const char **av)
|
||||
bool event_setname(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.size() != 1)
|
||||
return true;
|
||||
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETNAME for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetRealname(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetRealname(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chgname(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chgname(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.size() != 2)
|
||||
return true;
|
||||
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(av[0]);
|
||||
User *u = finduser(params[0]);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "CHGNAME for nonexistent user " << av[0];
|
||||
return MOD_CONT;
|
||||
Log(LOG_DEBUG) << "CHGNAME for nonexistent user " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetRealname(av[1]);
|
||||
return MOD_CONT;
|
||||
u->SetRealname(params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_setident(const Anope::string &source, int ac, const char **av)
|
||||
bool event_setident(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.size() != 1)
|
||||
return true;
|
||||
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETIDENT for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetVIdent(av[0]);
|
||||
return MOD_CONT;
|
||||
u->SetVIdent(params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chgident(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chgident(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.size() != 2)
|
||||
return true;
|
||||
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(av[0]);
|
||||
User *u = finduser(params[0]);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "CHGIDENT for nonexistent user " << av[0];
|
||||
return MOD_CONT;
|
||||
Log(LOG_DEBUG) << "CHGIDENT for nonexistent user " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetVIdent(av[1]);
|
||||
return MOD_CONT;
|
||||
u->SetVIdent(params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_sethost(const Anope::string &source, int ac, const char **av)
|
||||
bool event_sethost(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.size() != 1)
|
||||
return true;
|
||||
|
||||
if (ac != 1)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(source);
|
||||
User *u = finduser(source);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "SETHOST for nonexistent user " << source;
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* When a user sets +x we recieve the new host and then the mode change */
|
||||
if (u->HasMode(UMODE_CLOAK))
|
||||
u->SetDisplayedHost(av[0]);
|
||||
u->SetDisplayedHost(params[0]);
|
||||
else
|
||||
u->SetCloakedHost(av[0]);
|
||||
u->SetCloakedHost(params[0]);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -840,161 +811,155 @@ int anope_event_sethost(const Anope::string &source, int ac, const char **av)
|
||||
** parv[0] = new nickname
|
||||
** parv[1] = hopcount
|
||||
*/
|
||||
int anope_event_nick(const Anope::string &source, int ac, const char **av)
|
||||
bool event_nick(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *user;
|
||||
|
||||
if (ac != 2)
|
||||
if (params.size() == 7)
|
||||
{
|
||||
if (ac == 7)
|
||||
{
|
||||
/*
|
||||
<codemastr> that was a bug that is now fixed in 3.2.1
|
||||
<codemastr> in some instances it would use the non-nickv2 format
|
||||
<codemastr> it's sent when a nick collision occurs
|
||||
- so we have to leave it around for now -TSL
|
||||
*/
|
||||
do_nick(source, av[0], av[3], av[4], av[5], av[6], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : 0, "", "*", "", "");
|
||||
}
|
||||
else if (ac == 11)
|
||||
{
|
||||
Anope::string decoded_ip;
|
||||
b64_decode(av[9], decoded_ip);
|
||||
/*
|
||||
<codemastr> that was a bug that is now fixed in 3.2.1
|
||||
<codemastr> in some instances it would use the non-nickv2 format
|
||||
<codemastr> it's sent when a nick collision occurs
|
||||
- so we have to leave it around for now -TSL
|
||||
*/
|
||||
do_nick(source, params[0], params[3], params[4], params[5], params[6], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, "", "*", "", "");
|
||||
}
|
||||
else if (params.size() == 11)
|
||||
{
|
||||
Anope::string decoded_ip;
|
||||
b64_decode(params[9], decoded_ip);
|
||||
|
||||
sockaddrs ip;
|
||||
ip.ntop(strlen(av[9]) == 8 ? AF_INET : AF_INET6, decoded_ip.c_str());
|
||||
sockaddrs ip;
|
||||
ip.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str());
|
||||
|
||||
if (av[8] && !strcmp(av[8], "*"))
|
||||
av[8] = "";
|
||||
Anope::string vhost = params[8];
|
||||
if (vhost.equals_cs("*"))
|
||||
vhost.clear();
|
||||
|
||||
user = do_nick(source, av[0], av[3], av[4], av[5], av[10], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : 0, ip.addr(), av[8], "", av[7]);
|
||||
if (user)
|
||||
{
|
||||
NickAlias *na = findnick(user->nick);
|
||||
|
||||
if (na && user->timestamp == convertTo<time_t>(av[6]))
|
||||
{
|
||||
user->Login(na->nc);
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
}
|
||||
else
|
||||
validate_user(user);
|
||||
}
|
||||
}
|
||||
else
|
||||
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)
|
||||
{
|
||||
if (av[8] && !strcmp(av[8], "*"))
|
||||
av[8] = "";
|
||||
NickAlias *na = findnick(user->nick);
|
||||
|
||||
/* NON NICKIP */
|
||||
user = do_nick(source, av[0], av[3], av[4], av[5], av[9], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : 0, "", av[8], "", av[7]);
|
||||
if (user)
|
||||
if (na && user->timestamp == convertTo<time_t>(params[6]))
|
||||
{
|
||||
NickAlias *na = findnick(user->nick);
|
||||
|
||||
if (na && user->timestamp == convertTo<time_t>(av[6]))
|
||||
{
|
||||
user->Login(na->nc);
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
}
|
||||
else
|
||||
validate_user(user);
|
||||
user->Login(na->nc);
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
}
|
||||
else
|
||||
validate_user(user);
|
||||
}
|
||||
}
|
||||
else if (params.size() != 2)
|
||||
{
|
||||
Anope::string vhost = params[8];
|
||||
if (vhost.equals_cs("*"))
|
||||
vhost.clear();
|
||||
|
||||
/* NON NICKIP */
|
||||
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 = findnick(user->nick);
|
||||
|
||||
if (na && user->timestamp == convertTo<time_t>(params[6]))
|
||||
{
|
||||
user->Login(na->nc);
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
}
|
||||
else
|
||||
validate_user(user);
|
||||
}
|
||||
}
|
||||
else
|
||||
do_nick(source, av[0], "", "", "", "", Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0, "", "", "", "");
|
||||
return MOD_CONT;
|
||||
do_nick(source, params[0], "", "", "", "", Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0, "", "", "", "");
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_chghost(const Anope::string &source, int ac, const char **av)
|
||||
bool event_chghost(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u;
|
||||
if (params.size() != 2)
|
||||
return true;
|
||||
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
|
||||
u = finduser(av[0]);
|
||||
User *u = finduser(params[0]);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "debug: CHGHOST for nonexistent user " << av[0];
|
||||
return MOD_CONT;
|
||||
Log(LOG_DEBUG) << "debug: CHGHOST for nonexistent user " << params[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
u->SetDisplayedHost(av[1]);
|
||||
return MOD_CONT;
|
||||
u->SetDisplayedHost(params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* EVENT: SERVER */
|
||||
int anope_event_server(const Anope::string &source, int ac, const char **av)
|
||||
bool event_server(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!stricmp(av[1], "1"))
|
||||
if (params[1].equals_cs("1"))
|
||||
{
|
||||
Anope::string vl = myStrGetToken(av[2], ' ', 0);
|
||||
Anope::string vl = myStrGetToken(params[2], ' ', 0);
|
||||
Anope::string upnumeric = myStrGetToken(vl, '-', 2);
|
||||
Anope::string desc = myStrGetTokenRemainder(av[2], ' ', 1);
|
||||
do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, desc, upnumeric);
|
||||
Anope::string desc = myStrGetTokenRemainder(params[2], ' ', 1);
|
||||
do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, desc, upnumeric);
|
||||
}
|
||||
else
|
||||
do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], "");
|
||||
ircdproto->SendPing(Config->ServerName, av[0]);
|
||||
do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[2], "");
|
||||
ircdproto->SendPing(Config->ServerName, params[0]);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_privmsg(const Anope::string &source, int ac, const char **av)
|
||||
bool event_privmsg(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac != 2)
|
||||
return MOD_CONT;
|
||||
m_privmsg(source, av[0], av[1]);
|
||||
return MOD_CONT;
|
||||
if (params.size() > 1)
|
||||
m_privmsg(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_part(const Anope::string &source, int ac, const char **av)
|
||||
bool event_part(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (ac < 1 || ac > 2)
|
||||
return MOD_CONT;
|
||||
do_part(source, ac, av);
|
||||
return MOD_CONT;
|
||||
if (params.size() < 1 || params.size() > 2)
|
||||
return true;
|
||||
do_part(source, params[0], params[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_whois(const Anope::string &source, int ac, const char **av)
|
||||
bool event_whois(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!source.empty() && ac >= 1)
|
||||
m_whois(source, av[0]);
|
||||
return MOD_CONT;
|
||||
if (!source.empty() && !params.empty())
|
||||
m_whois(source, params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_error(const Anope::string &source, int ac, const char **av)
|
||||
bool event_error(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (av[0])
|
||||
if (!params.empty())
|
||||
{
|
||||
Log(LOG_DEBUG) << av[0];
|
||||
if (strstr(av[0], "No matching link configuration"))
|
||||
Log(LOG_DEBUG) << params[0];
|
||||
if (params[0].find("No matching link configuration") != Anope::string::npos)
|
||||
Log() << "Error: Your IRCD's link block may not be setup correctly, please check unrealircd.conf";
|
||||
}
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_sdesc(const Anope::string &source, int ac, const char **av)
|
||||
bool event_sdesc(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Server *s = Server::Find(source);
|
||||
|
||||
if (s)
|
||||
s->SetDescription(av[0]);
|
||||
s->SetDescription(params[0]);
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
bool event_sjoin(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = findchan(av[1]);
|
||||
time_t ts = Anope::string(av[0]).is_pos_number_only() ? convertTo<time_t>(av[0]) : 0;
|
||||
Channel *c = findchan(params[1]);
|
||||
time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : 0;
|
||||
bool keep_their_modes = true;
|
||||
|
||||
if (!c)
|
||||
{
|
||||
c = new Channel(av[1], ts);
|
||||
c = new Channel(params[1], ts);
|
||||
c->SetFlag(CH_SYNCING);
|
||||
}
|
||||
/* Our creation time is newer than what the server gave us */
|
||||
@@ -1011,13 +976,18 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
keep_their_modes = false;
|
||||
|
||||
/* If we need to keep their modes, and this SJOIN string contains modes */
|
||||
if (keep_their_modes && ac >= 4)
|
||||
if (keep_their_modes && params.size() >= 4)
|
||||
{
|
||||
Anope::string modes;
|
||||
for (unsigned i = 2; i < params.size() - 1; ++i)
|
||||
modes += " " + params[i];
|
||||
if (!modes.empty())
|
||||
modes.erase(modes.begin());
|
||||
/* Set the modes internally */
|
||||
ChanSetInternalModes(c, ac - 3, av + 2);
|
||||
c->SetModesInternal(NULL, modes);
|
||||
}
|
||||
|
||||
spacesepstream sep(av[ac - 1]);
|
||||
spacesepstream sep(params[params.size() - 1]);
|
||||
Anope::string buf;
|
||||
while (sep.GetToken(buf))
|
||||
{
|
||||
@@ -1109,72 +1079,72 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
c->Sync();
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
void moduleAddIRCDMsgs()
|
||||
{
|
||||
Anope::AddMessage("436", anope_event_436);
|
||||
Anope::AddMessage("AWAY", anope_event_away);
|
||||
Anope::AddMessage("6", anope_event_away);
|
||||
Anope::AddMessage("JOIN", anope_event_join);
|
||||
Anope::AddMessage("C", anope_event_join);
|
||||
Anope::AddMessage("KICK", anope_event_kick);
|
||||
Anope::AddMessage("H", anope_event_kick);
|
||||
Anope::AddMessage("KILL", anope_event_kill);
|
||||
Anope::AddMessage(".", anope_event_kill);
|
||||
Anope::AddMessage("MODE", anope_event_mode);
|
||||
Anope::AddMessage("G", anope_event_gmode);
|
||||
Anope::AddMessage("MOTD", anope_event_motd);
|
||||
Anope::AddMessage("F", anope_event_motd);
|
||||
Anope::AddMessage("NICK", anope_event_nick);
|
||||
Anope::AddMessage("&", anope_event_nick);
|
||||
Anope::AddMessage("PART", anope_event_part);
|
||||
Anope::AddMessage("D", anope_event_part);
|
||||
Anope::AddMessage("PING", anope_event_ping);
|
||||
Anope::AddMessage("8", anope_event_ping);
|
||||
Anope::AddMessage("PONG", anope_event_pong);
|
||||
Anope::AddMessage("9", anope_event_pong);
|
||||
Anope::AddMessage("PRIVMSG", anope_event_privmsg);
|
||||
Anope::AddMessage("!", anope_event_privmsg);
|
||||
Anope::AddMessage("QUIT", anope_event_quit);
|
||||
Anope::AddMessage(",", anope_event_quit);
|
||||
Anope::AddMessage("SERVER", anope_event_server);
|
||||
Anope::AddMessage("'", anope_event_server);
|
||||
Anope::AddMessage("SQUIT", anope_event_squit);
|
||||
Anope::AddMessage("-", anope_event_squit);
|
||||
Anope::AddMessage("TOPIC", anope_event_topic);
|
||||
Anope::AddMessage(")", anope_event_topic);
|
||||
Anope::AddMessage("SVSMODE", anope_event_mode);
|
||||
Anope::AddMessage("n", anope_event_mode);
|
||||
Anope::AddMessage("SVS2MODE", anope_event_mode);
|
||||
Anope::AddMessage("v", anope_event_mode);
|
||||
Anope::AddMessage("WHOIS", anope_event_whois);
|
||||
Anope::AddMessage("#", anope_event_whois);
|
||||
Anope::AddMessage("PROTOCTL", anope_event_capab);
|
||||
Anope::AddMessage("_", anope_event_capab);
|
||||
Anope::AddMessage("CHGHOST", anope_event_chghost);
|
||||
Anope::AddMessage("AL", anope_event_chghost);
|
||||
Anope::AddMessage("CHGIDENT", anope_event_chgident);
|
||||
Anope::AddMessage("AZ", anope_event_chgident);
|
||||
Anope::AddMessage("CHGNAME", anope_event_chgname);
|
||||
Anope::AddMessage("BK", anope_event_chgname);
|
||||
Anope::AddMessage("NETINFO", anope_event_netinfo);
|
||||
Anope::AddMessage("AO", anope_event_netinfo);
|
||||
Anope::AddMessage("SETHOST", anope_event_sethost);
|
||||
Anope::AddMessage("AA", anope_event_sethost);
|
||||
Anope::AddMessage("SETIDENT", anope_event_setident);
|
||||
Anope::AddMessage("AD", anope_event_setident);
|
||||
Anope::AddMessage("SETNAME", anope_event_setname);
|
||||
Anope::AddMessage("AE", anope_event_setname);
|
||||
Anope::AddMessage("ERROR", anope_event_error);
|
||||
Anope::AddMessage("5", anope_event_error);
|
||||
Anope::AddMessage("UMODE2", anope_event_umode2);
|
||||
Anope::AddMessage("|", anope_event_umode2);
|
||||
Anope::AddMessage("SJOIN", anope_event_sjoin);
|
||||
Anope::AddMessage("~", anope_event_sjoin);
|
||||
Anope::AddMessage("SDESC", anope_event_sdesc);
|
||||
Anope::AddMessage("AG", anope_event_sdesc);
|
||||
Anope::AddMessage("436", event_436);
|
||||
Anope::AddMessage("AWAY", event_away);
|
||||
Anope::AddMessage("6", event_away);
|
||||
Anope::AddMessage("JOIN", event_join);
|
||||
Anope::AddMessage("C", event_join);
|
||||
Anope::AddMessage("KICK", event_kick);
|
||||
Anope::AddMessage("H", event_kick);
|
||||
Anope::AddMessage("KILL", event_kill);
|
||||
Anope::AddMessage(".", event_kill);
|
||||
Anope::AddMessage("MODE", event_mode);
|
||||
Anope::AddMessage("G", event_mode);
|
||||
Anope::AddMessage("MOTD", event_motd);
|
||||
Anope::AddMessage("F", event_motd);
|
||||
Anope::AddMessage("NICK", event_nick);
|
||||
Anope::AddMessage("&", event_nick);
|
||||
Anope::AddMessage("PART", event_part);
|
||||
Anope::AddMessage("D", event_part);
|
||||
Anope::AddMessage("PING", event_ping);
|
||||
Anope::AddMessage("8", event_ping);
|
||||
Anope::AddMessage("PONG", event_pong);
|
||||
Anope::AddMessage("9", event_pong);
|
||||
Anope::AddMessage("PRIVMSG", event_privmsg);
|
||||
Anope::AddMessage("!", event_privmsg);
|
||||
Anope::AddMessage("QUIT", event_quit);
|
||||
Anope::AddMessage(",", event_quit);
|
||||
Anope::AddMessage("SERVER", event_server);
|
||||
Anope::AddMessage("'", event_server);
|
||||
Anope::AddMessage("SQUIT", event_squit);
|
||||
Anope::AddMessage("-", event_squit);
|
||||
Anope::AddMessage("TOPIC", event_topic);
|
||||
Anope::AddMessage(")", event_topic);
|
||||
Anope::AddMessage("SVSMODE", event_mode);
|
||||
Anope::AddMessage("n", event_mode);
|
||||
Anope::AddMessage("SVS2MODE", event_mode);
|
||||
Anope::AddMessage("v", event_mode);
|
||||
Anope::AddMessage("WHOIS", event_whois);
|
||||
Anope::AddMessage("#", event_whois);
|
||||
Anope::AddMessage("PROTOCTL", event_capab);
|
||||
Anope::AddMessage("_", event_capab);
|
||||
Anope::AddMessage("CHGHOST", event_chghost);
|
||||
Anope::AddMessage("AL", event_chghost);
|
||||
Anope::AddMessage("CHGIDENT", event_chgident);
|
||||
Anope::AddMessage("AZ", event_chgident);
|
||||
Anope::AddMessage("CHGNAME", event_chgname);
|
||||
Anope::AddMessage("BK", event_chgname);
|
||||
Anope::AddMessage("NETINFO", event_netinfo);
|
||||
Anope::AddMessage("AO", event_netinfo);
|
||||
Anope::AddMessage("SETHOST", event_sethost);
|
||||
Anope::AddMessage("AA", event_sethost);
|
||||
Anope::AddMessage("SETIDENT", event_setident);
|
||||
Anope::AddMessage("AD", event_setident);
|
||||
Anope::AddMessage("SETNAME", event_setname);
|
||||
Anope::AddMessage("AE", event_setname);
|
||||
Anope::AddMessage("ERROR", event_error);
|
||||
Anope::AddMessage("5", event_error);
|
||||
Anope::AddMessage("UMODE2", event_umode2);
|
||||
Anope::AddMessage("|", event_umode2);
|
||||
Anope::AddMessage("SJOIN", event_sjoin);
|
||||
Anope::AddMessage("~", event_sjoin);
|
||||
Anope::AddMessage("SDESC", event_sdesc);
|
||||
Anope::AddMessage("AG", event_sdesc);
|
||||
|
||||
/* The non token version of these is in messages.c */
|
||||
Anope::AddMessage("2", m_stats);
|
||||
|
||||
Reference in New Issue
Block a user