diff options
| author | Adam <Adam@anope.org> | 2011-04-25 03:16:57 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-05-16 04:07:56 -0400 |
| commit | 076ebafa1b4cc935c466c615b94eaac415af9a67 (patch) | |
| tree | dbc8b0f9e7b6f954569c13ad35598f5ebe8a081d | |
| parent | 6922bd239c778e8f6f2081476ce20b9426c515ad (diff) | |
Moved some global functions to be member functions and misc cleanup
| -rw-r--r-- | include/anope.h | 12 | ||||
| -rw-r--r-- | include/extern.h | 14 | ||||
| -rw-r--r-- | include/modules.h | 14 | ||||
| -rw-r--r-- | include/regchannel.h | 6 | ||||
| -rw-r--r-- | include/users.h | 6 | ||||
| -rw-r--r-- | modules/core/bs_bot.cpp | 12 | ||||
| -rw-r--r-- | modules/core/cs_akick.cpp | 13 | ||||
| -rw-r--r-- | modules/core/cs_info.cpp | 2 | ||||
| -rw-r--r-- | modules/core/enc_none.cpp | 4 | ||||
| -rw-r--r-- | modules/core/ns_ghost.cpp | 2 | ||||
| -rw-r--r-- | modules/core/os_noop.cpp | 2 | ||||
| -rw-r--r-- | modules/core/os_session.cpp | 2 | ||||
| -rw-r--r-- | modules/extra/os_defcon.cpp | 14 | ||||
| -rw-r--r-- | modules/protocol/bahamut.cpp | 8 | ||||
| -rw-r--r-- | modules/protocol/inspircd-ts6.h | 5 | ||||
| -rw-r--r-- | modules/protocol/plexus.cpp | 8 | ||||
| -rw-r--r-- | modules/protocol/ratbox.cpp | 8 | ||||
| -rw-r--r-- | modules/protocol/unreal32.cpp | 5 | ||||
| -rw-r--r-- | src/actions.cpp | 25 | ||||
| -rw-r--r-- | src/base64.cpp | 4 | ||||
| -rw-r--r-- | src/channels.cpp | 17 | ||||
| -rw-r--r-- | src/chanserv.cpp | 35 | ||||
| -rw-r--r-- | src/init.cpp | 4 | ||||
| -rw-r--r-- | src/main.cpp | 4 | ||||
| -rw-r--r-- | src/misc.cpp | 42 | ||||
| -rw-r--r-- | src/modulemanager.cpp | 92 | ||||
| -rw-r--r-- | src/modules.cpp | 100 | ||||
| -rw-r--r-- | src/operserv.cpp | 14 | ||||
| -rw-r--r-- | src/regchannel.cpp | 28 | ||||
| -rw-r--r-- | src/users.cpp | 33 |
30 files changed, 229 insertions, 306 deletions
diff --git a/include/anope.h b/include/anope.h index 7aa505661..fb201db1e 100644 --- a/include/anope.h +++ b/include/anope.h @@ -335,6 +335,18 @@ namespace Anope */ extern CoreExport void Unhex(const Anope::string &src, Anope::string &dest); extern CoreExport void Unhex(const Anope::string &src, char *dest); + + /** Base 64 encode a string + * @param src The string to encode + * @param target Where the encoded string is placed + */ + extern CoreExport void B64Encode(const Anope::string &src, Anope::string &target); + + /** Base 64 decode a string + * @param src The base64 encoded string + * @param target The plain text result + */ + extern CoreExport void B64Decode(const Anope::string &src, Anope::string &target); /** Returns a sequence of data formatted as the format argument specifies. ** After the format parameter, the function expects at least as many diff --git a/include/extern.h b/include/extern.h index 6ec3310e9..67bb72220 100644 --- a/include/extern.h +++ b/include/extern.h @@ -17,8 +17,6 @@ #include "hashcomp.h" -E void ModuleRunTimeDirCleanUp(); - /* IRC Variables */ E IRCDVar *ircd; @@ -27,7 +25,6 @@ E IRCdMessage *ircdmessage; /**** actions.c ****/ -E void kill_user(const Anope::string &source, User *user, const Anope::string &reason); E bool bad_password(User *u); E void common_unban(ChannelInfo *ci, User *u, bool full = false); @@ -51,7 +48,6 @@ E void do_cmode(const Anope::string &source, const Anope::string &channel, const E void do_join(const Anope::string &source, const Anope::string &channels, const Anope::string &ts); E void do_kick(const Anope::string &source, const Anope::string &channel, const Anope::string &users, const Anope::string &reason); E void do_part(const Anope::string &source, const Anope::string &channels, const Anope::string &reason); -E void MassChannelModes(BotInfo *bi, const Anope::string &modes); E void chan_set_correct_modes(User *user, Channel *c, int give_modes); @@ -71,7 +67,6 @@ E void update_cs_lastseen(User *user, ChannelInfo *ci); E int get_idealban(ChannelInfo *ci, User *u, Anope::string &ret); E int levelinfo_maxwidth; -E Anope::string get_mlock_modes(ChannelInfo *ci, int complete); /**** config.c ****/ @@ -187,7 +182,6 @@ E bool isvalidchar(char c); E Anope::string myStrGetToken(const Anope::string &str, char dilim, int token_number); E Anope::string myStrGetTokenRemainder(const Anope::string &str, char dilim, int token_number); E int myNumToken(const Anope::string &str, char dilim); -E void EnforceQlinedNick(const Anope::string &nick, const Anope::string &killer); E bool nickIsServices(const Anope::string &nick, bool bot); E void add_entropy_userkeys(); @@ -196,8 +190,6 @@ E unsigned char getrandom8(); E uint16 getrandom16(); E uint32 getrandom32(); -E char *str_signed(unsigned char *str); - E std::list<Anope::string> BuildStringList(const Anope::string &, char = ' '); E std::vector<Anope::string> BuildStringVector(const Anope::string &, char = ' '); @@ -251,13 +243,7 @@ E void do_umode(const Anope::string &user, const Anope::string &modes); E void do_kill(User *user, const Anope::string &reason); E bool matches_list(Channel *c, User *user, ChannelModeName mode); -E bool is_excepted_mask(ChannelInfo *ci, const Anope::string &mask); E Anope::string create_mask(User *u); -/******************************************************************************/ - -E void b64_encode(const Anope::string &src, Anope::string &target); -E void b64_decode(const Anope::string &src, Anope::string &target); - #endif /* EXTERN_H */ diff --git a/include/modules.h b/include/modules.h index badb59616..b03fca8b1 100644 --- a/include/modules.h +++ b/include/modules.h @@ -129,7 +129,6 @@ class Message; extern CoreExport Module *FindModule(const Anope::string &name); int protocol_module_init(); -extern CoreExport bool moduleMinVersion(int major, int minor, int patch, int build); enum ModuleReturn { @@ -1125,6 +1124,10 @@ class CoreExport ModuleManager */ static std::vector<Module *> EventHandlers[I_END]; + /** Clean up the module runtime directory + */ + static void CleanupRuntimeDirectory(); + /** Load up a list of modules. * @param module_list The list of modules to load **/ @@ -1144,6 +1147,15 @@ class CoreExport ModuleManager */ static ModuleReturn UnloadModule(Module *m, User * u); + /** Checks whether this version of Anope is at least major.minor.patch.build + * Throws a ModuleException if not + * @param major The major version + * @param minor The minor vesion + * @param patch The patch version + * @param build The build version + */ + static void RequireVersion(int major, int minor, int patch, int build); + /** Change the priority of one event in a module. * Each module event has a list of modules which are attached to that event type. If you wish to be called before or after other specific modules, you may use this * method (usually within void Module::Prioritize()) to set your events priority. You may use this call in other methods too, however, this is not supported behaviour diff --git a/include/regchannel.h b/include/regchannel.h index a3112cfbc..851c4a7d1 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -376,6 +376,12 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, */ ModeLock *GetMLock(ChannelModeName mname, const Anope::string ¶m = ""); + /** Get the current mode locks as a string + * @param complete True to show mlock parameters aswell + * @return A string of mode locks, eg: +nrt + */ + Anope::string GetMLockAsString(bool complete) const; + /** Check whether a user is permitted to be on this channel * @param u The user * @return true if they are allowed, false if they aren't and were kicked diff --git a/include/users.h b/include/users.h index dcfe219bf..fd6600326 100644 --- a/include/users.h +++ b/include/users.h @@ -284,6 +284,12 @@ class CoreExport User : public Extensible * @return true or false */ bool IsProtected() const; + + /** Kill a user + * @param source The user/server doing the kill + * @param reason The reason for the kill + */ + void Kill(const Anope::string &source, const Anope::string &reason); }; #endif // USERS_H diff --git a/modules/core/bs_bot.cpp b/modules/core/bs_bot.cpp index 64413b5f0..c7a898dc1 100644 --- a/modules/core/bs_bot.cpp +++ b/modules/core/bs_bot.cpp @@ -224,16 +224,16 @@ class CommandBSBot : public Command return MOD_CONT; } - /* The new nick is really different, so we remove the Q line for - the old nick. */ + /* The new nick is really different, so we remove the Q line for the old nick. */ if (ircd->sqline) { XLine x(bi->nick); ircdproto->SendSQLineDel(&x); } - /* We check whether user with this nick is online, and kill it if so */ - EnforceQlinedNick(nick, Config->s_BotServ); + /* Add a Q line for the new nick */ + XLine x(nick, "Reserved for services"); + ircdproto->SendSQLine(NULL, &x); } if (!user.empty()) @@ -241,8 +241,6 @@ class CommandBSBot : public Command else { ircdproto->SendChangeBotNick(bi, nick); - XLine x(bi->nick, "Reserved for services"); - ircdproto->SendSQLine(NULL, &x); } if (!nick.equals_cs(bi->nick)) @@ -258,8 +256,6 @@ class CommandBSBot : public Command if (!user.empty()) { ircdproto->SendClientIntroduction(bi, ircd->pseudoclient_mode); - XLine x(bi->nick, "Reserved for services"); - ircdproto->SendSQLine(NULL, &x); bi->RejoinAll(); } diff --git a/modules/core/cs_akick.cpp b/modules/core/cs_akick.cpp index e168bdb67..3aafbc537 100644 --- a/modules/core/cs_akick.cpp +++ b/modules/core/cs_akick.cpp @@ -192,10 +192,17 @@ class CommandCSAKick : public Command } /* Check excepts BEFORE we get this far */ - if (ModeManager::FindChannelModeByName(CMODE_EXCEPT) && is_excepted_mask(ci, mask)) + if (ci->c) { - source.Reply(_(CHAN_EXCEPTED), mask.c_str(), ci->name.c_str()); - return; + std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> modes = ci->c->GetModeList(CMODE_EXCEPT); + for (; modes.first != modes.second; ++modes.first) + { + if (Anope::Match(modes.first->second, mask)) + { + source.Reply(_(CHAN_EXCEPTED), mask.c_str(), ci->name.c_str()); + return; + } + } } /* Check whether target nick has equal/higher access diff --git a/modules/core/cs_info.cpp b/modules/core/cs_info.cpp index 19823004d..a899c2911 100644 --- a/modules/core/cs_info.cpp +++ b/modules/core/cs_info.cpp @@ -100,7 +100,7 @@ class CommandCSInfo : public Command CheckOptStr(optbuf, CI_NO_EXPIRE, _("No expire"), ci, u->Account()); source.Reply(_(NICK_INFO_OPTIONS), optbuf.empty() ? _("None") : optbuf.c_str()); - source.Reply(_(" Mode lock: %s"), get_mlock_modes(ci, 1).c_str()); + source.Reply(_(" Mode lock: %s"), ci->GetMLockAsString(true).c_str()); if (!ci->HasFlag(CI_NO_EXPIRE)) source.Reply(_(" Expires on: %s"), do_strftime(ci->last_used + Config->CSExpire).c_str()); diff --git a/modules/core/enc_none.cpp b/modules/core/enc_none.cpp index c1b403235..9f6b7ff72 100644 --- a/modules/core/enc_none.cpp +++ b/modules/core/enc_none.cpp @@ -25,7 +25,7 @@ class ENone : public Module { Anope::string buf = "plain:"; Anope::string cpass; - b64_encode(src, cpass); + Anope::B64Encode(src, cpass); buf += cpass; Log(LOG_DEBUG_2) << "(enc_none) hashed password from [" << src << "] to [" << buf << "]"; dest = buf; @@ -38,7 +38,7 @@ class ENone : public Module return EVENT_CONTINUE; size_t pos = src.find(':'); Anope::string buf = src.substr(pos + 1); - b64_decode(buf, dest); + Anope::B64Decode(buf, dest); return EVENT_ALLOW; } diff --git a/modules/core/ns_ghost.cpp b/modules/core/ns_ghost.cpp index d22b82472..955f25de7 100644 --- a/modules/core/ns_ghost.cpp +++ b/modules/core/ns_ghost.cpp @@ -69,7 +69,7 @@ class CommandNSGhost : public Command { Log(LOG_COMMAND, u, this) << "for " << nick; Anope::string buf = "GHOST command used by " + u->nick; - kill_user(Config->s_NickServ, user, buf); + user->Kill(Config->s_NickServ, buf); source.Reply(_("Ghost with your nick has been killed."), nick.c_str()); } } diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp index e86508d49..af25b900f 100644 --- a/modules/core/os_noop.cpp +++ b/modules/core/os_noop.cpp @@ -46,7 +46,7 @@ class CommandOSNOOP : public Command ++it; if (u2 && u2->HasMode(UMODE_OPER) && Anope::Match(u2->server->GetName(), server, true)) - kill_user(Config->s_OperServ, u2, reason); + u2->Kill(Config->s_OperServ, reason); } } else if (cmd.equals_ci("REVOKE")) diff --git a/modules/core/os_session.cpp b/modules/core/os_session.cpp index 4a3695796..dd93e555b 100644 --- a/modules/core/os_session.cpp +++ b/modules/core/os_session.cpp @@ -606,7 +606,7 @@ class OSSession : public Module if (!Config->SessionLimitDetailsLoc.empty()) u->SendMessage(operserv->Bot(), "%s", Config->SessionLimitDetailsLoc.c_str()); - kill_user(Config->s_OperServ, u, "Session limit exceeded"); + u->Kill(Config->s_OperServ, "Session limit exceeded"); ++session->hits; if (Config->MaxSessionKill && session->hits >= Config->MaxSessionKill && SGLine) diff --git a/modules/extra/os_defcon.cpp b/modules/extra/os_defcon.cpp index a2a536adf..0de1f1d33 100644 --- a/modules/extra/os_defcon.cpp +++ b/modules/extra/os_defcon.cpp @@ -436,7 +436,7 @@ class OSDefcon : public Module } if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) - kill_user(Config->s_OperServ, u, DConfig.akillreason); + u->Kill(Config->s_OperServ, DConfig.akillreason); return EVENT_STOP; } @@ -556,7 +556,7 @@ class OSDefcon : public Module if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) { - kill_user(Config->s_OperServ, u, DConfig.akillreason); + u->Kill(Config->s_OperServ, DConfig.akillreason); return; } } @@ -574,7 +574,7 @@ class OSDefcon : public Module if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) { - kill_user(Config->s_OperServ, u, DConfig.akillreason); + u->Kill(Config->s_OperServ, DConfig.akillreason); return; } @@ -590,7 +590,7 @@ class OSDefcon : public Module if (!Config->SessionLimitDetailsLoc.empty()) ircdproto->SendMessage(operserv->Bot(), u->nick, "%s", Config->SessionLimitDetailsLoc.c_str()); - kill_user(Config->s_OperServ, u, "Defcon session limit exceeded"); + u->Kill(Config->s_OperServ, "Defcon session limit exceeded"); ++session->hits; if (Config->MaxSessionKill && session->hits >= Config->MaxSessionKill) { @@ -651,7 +651,8 @@ void runDefCon() { Log(operserv->Bot(), "operserv/defcon") << "DEFCON: setting " << DConfig.chanmodes << " on all channels"; DefConModesSet = true; - MassChannelModes(operserv->Bot(), DConfig.chanmodes); + for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) + it->second->SetModes(operserv->Bot(), false, "%s", DConfig.chanmodes.c_str()); } } } @@ -666,7 +667,8 @@ void runDefCon() if (!newmodes.empty()) { Log(operserv->Bot(), "operserv/defcon") << "DEFCON: setting " << newmodes << " on all channels"; - MassChannelModes(operserv->Bot(), newmodes); + for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) + it->second->SetModes(operserv->Bot(), false, "%s", newmodes.c_str()); } } } diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index f4735132e..efe75b7ba 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -212,7 +212,8 @@ class BahamutIRCdProto : public IRCDProto void SendClientIntroduction(const User *u, const Anope::string &modes) { - EnforceQlinedNick(u->nick, Config->s_BotServ); + XLine x(u->nick, "Reserved for services"); + ircdproto->SendSQLine(NULL, &x); send_cmd("", "NICK %s 1 %ld %s %s %s %s 0 0 :%s", u->nick.c_str(), static_cast<long>(u->timestamp), modes.c_str(), u->GetIdent().c_str(), u->host.c_str(), u->server->GetName().c_str(), u->realname.c_str()); } @@ -248,7 +249,10 @@ class BahamutIRCdProto : public IRCDProto void SendChannel(Channel *c) { - send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), get_mlock_modes(c->ci, true).c_str()); + Anope::string modes = c->GetModes(true, true); + if (modes.empty()) + modes = "+"; + send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), modes.c_str()); } }; diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h index eaa02467b..a1b1d8df3 100644 --- a/modules/protocol/inspircd-ts6.h +++ b/modules/protocol/inspircd-ts6.h @@ -244,7 +244,10 @@ class InspIRCdTS6Proto : public IRCDProto void SendChannel(Channel *c) { - send_cmd(Config->Numeric, "FJOIN %s %ld %s :", c->name.c_str(), static_cast<long>(c->creation_time), get_mlock_modes(c->ci, true).c_str()); + Anope::string modes = c->GetModes(true, true); + if (modes.empty()) + modes = "+"; + send_cmd(Config->Numeric, "FJOIN %s %ld %s :", c->name.c_str(), static_cast<long>(c->creation_time), modes.c_str()); } bool IsNickValid(const Anope::string &nick) diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index a078e6b77..84faec449 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -166,7 +166,8 @@ class PlexusProto : public IRCDProto void SendClientIntroduction(const User *u, const Anope::string &modes) { - EnforceQlinedNick(u->nick, ""); + XLine x(u->nick, "Reserved for services"); + ircdproto->SendSQLine(NULL, &x); send_cmd(Config->Numeric, "UID %s 1 %ld %s %s %s 255.255.255.255 %s 0 %s :%s", u->nick.c_str(), static_cast<long>(u->timestamp), modes.c_str(), u->GetIdent().c_str(), u->host.c_str(), u->GetUID().c_str(), u->host.c_str(), u->realname.c_str()); } @@ -228,7 +229,10 @@ class PlexusProto : public IRCDProto void SendChannel(Channel *c) { - send_cmd(Config->Numeric, "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), get_mlock_modes(c->ci, true).c_str()); + Anope::string modes = c->GetModes(true, true); + if (modes.empty()) + modes = "+"; + send_cmd(Config->Numeric, "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), modes.c_str()); } }; diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 11d4ccfe6..1ca9459a8 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -169,7 +169,8 @@ class RatboxProto : public IRCDProto void SendClientIntroduction(const User *u, const Anope::string &modes) { - EnforceQlinedNick(u->nick, ""); + XLine x(u->nick, "Reserved for services"); + ircdproto->SendSQLine(NULL, &x); send_cmd(Config->Numeric, "UID %s 1 %ld %s %s %s 0 %s :%s", u->nick.c_str(), static_cast<long>(u->timestamp), modes.c_str(), u->GetIdent().c_str(), u->host.c_str(), u->GetUID().c_str(), u->realname.c_str()); } @@ -223,7 +224,10 @@ class RatboxProto : public IRCDProto void SendChannel(Channel *c) { - send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), get_mlock_modes(c->ci, true).c_str()); + Anope::string modes = c->GetModes(true, true); + if (modes.empty()) + modes = "+"; + send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), modes.c_str()); } bool IsNickValid(const Anope::string &nick) diff --git a/modules/protocol/unreal32.cpp b/modules/protocol/unreal32.cpp index 7e874838d..be7407af7 100644 --- a/modules/protocol/unreal32.cpp +++ b/modules/protocol/unreal32.cpp @@ -141,7 +141,8 @@ class UnrealIRCdProto : public IRCDProto void SendClientIntroduction(const User *u, const Anope::string &modes) { - EnforceQlinedNick(u->nick, Config->ServerName); + XLine x(u->nick, "Reserved for services"); + ircdproto->SendSQLine(NULL, &x); send_cmd("", "& %s 1 %ld %s %s %s 0 %s %s * :%s", u->nick.c_str(), static_cast<long>(u->timestamp), u->GetIdent().c_str(), u->host.c_str(), Config->ServerName.c_str(), modes.c_str(), u->host.c_str(), u->realname.c_str()); } @@ -513,7 +514,7 @@ class Unreal32IRCdMessage : public IRCdMessage else if (params.size() == 11) { Anope::string decoded_ip; - b64_decode(params[9], decoded_ip); + Anope::B64Decode(params[9], decoded_ip); sockaddrs ip; ip.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str()); diff --git a/src/actions.cpp b/src/actions.cpp index 4d4dd7d0c..62b5bf582 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -30,7 +30,7 @@ bool bad_password(User *u) u->invalid_pw_time = Anope::CurTime; if (u->invalid_pw_count >= Config->BadPassLimit) { - kill_user("", u, "Too many invalid passwords"); + u->Kill(Config->ServerName, "Too many invalid passwords"); return true; } @@ -39,29 +39,6 @@ bool bad_password(User *u) /*************************************************************************/ -/** - * Remove a user from the IRC network. - * @param source is the nick which should generate the kill, or empty for a server-generated kill. - * @param user to remove - * @param reason for the kill - * @return void - */ -void kill_user(const Anope::string &source, User *user, const Anope::string &reason) -{ - if (!user) - return; - - Anope::string real_source = source.empty() ? Config->ServerName : source; - - Anope::string buf = real_source + " (" + reason + ")"; - - ircdproto->SendSVSKill(findbot(source), user, "%s", buf.c_str()); - - if (!ircd->quitonkill) - do_kill(user, buf); -} - -/*************************************************************************/ /** * Unban the user from a channel diff --git a/src/base64.cpp b/src/base64.cpp index f4d3de134..cade55e4a 100644 --- a/src/base64.cpp +++ b/src/base64.cpp @@ -77,7 +77,7 @@ static const char Pad64 = '='; characters followed by one "=" padding character. */ -void b64_encode(const Anope::string &src, Anope::string &target) +void Anope::B64Encode(const Anope::string &src, Anope::string &target) { size_t src_pos = 0, src_len = src.length(); unsigned char input[3]; @@ -118,7 +118,7 @@ void b64_encode(const Anope::string &src, Anope::string &target) src from base - 64 numbers into three 8 bit bytes in the target area. */ -void b64_decode(const Anope::string &src, Anope::string &target) +void Anope::B64Decode(const Anope::string &src, Anope::string &target) { target.clear(); diff --git a/src/channels.cpp b/src/channels.cpp index 29e34cfaf..1c852aae2 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -1168,23 +1168,6 @@ void chan_set_correct_modes(User *user, Channel *c, int give_modes) /*************************************************************************/ -/** Set modes on every channel - * This overrides mlock on channels - * @param bi The bot to send the modes from - * @param modes The modes - */ -void MassChannelModes(BotInfo *bi, const Anope::string &modes) -{ - for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) - { - Channel *c = it->second; - - if (c->bouncy_modes) - return; - c->SetModes(bi, false, "%s", modes.c_str()); - } -} - static const Anope::string EntryFlagString[] = { "ENTRYTYPE_NONE", "ENTRYTYPE_CIDR", "ENTRYTYPE_NICK_WILD", "ENTRYTYPE_NICK", "ENTRYTYPE_USER_WILD", "ENTRYTYPE_USER", "ENTRYTYPE_HOST_WILD", "ENTRYTYPE_HOST", "" }; /** Constructor diff --git a/src/chanserv.cpp b/src/chanserv.cpp index fe86cdae3..f850b5f6a 100644 --- a/src/chanserv.cpp +++ b/src/chanserv.cpp @@ -106,41 +106,6 @@ int levelinfo_maxwidth = 0; /*************************************************************************/ -/* Returns modes for mlock in a nice way. */ - -Anope::string get_mlock_modes(ChannelInfo *ci, int complete) -{ - if (!ci) - return ""; - - Anope::string pos = "+", neg = "-", params; - - for (std::multimap<ChannelModeName, ModeLock>::const_iterator it = ci->GetMLock().begin(), it_end = ci->GetMLock().end(); it != it_end; ++it) - { - const ModeLock &ml = it->second; - ChannelMode *cm = ModeManager::FindChannelModeByName(ml.name); - if (!cm || cm->Type == MODE_LIST || cm->Type == MODE_STATUS) - continue; - - if (ml.set) - pos += cm->ModeChar; - else - neg += cm->ModeChar; - - if (complete && !ml.param.empty() && cm->Type == MODE_PARAM) - params += " " + ml.param; - } - - if (pos.length() == 1) - pos.clear(); - if (neg.length() == 1) - neg.clear(); - - return pos + neg + params; -} - -/*************************************************************************/ - /* Check the current modes on a channel; if they conflict with a mode lock, * fix them. */ diff --git a/src/init.cpp b/src/init.cpp index f79de5a34..c508b75ea 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -209,10 +209,6 @@ static void write_pidfile() /*************************************************************************/ -/* Overall initialization routines. Return 0 on success, -1 on failure. */ - -int openlog_failed = 0, openlog_errno = 0; - void Init(int ac, char **av) { int started_from_term = isatty(0) && isatty(1) && isatty(2); diff --git a/src/main.cpp b/src/main.cpp index fd3ab52d5..53e348e69 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -205,7 +205,7 @@ static void services_shutdown() FOREACH_MOD(I_OnShutdown, OnShutdown()); ModuleManager::UnloadAll(); /* just in case they weren't all removed at least run once */ - ModuleRunTimeDirCleanUp(); + ModuleManager::CleanupRuntimeDirectory(); } /*************************************************************************/ @@ -402,7 +402,7 @@ int main(int ac, char **av, char **envp) #endif /* Clean out the module runtime directory prior to running, just in case files were left behind during a previous run */ - ModuleRunTimeDirCleanUp(); + ModuleManager::CleanupRuntimeDirectory(); /* General initialization first */ Init(ac, av); diff --git a/src/misc.cpp b/src/misc.cpp index 90239a886..fff224eed 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -455,28 +455,6 @@ Anope::string myStrGetTokenRemainder(const Anope::string &str, const char dilim, /*************************************************************************/ /** - * Kill the user to enforce the sqline - * @param nick to kill - * @param killer whom is doing the killing - * @return void - */ -void EnforceQlinedNick(const Anope::string &nick, const Anope::string &killer) -{ - if (findbot(nick)) - return; - - User *u2 = finduser(nick); - - if (u2) - { - Log(LOG_NORMAL, "xline") << "Killed Q-lined nick: " << u2->GetMask(); - kill_user(killer, u2, "This nick is reserved for Services. Please use a non Q-Lined nick."); - } -} - -/*************************************************************************/ - -/** * Is the given nick a network service * @param nick to check * @param int Check if botserv bots @@ -691,26 +669,6 @@ std::vector<Anope::string> BuildStringVector(const Anope::string &src, char deli /*************************************************************************/ -/** - * Change an unsigned string to a signed string, overwriting the original - * string. - * @param input string - * @return output string, same as input string. - */ - -char *str_signed(unsigned char *str) -{ |
