summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-12-06 17:06:57 -0500
committerAdam <Adam@anope.org>2010-12-12 19:37:03 -0500
commitaed53dbb47822a79eb9a6b61095ad04ec3d67818 (patch)
tree72d3210b5609ea2163854d14ec7fb2f48d8b4d12 /modules
parenta507816701d136a1c22d2f6779d811840d61577c (diff)
Cleaned up some things, made the protocol modules use some basic inheritance to cut back on their code duplication. More work can be done in the future to remove even more of it.
Diffstat (limited to 'modules')
-rw-r--r--modules/core/cs_forbid.cpp2
-rw-r--r--modules/core/cs_info.cpp2
-rw-r--r--modules/core/cs_list.cpp2
-rw-r--r--modules/core/cs_suspend.cpp2
-rw-r--r--modules/core/cs_unban.cpp2
-rw-r--r--modules/core/ns_ghost.cpp2
-rw-r--r--modules/core/ns_group.cpp2
-rw-r--r--modules/core/ns_info.cpp2
-rw-r--r--modules/core/ns_list.cpp2
-rw-r--r--modules/core/ns_register.cpp4
-rw-r--r--modules/core/os_chankill.cpp2
-rw-r--r--modules/core/os_defcon.cpp6
-rw-r--r--modules/core/os_noop.cpp4
-rw-r--r--modules/extra/cs_entrymsg.cpp2
-rw-r--r--modules/extra/cs_set_misc.cpp2
-rw-r--r--modules/extra/m_alias.cpp2
-rw-r--r--modules/extra/m_xmlrpc_main.cpp2
-rw-r--r--modules/extra/ns_set_misc.cpp2
-rw-r--r--modules/protocol/bahamut.cpp512
-rw-r--r--modules/protocol/inspircd-ts6.h413
-rw-r--r--modules/protocol/inspircd11.cpp908
-rw-r--r--modules/protocol/inspircd12.cpp1149
-rw-r--r--modules/protocol/inspircd20.cpp1147
-rw-r--r--modules/protocol/plexus.cpp436
-rw-r--r--modules/protocol/ratbox.cpp449
-rw-r--r--modules/protocol/unreal32.cpp960
26 files changed, 2493 insertions, 3525 deletions
diff --git a/modules/core/cs_forbid.cpp b/modules/core/cs_forbid.cpp
index 19f4b6f04..d3976929d 100644
--- a/modules/core/cs_forbid.cpp
+++ b/modules/core/cs_forbid.cpp
@@ -71,7 +71,7 @@ class CommandCSForbid : public Command
{
UserContainer *uc = *it++;
- if (is_oper(uc->user))
+ if (uc->user->HasMode(UMODE_OPER))
continue;
c->Kick(ChanServ, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user, CHAN_FORBID_REASON).c_str());
diff --git a/modules/core/cs_info.cpp b/modules/core/cs_info.cpp
index 7f4784270..d842ad4ea 100644
--- a/modules/core/cs_info.cpp
+++ b/modules/core/cs_info.cpp
@@ -46,7 +46,7 @@ class CommandCSInfo : public Command
if (ci->HasFlag(CI_FORBIDDEN))
{
- if (is_oper(u) && !ci->forbidby.empty())
+ if (u->HasMode(UMODE_OPER) && !ci->forbidby.empty())
source.Reply(CHAN_X_FORBIDDEN_OPER, chan.c_str(), ci->forbidby.c_str(), !ci->forbidreason.empty() ? ci->forbidreason.c_str() : GetString(u, NO_REASON).c_str());
else
source.Reply(CHAN_X_FORBIDDEN, chan.c_str());
diff --git a/modules/core/cs_list.cpp b/modules/core/cs_list.cpp
index 87d0afb79..73947c9de 100644
--- a/modules/core/cs_list.cpp
+++ b/modules/core/cs_list.cpp
@@ -33,7 +33,7 @@ public:
int count = 0, from = 0, to = 0;
bool forbidden = false, suspended = false, channoexpire = false;
- if (Config->CSListOpersOnly && !is_oper(u))
+ if (Config->CSListOpersOnly && !u->HasMode(UMODE_OPER))
{
source.Reply(ACCESS_DENIED);
return MOD_STOP;
diff --git a/modules/core/cs_suspend.cpp b/modules/core/cs_suspend.cpp
index ee0dd4d17..c2172dcb2 100644
--- a/modules/core/cs_suspend.cpp
+++ b/modules/core/cs_suspend.cpp
@@ -56,7 +56,7 @@ class CommandCSSuspend : public Command
{
UserContainer *uc = *it++;
- if (is_oper(uc->user))
+ if (uc->user->HasMode(UMODE_OPER))
continue;
c->Kick(NULL, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user->Account(), CHAN_SUSPEND_REASON).c_str());
diff --git a/modules/core/cs_unban.cpp b/modules/core/cs_unban.cpp
index f9b5908e0..df5d2877e 100644
--- a/modules/core/cs_unban.cpp
+++ b/modules/core/cs_unban.cpp
@@ -48,7 +48,7 @@ class CommandCSUnban : public Command
return MOD_CONT;
}
- common_unban(ci, u2->nick);
+ common_unban(ci, u2);
if (u2 == u)
source.Reply(CHAN_UNBANNED, c->name.c_str());
else
diff --git a/modules/core/ns_ghost.cpp b/modules/core/ns_ghost.cpp
index 14796bc78..323b0378c 100644
--- a/modules/core/ns_ghost.cpp
+++ b/modules/core/ns_ghost.cpp
@@ -49,7 +49,7 @@ class CommandNSGhost : public Command
{
Log(LOG_COMMAND, u, this) << "for " << nick;
Anope::string buf = "GHOST command used by " + u->nick;
- kill_user(Config->s_NickServ, nick, buf);
+ kill_user(Config->s_NickServ, user, buf);
source.Reply(NICK_GHOST_KILLED, nick.c_str());
}
}
diff --git a/modules/core/ns_group.cpp b/modules/core/ns_group.cpp
index 697c29447..ebf6c74af 100644
--- a/modules/core/ns_group.cpp
+++ b/modules/core/ns_group.cpp
@@ -48,7 +48,7 @@ class CommandNSGroup : public Command
if (Config->RestrictOperNicks)
for (std::list<std::pair<Anope::string, Anope::string> >::iterator it = Config->Opers.begin(), it_end = Config->Opers.end(); it != it_end; ++it)
- if (!is_oper(u) && u->nick.find_ci(it->first) != Anope::string::npos)
+ if (!u->HasMode(UMODE_OPER) && u->nick.find_ci(it->first) != Anope::string::npos)
{
source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str());
return MOD_CONT;
diff --git a/modules/core/ns_info.cpp b/modules/core/ns_info.cpp
index 32d8fe8f7..a3ee2f70f 100644
--- a/modules/core/ns_info.cpp
+++ b/modules/core/ns_info.cpp
@@ -57,7 +57,7 @@ class CommandNSInfo : public Command
}
else if (na->HasFlag(NS_FORBIDDEN))
{
- if (is_oper(u) && !na->last_usermask.empty())
+ if (u->HasMode(UMODE_OPER) && !na->last_usermask.empty())
source.Reply(NICK_X_FORBIDDEN_OPER, nick.c_str(), na->last_usermask.c_str(), !na->last_realname.empty() ? na->last_realname.c_str() : GetString(u, NO_REASON).c_str());
else
source.Reply(NICK_X_FORBIDDEN, nick.c_str());
diff --git a/modules/core/ns_list.cpp b/modules/core/ns_list.cpp
index 89fba90d8..bf7a0efbd 100644
--- a/modules/core/ns_list.cpp
+++ b/modules/core/ns_list.cpp
@@ -49,7 +49,7 @@ class CommandNSList : public Command
suspended = nsnoexpire = forbidden = unconfirmed = false;
- if (Config->NSListOpersOnly && !is_oper(u)) /* reverse the help logic */
+ if (Config->NSListOpersOnly && !u->HasMode(UMODE_OPER)) /* reverse the help logic */
{
source.Reply(ACCESS_DENIED);
return MOD_STOP;
diff --git a/modules/core/ns_register.cpp b/modules/core/ns_register.cpp
index abcba133d..edf8181e5 100644
--- a/modules/core/ns_register.cpp
+++ b/modules/core/ns_register.cpp
@@ -196,7 +196,7 @@ class CommandNSRegister : public CommandNSConfirm
return MOD_CONT;
}
- if (!is_oper(u) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay)
+ if (!u->HasMode(UMODE_OPER) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay)
{
source.Reply(NICK_REG_DELAY, Config->NickRegDelay);
return MOD_CONT;
@@ -230,7 +230,7 @@ class CommandNSRegister : public CommandNSConfirm
{
Anope::string nick = it->first;
- if (u->nick.find_ci(nick) != Anope::string::npos && !is_oper(u))
+ if (u->nick.find_ci(nick) != Anope::string::npos && !u->HasMode(UMODE_OPER))
{
source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str());
return MOD_CONT;
diff --git a/modules/core/os_chankill.cpp b/modules/core/os_chankill.cpp
index 3201858e7..506adbdfb 100644
--- a/modules/core/os_chankill.cpp
+++ b/modules/core/os_chankill.cpp
@@ -70,7 +70,7 @@ class CommandOSChanKill : public Command
{
UserContainer *uc = *it++;
- if (is_oper(uc->user))
+ if (uc->user->HasMode(UMODE_OPER))
continue;
SGLine->Add(OperServ, u, "*@" + uc->user->host, expires, realreason);
diff --git a/modules/core/os_defcon.cpp b/modules/core/os_defcon.cpp
index 0dd9dcedb..cc8809586 100644
--- a/modules/core/os_defcon.cpp
+++ b/modules/core/os_defcon.cpp
@@ -164,7 +164,7 @@ class OSDefcon : public Module
}
if (CheckDefCon(DEFCON_NO_NEW_CLIENTS) || CheckDefCon(DEFCON_AKILL_NEW_CLIENTS))
- kill_user(Config->s_OperServ, u->nick, Config->DefConAkillReason);
+ kill_user(Config->s_OperServ, u, Config->DefConAkillReason);
return EVENT_STOP;
}
@@ -208,7 +208,7 @@ class OSDefcon : public Module
EventReturn OnPreCommandRun(User *u, BotInfo *bi, Anope::string &command, Anope::string &message, ChannelInfo *ci)
{
- if (!is_oper(u) && (CheckDefCon(DEFCON_OPER_ONLY) || CheckDefCon(DEFCON_SILENT_OPER_ONLY)))
+ if (!u->HasMode(UMODE_OPER) && (CheckDefCon(DEFCON_OPER_ONLY) || CheckDefCon(DEFCON_SILENT_OPER_ONLY)))
{
if (!CheckDefCon(DEFCON_SILENT_OPER_ONLY))
u->SendMessage(bi, OPER_DEFCON_DENIED);
@@ -281,7 +281,7 @@ class OSDefcon : public Module
if (!Config->SessionLimitDetailsLoc.empty())
ircdproto->SendMessage(OperServ, u->nick, "%s", Config->SessionLimitDetailsLoc.c_str());
- kill_user(Config->s_OperServ, u->nick, "Session limit exceeded");
+ kill_user(Config->s_OperServ, u, "Session limit exceeded");
++session->hits;
if (Config->MaxSessionKill && session->hits >= Config->MaxSessionKill)
{
diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp
index 0d740d29a..1e799d4d3 100644
--- a/modules/core/os_noop.cpp
+++ b/modules/core/os_noop.cpp
@@ -44,8 +44,8 @@ class CommandOSNOOP : public Command
User *u2 = *it;
++it;
- if (u2 && is_oper(u2) && Anope::Match(u2->server->GetName(), server, true))
- kill_user(Config->s_OperServ, u2->nick, reason);
+ if (u2 && u2->HasMode(UMODE_OPER) && Anope::Match(u2->server->GetName(), server, true))
+ kill_user(Config->s_OperServ, u2, reason);
}
}
else if (cmd.equals_ci("REVOKE"))
diff --git a/modules/extra/cs_entrymsg.cpp b/modules/extra/cs_entrymsg.cpp
index aae1b5f0e..e44d21827 100644
--- a/modules/extra/cs_entrymsg.cpp
+++ b/modules/extra/cs_entrymsg.cpp
@@ -174,7 +174,7 @@ class CSEntryMessage : public Module
if (c->ci->GetExtRegular("cs_entrymsg", messages))
for (unsigned i = 0; i < messages.size(); ++i)
- u->SendMessage(whosends(c->ci)->nick, "[%s] %s", c->ci->name.c_str(), messages[i].message.c_str());
+ u->SendMessage(whosends(c->ci), "[%s] %s", c->ci->name.c_str(), messages[i].message.c_str());
}
}
diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp
index 9f4ade29c..2e5fa5965 100644
--- a/modules/extra/cs_set_misc.cpp
+++ b/modules/extra/cs_set_misc.cpp
@@ -173,7 +173,7 @@ class CSSetMisc : public Module
Anope::string value;
if (ci->GetExtRegular("chanserv:" + it->first, value))
- u->SendMessage(Config->s_ChanServ, " %s: %s", it->first.c_str(), value.c_str());
+ u->SendMessage(ChanServ, " %s: %s", it->first.c_str(), value.c_str());
}
}
diff --git a/modules/extra/m_alias.cpp b/modules/extra/m_alias.cpp
index de23557a3..3b9556772 100644
--- a/modules/extra/m_alias.cpp
+++ b/modules/extra/m_alias.cpp
@@ -66,7 +66,7 @@ class ModuleAlias : public Module
if (fantasy != alias.fantasy)
return EVENT_CONTINUE;
- else if (!is_oper(u) && alias.operonly)
+ else if (!u->HasMode(UMODE_OPER) && alias.operonly)
return EVENT_CONTINUE;
else if (!fantasy && !bi->nick.equals_ci(alias.client))
return EVENT_CONTINUE;
diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp
index 74b570ee2..59088792f 100644
--- a/modules/extra/m_xmlrpc_main.cpp
+++ b/modules/extra/m_xmlrpc_main.cpp
@@ -13,7 +13,7 @@ class XMLRPCUser : public User
this->server = Me;
}
- void SendMessage(const Anope::string &source, const Anope::string &msg)
+ void SendMessage(BotInfo *, const Anope::string &msg)
{
this->out += msg + "\n";
}
diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp
index 65dfadc2d..b38c98ae7 100644
--- a/modules/extra/ns_set_misc.cpp
+++ b/modules/extra/ns_set_misc.cpp
@@ -176,7 +176,7 @@ class NSSetMisc : public Module
Anope::string value;
if (na->nc->GetExtRegular("nickserv:" + it->first, value))
- u->SendMessage(Config->s_NickServ, " %s: %s", it->first.c_str(), value.c_str());
+ u->SendMessage(NickServ, " %s: %s", it->first.c_str(), value.c_str());
}
}
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 7c0a23112..0dc409b29 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -287,366 +287,263 @@ class BahamutIRCdProto : public IRCDProto
ircdproto->SendMode(NickServ, u, "+d %d", u->timestamp);
}
-} ircd_proto;
+};
-/* EVENT: SJOIN */
-bool event_sjoin(const Anope::string &source, const std::vector<Anope::string> &params)
+class BahamutIRCdMessage : public IRCdMessage
{
- 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)
+ public:
+ bool OnMode(const Anope::string &source, const std::vector<Anope::string> &params)
{
- c = new Channel(params[1], ts);
- c->SetFlag(CH_SYNCING);
+ if (params.size() < 3)
+ return true;
+
+ if (params[0][0] == '#' || params[0][0] == '&')
+ do_cmode(source, params[0], params[2], params[1]);
+ else
+ do_umode(source, params[0], params[1]);
+
+ return true;
}
- /* Our creation time is newer than what the server gave us */
- else if (c->creation_time > ts)
+
+ /*
+ ** NICK - new
+ ** source = NULL
+ ** parv[0] = nickname
+ ** parv[1] = hopcount
+ ** parv[2] = timestamp
+ ** parv[3] = modes
+ ** parv[4] = username
+ ** parv[5] = hostname
+ ** parv[6] = server
+ ** parv[7] = servicestamp
+ ** parv[8] = IP
+ ** parv[9] = info
+ ** NICK - change
+ ** source = oldnick
+ ** parv[0] = new nickname
+ ** parv[1] = hopcount
+ */
+ bool OnNick(const Anope::string &source, const std::vector<Anope::string> &params)
{
- c->creation_time = ts;
- c->Reset();
+ if (params.size() != 2)
+ {
+ User *user = do_nick(source, params[0], params[4], params[5], params[6], params[9], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[8], "", "", params[3]);
+ if (user)
+ {
+ NickAlias *na;
+ if (user->timestamp == convertTo<time_t>(params[7]) && (na = findnick(user->nick)))
+ {
+ user->Login(na->nc);
+ user->SetMode(NickServ, UMODE_REGISTERED);
+ }
+ else
+ validate_user(user);
+ }
+ }
+ else
+ do_nick(source, params[0], "", "", "", "", Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0, "", "", "", "");
- /* Reset mlock */
- check_modes(c);
+ return true;
}
- /* Their TS is newer than ours, our modes > theirs, unset their modes if need be */
- else if (ts > c->creation_time)
- keep_their_modes = false;
- /* If we need to keep their modes, and this SJOIN string contains modes */
- if (keep_their_modes && params.size() >= 4)
+ bool OnServer(const Anope::string &source, const std::vector<Anope::string> &params)
{
- /* Set the modes internally */
- 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);
+ do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[2], "");
+ return true;
}
- /* 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) && params.size() == 2)
+ bool OnTopic(const Anope::string &, const std::vector<Anope::string> &params)
{
- User *u = finduser(source);
- if (!u)
- Log(LOG_DEBUG) << "SJOIN for nonexistant user " << source << " on " << c->name;
- else
+ if (params.size() < 4)
+ return true;
+
+ Channel *c = findchan(params[0]);
+ if (!c)
{
- EventReturn MOD_RESULT;
- FOREACH_RESULT(I_OnPreJoinChannel, OnPreJoinChannel(u, c));
+ Log() << "TOPIC for nonexistant channel " << params[0];
+ return true;
+ }
+
+ c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);
+
+ return true;
+ }
- /* Add the user to the channel */
- c->JoinUser(u);
+ bool OnSJoin(const Anope::string &source, const std::vector<Anope::string> &params)
+ {
+ 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;
- /* Now set whatever modes this user is allowed to have on the channel */
- chan_set_correct_modes(u, c, 1);
+ if (!c)
+ {
+ c = new Channel(params[1], ts);
+ c->SetFlag(CH_SYNCING);
+ }
+ /* Our creation time is newer than what the server gave us */
+ else if (c->creation_time > ts)
+ {
+ c->creation_time = ts;
+ c->Reset();
+
+ /* Reset mlock */
+ check_modes(c);
+ }
+ /* Their TS is newer than ours, our modes > theirs, unset their modes if need be */
+ else if (ts > c->creation_time)
+ keep_their_modes = false;
- /* Check to see if modules want the user to join, if they do
- * check to see if they are allowed to join (CheckKick will kick/ban them)
- * Don't trigger OnJoinChannel event then as the user will be destroyed
- */
- if (MOD_RESULT == EVENT_STOP && (!c->ci || !c->ci->CheckKick(u)))
+ /* If we need to keep their modes, and this SJOIN string contains modes */
+ if (keep_their_modes && params.size() >= 4)
+ {
+ /* Set the modes internally */
+ 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 some reason, bahamut will send a SJOIN from the user joining a channel
+ * if the channel already existed
+ */
+ if (!c->HasFlag(CH_SYNCING) && params.size() == 2)
+ {
+ User *u = finduser(source);
+ if (!u)
+ Log(LOG_DEBUG) << "SJOIN for nonexistant user " << source << " on " << c->name;
+ else
{
- FOREACH_MOD(I_OnJoinChannel, OnJoinChannel(u, c));
+ EventReturn MOD_RESULT;
+ FOREACH_RESULT(I_OnPreJoinChannel, OnPreJoinChannel(u, c));
+
+ /* Add the user to the channel */
+ c->JoinUser(u);
+
+ /* Now set whatever modes this user is allowed to have on the channel */
+ chan_set_correct_modes(u, c, 1);
+
+ /* Check to see if modules want the user to join, if they do
+ * check to see if they are allowed to join (CheckKick will kick/ban them)
+ * Don't trigger OnJoinChannel event then as the user will be destroyed
+ */
+ if (MOD_RESULT == EVENT_STOP && (!c->ci || !c->ci->CheckKick(u)))
+ {
+ FOREACH_MOD(I_OnJoinChannel, OnJoinChannel(u, c));
+ }
}
}
- }
- else
- {
- spacesepstream sep(params[params.size() - 1]);
- Anope::string buf;
- while (sep.GetToken(buf))
+ else
{
- std::list<ChannelMode *> Status;
- char ch;
-
- /* Get prefixes from the nick */
- while ((ch = ModeManager::GetStatusChar(buf[0])))
+ spacesepstream sep(params[params.size() - 1]);
+ Anope::string buf;
+ while (sep.GetToken(buf))
{
- buf.erase(buf.begin());
- ChannelMode *cm = ModeManager::FindChannelModeByChar(ch);
- if (!cm)
+ std::list<ChannelMode *> Status;
+ char ch;
+
+ /* Get prefixes from the nick */
+ while ((ch = ModeManager::GetStatusChar(buf[0])))
{
- Log() << "Receeved unknown mode prefix " << buf[0] << " in SJOIN string";
- continue;
+ buf.erase(buf.begin());
+ ChannelMode *cm = ModeManager::FindChannelModeByChar(ch);
+ if (!cm)
+ {
+ Log() << "Receeved unknown mode prefix " << buf[0] << " in SJOIN string";
+ continue;
+ }
+
+ if (keep_their_modes)
+ Status.push_back(cm);
}
- if (keep_their_modes)
- Status.push_back(cm);
- }
+ User *u = finduser(buf);
+ if (!u)
+ {
+ Log(LOG_DEBUG) << "SJOIN for nonexistant user " << buf << " on " << c->name;
+ continue;
+ }
- User *u = finduser(buf);
- if (!u)
- {
- Log(LOG_DEBUG) << "SJOIN for nonexistant user " << buf << " on " << c->name;
- continue;
- }
+ EventReturn MOD_RESULT;
+ FOREACH_RESULT(I_OnPreJoinChannel, OnPreJoinChannel(u, c));
- EventReturn MOD_RESULT;
- FOREACH_RESULT(I_OnPreJoinChannel, OnPreJoinChannel(u, c));
+ /* Add the user to the channel */
+ c->JoinUser(u);
- /* Add the user to the channel */
- c->JoinUser(u);
+ /* Update their status internally on the channel
+ * This will enforce secureops etc on the user
+ */
+ for (std::list<ChannelMode *>::iterator it = Status.begin(), it_end = Status.end(); it != it_end; ++it)
+ c->SetModeInternal(*it, buf);
- /* Update their status internally on the channel
- * This will enforce secureops etc on the user
- */
- for (std::list<ChannelMode *>::iterator it = Status.begin(), it_end = Status.end(); it != it_end; ++it)
- c->SetModeInternal(*it, buf);
+ /* Now set whatever modes this user is allowed to have on the channel */
+ chan_set_correct_modes(u, c, 1);
- /* Now set whatever modes this user is allowed to have on the channel */
- chan_set_correct_modes(u, c, 1);
+ /* Check to see if modules want the user to join, if they do
+ * check to see if they are allowed to join (CheckKick will kick/ban them)
+ * Don't trigger OnJoinChannel event then as the user will be destroyed
+ */
+ if (MOD_RESULT != EVENT_STOP && c->ci && c->ci->CheckKick(u))
+ continue;
- /* Check to see if modules want the user to join, if they do
- * check to see if they are allowed to join (CheckKick will kick/ban them)
- * Don't trigger OnJoinChannel event then as the user will be destroyed
- */
- if (MOD_RESULT != EVENT_STOP && c->ci && c->ci->CheckKick(u))
- continue;
+ FOREACH_MOD(I_OnJoinChannel, OnJoinChannel(u, c));
+ }
+ }
- FOREACH_MOD(I_OnJoinChannel, OnJoinChannel(u, c));
+ /* Channel is done syncing */
+ if (c->HasFlag(CH_SYNCING))
+ {
+ /* Unset the syncing flag */
+ c->UnsetFlag(CH_SYNCING);
+ c->Sync();
}
- }
- /* Channel is done syncing */
- if (c->HasFlag(CH_SYNCING))
- {
- /* Unset the syncing flag */
- c->UnsetFlag(CH_SYNCING);
- c->Sync();
+ return true;
}
+};
- return true;
-}
-
-/*
-** NICK - new
-** source = NULL
-** parv[0] = nickname
-** parv[1] = hopcount
-** parv[2] = timestamp
-** parv[3] = modes
-** parv[4] = username
-** parv[5] = hostname
-** parv[6] = server
-** parv[7] = servicestamp
-** parv[8] = IP
-** parv[9] = info
-** NICK - change
-** source = oldnick
-** parv[0] = new nickname
-** parv[1] = hopcount
-*/
-bool event_nick(const Anope::string &source, const std::vector<Anope::string> &params)
+static bool event_xs(BotInfo *bi, const Anope::string &source, const std::vector<Anope::string> &params)
{
- User *user;
-
- if (params.size() != 2)
+ if (!params.empty() && bi)
{
- 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>(params[7]) && (na = findnick(user->nick)))
- {
- user->Login(na->nc);
- user->SetMode(NickServ, UMODE_REGISTERED);
- }
- else
- validate_user(user);
- }
+ std::vector<Anope::string> p;
+ p.push_back(bi->nick);
+ p.push_back(params[0]);
+ return ircdmessage->OnPrivmsg(source, p);
}
- else
- do_nick(source, params[0], "", "", "", "", Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0, "", "", "", "");
- return true;
-}
-/* EVENT : CAPAB */
-bool event_capab(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- CapabParse(params);
return true;
}
/* EVENT : OS */
bool event_os(const Anope::string &source, const std::vector<Anope::string> &params)
{
- if (!params.empty())
- m_privmsg(source, Config->s_OperServ, params[0]);
- return true;
+ return event_xs(OperServ, source, params);
}
/* EVENT : NS */
bool event_ns(const Anope::string &source, const std::vector<Anope::string> &params)
{
- if (!params.empty())
- m_privmsg(source, Config->s_NickServ, params[0]);
- return true;
+ return event_xs(NickServ, source, params);
}
/* EVENT : MS */
bool event_ms(const Anope::string &source, const std::vector<Anope::string> &params)
{
- if (!params.empty())
- m_privmsg(source, Config->s_MemoServ, params[0]);
- return true;
+ return event_xs(MemoServ, source, params);
}
/* EVENT : HS */
bool event_hs(const Anope::string &source, const std::vector<Anope::string> &params)
{
- if (!params.empty())
- m_privmsg(source, Config->s_HostServ, params[0]);
- return true;
+ return event_xs(HostServ, source, params);
}
/* EVENT : CS */
bool event_cs(const Anope::string &source, const std::vector<Anope::string> &params)
{
- if (!params.empty())
- m_privmsg(source, Config->s_ChanServ, params[0]);
- return true;
-}
-
-bool event_436(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- if (!params.empty())
- m_nickcoll(params[0]);
- return true;
-}
-
-/* EVENT : SERVER */
-bool event_server(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[2], "");
- return true;
-}
-
-/* EVENT : PRIVMSG */
-bool event_privmsg(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- if (params.size() > 1)
- m_privmsg(source, params[0], params[1]);
- return true;
-}
-
-bool event_part(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- if (!params.empty())
- do_part(source, params[0], params.size() > 1 ? params[1] : "");
- return true;
-}
-
-bool event_whois(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- if (!source.empty() && params.size() > 0)
- m_whois(source, params[0]);
- return true;
-}
-
-bool event_topic(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- if (params.size() < 4)
- return true;
-
- Channel *c = findchan(params[0]);
- if (!c)
- {
- Log() << "TOPIC for nonexistant channel " << params[0];
- return true;
- }
-
- c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);
-
- return true;
-}
-
-bool event_squit(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- if (params.size() > 0)
- do_squit(source, params[0]);
- return true;
-}
-
-bool event_quit(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- if (params.size() > 0)
- do_quit(source, params[0]);
- return true;
-}
-
-/* EVENT: MODE */
-bool event_mode(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- if (params.size() < 3)
- return true;
-
- if (params[0][0] == '#' || params[0][0] == '&')
- do_cmode(source, params[0], params[2], params[1]);
- else
- do_umode(source, params[0], params[1]);
- return true;
-}
-
-/* EVENT: KILL