diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/botserv.cpp | 24 | ||||
-rw-r--r-- | src/chanserv.cpp | 20 | ||||
-rw-r--r-- | src/hostserv.cpp | 24 | ||||
-rw-r--r-- | src/memoserv.cpp | 28 | ||||
-rw-r--r-- | src/messages.cpp | 48 | ||||
-rw-r--r-- | src/nickserv.cpp | 20 | ||||
-rw-r--r-- | src/operserv.cpp | 18 |
7 files changed, 35 insertions, 147 deletions
diff --git a/src/botserv.cpp b/src/botserv.cpp index 321060f29..381223681 100644 --- a/src/botserv.cpp +++ b/src/botserv.cpp @@ -67,26 +67,6 @@ void bs_init() /*************************************************************************/ -/* Main BotServ routine. */ - -void botserv(User *u, BotInfo *bi, const Anope::string &buf) -{ - if (!u || !bi || buf.empty()) - return; - - if (buf.substr(0, 6).equals_ci("\1PING ") && buf[buf.length() - 1] == '\1') - { - Anope::string command = buf; - command.erase(command.begin()); - command.erase(command.end()); - ircdproto->SendCTCP(bi, u->nick, "%s", command.c_str()); - } - else - mod_run_cmd(bi, u, buf); -} - -/*************************************************************************/ - /* Handles all messages that are sent to registered channels where a * bot is on. */ @@ -101,7 +81,7 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf) { Anope::string ctcp = buf; ctcp.erase(ctcp.begin()); - ctcp.erase(ctcp.end()); + ctcp.erase(ctcp.end() - 1); ircdproto->SendCTCP(ci->bi, u->nick, "%s", ctcp.c_str()); } @@ -366,7 +346,7 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf) if (!sep.StreamEnd()) bbuf += " " + sep.GetRemaining(); - chanserv(u, bbuf); + mod_run_cmd(ChanServ, u, bbuf); } FOREACH_MOD(I_OnBotFantasy, OnBotFantasy(token, u, ci, sep.GetRemaining())); diff --git a/src/chanserv.cpp b/src/chanserv.cpp index 8e2014426..2027303fb 100644 --- a/src/chanserv.cpp +++ b/src/chanserv.cpp @@ -238,26 +238,6 @@ void cs_init() /*************************************************************************/ -/* Main ChanServ routine. */ - -void chanserv(User *u, const Anope::string &buf) -{ - if (!u || buf.empty()) - return; - - if (buf.substr(0, 6).equals_ci("\1PING ") && buf[buf.length() - 1] == '\1') - { - Anope::string command = buf; - command.erase(command.begin()); - command.erase(command.end() - 1); - ircdproto->SendCTCP(ChanServ, u->nick, "%s", command.c_str()); - } - else - mod_run_cmd(ChanServ, u, buf); -} - -/*************************************************************************/ - /* Check the current modes on a channel; if they conflict with a mode lock, * fix them. */ diff --git a/src/hostserv.cpp b/src/hostserv.cpp index b4ccabacb..86e0c5c85 100644 --- a/src/hostserv.cpp +++ b/src/hostserv.cpp @@ -67,30 +67,6 @@ void hostserv_init() /*************************************************************************/ -/** - * Main HostServ routine. - * @param u User Struct - * @param buf Buffer holding the message - * @return void - */ -void hostserv(User *u, const Anope::string &buf) -{ - if (!u || buf.empty()) - return; - - if (buf.substr(0, 6).equals_ci("\1PING ") && buf[buf.length() - 1] == '\1') - { - Anope::string command = buf; - command.erase(command.begin()); - command.erase(command.end()); - ircdproto->SendCTCP(HostServ, u->nick, "%s", command.c_str()); - } - else if (!ircd->vhost) - notice_lang(Config.s_HostServ, u, SERVICE_OFFLINE, Config.s_HostServ.c_str()); - else - mod_run_cmd(HostServ, u, buf); -} - /** Set a vhost for the user * @param ident The ident * @param host The host diff --git a/src/memoserv.cpp b/src/memoserv.cpp index 28ddfba49..9a70b195e 100644 --- a/src/memoserv.cpp +++ b/src/memoserv.cpp @@ -39,34 +39,6 @@ void ms_init() } /*************************************************************************/ - -/** - * memoserv: Main MemoServ routine. - * Note that the User structure passed to the do_* routines will - * always be valid (non-NULL) and will always have a valid - * NickInfo pointer in the `ni' field. - * @param u User Struct - * @param buf Buffer containing the privmsg - * @return void - */ -void memoserv(User *u, const Anope::string &buf) -{ - if (!u || buf.empty()) - return; - - if (buf.substr(0, 6).equals_ci("\1PING ") && buf[buf.length() - 1] == '\1') - { - Anope::string command = buf; - command.erase(command.begin()); - command.erase(command.end()); - ircdproto->SendCTCP(MemoServ, u->nick, "%s", command.c_str()); - } - else - mod_run_cmd(MemoServ, u, buf); -} - -/*************************************************************************/ - /** * check_memos: See if the given user has any unread memos, and send a * NOTICE to that user if so (and if the appropriate flag is diff --git a/src/messages.cpp b/src/messages.cpp index 0ecefd7ef..0348eab4b 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -156,32 +156,50 @@ int m_privmsg(const Anope::string &source, const Anope::string &receiver, const if (bi) { - if (bi->nick.equals_ci(Config.s_OperServ)) + if (message[0] == '\1' && message[message.length() - 1] == '\1') { - if (!is_oper(u) && Config.OSOpersOnly) + if (message.substr(0, 6).equals_ci("\1PING ")) { - notice_lang(Config.s_OperServ, u, ACCESS_DENIED); - if (Config.WallBadOS) - ircdproto->SendGlobops(OperServ, "Denied access to %s from %s!%s@%s (non-oper)", Config.s_OperServ.c_str(), u->nick.c_str(), u->GetIdent().c_str(), u->host.c_str()); + Anope::string buf = message; + buf.erase(buf.begin()); + buf.erase(buf.end() - 1); + ircdproto->SendCTCP(bi, u->nick, "%s", buf.c_str()); + } + else if (message.substr(0, 9).equals_ci("\1VERSION\1")) + { + ircdproto->SendCTCP(bi, u->nick, "VERSION Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config.ServerName.c_str(), ircd->name, Config.EncModuleList.begin()->c_str(), Anope::Build().c_str()); } - else - operserv(u, message); } - else if (bi->nick.equals_ci(Config.s_NickServ)) - nickserv(u, message); + else if (bi->nick.equals_ci(Config.s_NickServ) || bi->nick.equals_ci(Config.s_MemoServ) || (!Config.s_BotServ.empty() && bi->nick.equals_ci(Config.s_BotServ))) + mod_run_cmd(bi, u, message); else if (bi->nick.equals_ci(Config.s_ChanServ)) { if (!is_oper(u) && Config.CSOpersOnly) notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); else - chanserv(u, message); + mod_run_cmd(bi, u, message); } - else if (bi->nick.equals_ci(Config.s_MemoServ)) - memoserv(u, message); else if (!Config.s_HostServ.empty() && bi->nick.equals_ci(Config.s_HostServ)) - hostserv(u, message); - else if (!Config.s_BotServ.empty() && bi->nick.equals_ci(Config.s_BotServ)) - botserv(u, bi, message); + { + if (!ircd->vhost) + notice_lang(Config.s_HostServ, u, SERVICE_OFFLINE, Config.s_HostServ.c_str()); + else + mod_run_cmd(bi, u, message); + } + else if (bi->nick.equals_ci(Config.s_OperServ)) + { + if (!is_oper(u) && Config.OSOpersOnly) + { + notice_lang(Config.s_OperServ, u, ACCESS_DENIED); + if (Config.WallBadOS) + ircdproto->SendGlobops(OperServ, "Denied access to %s from %s!%s@%s (non-oper)", Config.s_OperServ.c_str(), u->nick.c_str(), u->GetIdent().c_str(), u->host.c_str()); + } + else + { + Alog() << Config.s_OperServ << ": " << u->nick << ": " << message; + mod_run_cmd(bi, u, message); + } + } } } diff --git a/src/nickserv.cpp b/src/nickserv.cpp index 0ed7a2cdf..50eb67fed 100644 --- a/src/nickserv.cpp +++ b/src/nickserv.cpp @@ -153,26 +153,6 @@ void ns_init() /*************************************************************************/ -/* Main NickServ routine. */ - -void nickserv(User *u, const Anope::string &buf) -{ - if (!u || buf.empty()) - return; - - if (buf.substr(0, 6).equals_ci("\1PING ") && buf[buf.length() - 1] == '\1') - { - Anope::string command = buf; - command.erase(command.begin()); - command.erase(command.end()); - ircdproto->SendCTCP(NickServ, u->nick, "%s", command.c_str()); - } - else - mod_run_cmd(NickServ, u, buf); -} - -/*************************************************************************/ - /* Check whether a user is on the access list of the nick they're using If * not, send warnings as appropriate. If so (and not NI_SECURE), update * last seen info. diff --git a/src/operserv.cpp b/src/operserv.cpp index d66088b03..fd345cb8c 100644 --- a/src/operserv.cpp +++ b/src/operserv.cpp @@ -37,24 +37,6 @@ void os_init() XLineManager::RegisterXLineManager(SNLine = new SNLineManager()); } -void operserv(User *u, const Anope::string &buf) -{ - if (!u || buf.empty()) - return; - - Alog() << Config.s_OperServ << ": " << u->nick << ": " << buf; - - if (buf.substr(0, 6).equals_cs("\1PING ") && buf[buf.length() - 1] == '\1') - { - Anope::string command = buf; - command.erase(command.begin()); - command.erase(command.end()); - ircdproto->SendCTCP(OperServ, u->nick, "%s", command.c_str()); - } - else - mod_run_cmd(OperServ, u, buf); -} - bool SetDefConParam(ChannelModeName Name, const Anope::string &buf) { return DefConModesOnParams.insert(std::make_pair(Name, buf)).second; |