summaryrefslogtreecommitdiff
path: root/src/protocol.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-07-14 02:31:12 -0400
committerAdam <Adam@anope.org>2011-07-14 02:31:12 -0400
commitf858164deed48f2dcacd5ffc06a55398a54da7e8 (patch)
tree89c3cf36bd8e94942370135218d67d6d17ee222e /src/protocol.cpp
parent924f6849fee4598a1a3a7f1a98d96b79e5ffd3b4 (diff)
Rewrote how commands are handled within Anope.
This allows naming commands and having spaces within command names.
Diffstat (limited to 'src/protocol.cpp')
-rw-r--r--src/protocol.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp
index dc1c5960d..1c2ef4d7d 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -329,7 +329,7 @@ bool IRCdMessage::OnKill(const Anope::string &source, const std::vector<Anope::s
return true;
/* Recover if someone kills us. */
- if (!Config->s_BotServ.empty() && u->server == Me && (bi = dynamic_cast<BotInfo *>(u)))
+ if (u->server == Me && (bi = dynamic_cast<BotInfo *>(u)))
{
introduce_user(bi->nick);
bi->RejoinAll();
@@ -384,11 +384,10 @@ bool IRCdMessage::OnPrivmsg(const Anope::string &source, const std::vector<Anope
if (receiver[0] == '#')
{
- ChannelInfo *ci = cs_findchan(receiver);
- /* Some paranoia checks */
- if (ci && ci->c)
+ Channel *c = findchan(receiver);
+ if (c)
{
- FOREACH_MOD(I_OnPrivmsg, OnPrivmsg(u, ci, message));
+ FOREACH_MOD(I_OnPrivmsg, OnPrivmsg(u, c, message));
}
}
else
@@ -500,28 +499,22 @@ bool IRCdMessage::OnSQuit(const Anope::string &source, const std::vector<Anope::
bool IRCdMessage::OnWhois(const Anope::string &source, const std::vector<Anope::string> &params)
{
- const Anope::string &who = params[0];
-
- if (!source.empty() && !who.empty())
+ if (!source.empty() && !params.empty())
{
- User *u;
- BotInfo *bi = findbot(who);
- if (bi)
- {
- ircdproto->SendNumeric(Config->ServerName, 311, source, "%s %s %s * :%s", bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str());
- ircdproto->SendNumeric(Config->ServerName, 307, source, "%s :is a registered nick", bi->nick.c_str());
- ircdproto->SendNumeric(Config->ServerName, 312, source, "%s %s :%s", bi->nick.c_str(), Config->ServerName.c_str(), Config->ServerDesc.c_str());
- ircdproto->SendNumeric(Config->ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", bi->nick.c_str(), static_cast<long>(Anope::CurTime - bi->lastmsg), static_cast<long>(start_time));
- ircdproto->SendNumeric(Config->ServerName, 318, source, "%s :End of /WHOIS list.", who.c_str());
- }
- else if ((u = finduser(who)) && u->server == Me)
+ User *u = finduser(params[0]);
+ if (u && u->server == Me)
{
+ BotInfo *bi = findbot(u->nick);
ircdproto->SendNumeric(Config->ServerName, 311, source, "%s %s %s * :%s", u->nick.c_str(), u->GetIdent().c_str(), u->host.c_str(), u->realname.c_str());
+ if (bi)
+ ircdproto->SendNumeric(Config->ServerName, 307, source, "%s :is a registered nick", bi->nick.c_str());
ircdproto->SendNumeric(Config->ServerName, 312, source, "%s %s :%s", u->nick.c_str(), Config->ServerName.c_str(), Config->ServerDesc.c_str());
- ircdproto->SendNumeric(Config->ServerName, 318, source, "%s :End of /WHOIS list.", u->nick.c_str());
+ if (bi)
+ ircdproto->SendNumeric(Config->ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", bi->nick.c_str(), static_cast<long>(Anope::CurTime - bi->lastmsg), static_cast<long>(start_time));
+ ircdproto->SendNumeric(Config->ServerName, 318, source, "%s :End of /WHOIS list.", params[0].c_str());
}
else
- ircdproto->SendNumeric(Config->ServerName, 401, source, "%s :No such user.", who.c_str());
+ ircdproto->SendNumeric(Config->ServerName, 401, source, "%s :No such user.", params[0].c_str());
}
return true;