X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmode.cpp;h=b3f05bd3710639237bbcb7ac209c271baa2bbfe0;hb=da074814501f23680b579feb1ad649c86e8a1348;hp=0229eddb12a288e6b9ee46be49ceb06873964508;hpb=569114e4c2f8ef8b14d48d4a94d7226e7f87eaff;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/mode.cpp b/src/mode.cpp index 0229eddb1..b3f05bd37 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -11,11 +11,13 @@ * --------------------------------------------------- */ +/* $Core: libIRCDmode */ +/* $ExtraDeps: $(RELCPPFILES) */ +/* $ExtraObjects: modes/modeclasses.a */ +/* $ExtraBuild: @${MAKE} -C "modes" DIRNAME="src/modes" CC="$(CC)" $(MAKEARGS) CPPFILES="$(CPPFILES)" */ + #include "inspircd.h" -#include "users.h" -#include "modules.h" #include "inspstring.h" -#include "mode.h" /* +s (secret) */ #include "modes/cmode_s.h" @@ -52,8 +54,8 @@ /* +n (notice mask - our implementation of snomasks) */ #include "modes/umode_n.h" -ModeHandler::ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly, char mprefix) - : ServerInstance(Instance), mode(modeletter), n_params_on(parameters_on), n_params_off(parameters_off), list(listmode), m_type(type), oper(operonly), prefix(mprefix), count(0) +ModeHandler::ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly, char mprefix, char prefixrequired) + : ServerInstance(Instance), mode(modeletter), n_params_on(parameters_on), n_params_off(parameters_off), list(listmode), m_type(type), oper(operonly), prefix(mprefix), count(0), prefixneeded(prefixrequired) { } @@ -66,6 +68,16 @@ bool ModeHandler::IsListMode() return list; } +char ModeHandler::GetNeededPrefix() +{ + return prefixneeded; +} + +void ModeHandler::SetNeededPrefix(char needsprefix) +{ + prefixneeded = needsprefix; +} + unsigned int ModeHandler::GetPrefixRank() { return 0; @@ -79,6 +91,7 @@ unsigned int ModeHandler::GetCount() void ModeHandler::ChangeCount(int modifier) { count += modifier; + ServerInstance->Logs->Log("MODE", DEBUG,"Change count for mode %c is now %d", mode, count); } ModeType ModeHandler::GetModeType() @@ -106,12 +119,12 @@ char ModeHandler::GetModeChar() return mode; } -ModeAction ModeHandler::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) +ModeAction ModeHandler::OnModeChange(User*, User*, Channel*, std::string&, bool, bool) { return MODEACTION_DENY; } -ModePair ModeHandler::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) +ModePair ModeHandler::ModeSet(User*, User* dest, Channel* channel, const std::string&) { if (dest) { @@ -123,11 +136,15 @@ ModePair ModeHandler::ModeSet(userrec* source, userrec* dest, chanrec* channel, } } -void ModeHandler::DisplayList(userrec* user, chanrec* channel) +void ModeHandler::DisplayList(User*, Channel*) +{ +} + +void ModeHandler::DisplayEmptyList(User*, Channel*) { } -bool ModeHandler::CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) +bool ModeHandler::CheckTimeStamp(time_t theirs, time_t ours, const std::string&, const std::string&, Channel*) { return (ours < theirs); } @@ -150,18 +167,18 @@ ModeType ModeWatcher::GetModeType() return m_type; } -bool ModeWatcher::BeforeMode(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding, ModeType type) +bool ModeWatcher::BeforeMode(User*, User*, Channel*, std::string&, bool, ModeType, bool) { return true; } -void ModeWatcher::AfterMode(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter, bool adding, ModeType type) +void ModeWatcher::AfterMode(User*, User*, Channel*, const std::string&, bool, ModeType, bool) { } -userrec* ModeParser::SanityChecks(userrec *user,const char *dest,chanrec *chan,int status) +User* ModeParser::SanityChecks(User *user, const char *dest, Channel *chan, int) { - userrec *d; + User *d; if ((!user) || (!dest) || (!chan) || (!*dest)) { return NULL; @@ -175,7 +192,7 @@ userrec* ModeParser::SanityChecks(userrec *user,const char *dest,chanrec *chan,i return d; } -const char* ModeParser::Grant(userrec *d,chanrec *chan,int MASK) +const char* ModeParser::Grant(User *d,Channel *chan,int MASK) { if (!chan) return ""; @@ -205,7 +222,7 @@ const char* ModeParser::Grant(userrec *d,chanrec *chan,int MASK) return ""; } -const char* ModeParser::Revoke(userrec *d,chanrec *chan,int MASK) +const char* ModeParser::Revoke(User *d,Channel *chan,int MASK) { if (!chan) return ""; @@ -235,7 +252,7 @@ const char* ModeParser::Revoke(userrec *d,chanrec *chan,int MASK) return ""; } -void ModeParser::DisplayCurrentModes(userrec *user, userrec* targetuser, chanrec* targetchannel, const char* text) +void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targetchannel, const char* text) { if (targetchannel) { @@ -246,11 +263,17 @@ void ModeParser::DisplayCurrentModes(userrec *user, userrec* targetuser, chanrec } else if (targetuser) { - if ((targetuser == user) || (*user->oper)) + if (targetuser->Visibility && !targetuser->Visibility->VisibleTo(user)) + { + user->WriteServ("401 %s %s :No such nick/channel",user->nick, text); + return; + } + + if ((targetuser == user) || (IS_OPER(user))) { /* Display user's current mode string */ user->WriteServ("221 %s :+%s",targetuser->nick,targetuser->FormatModes()); - if (*targetuser->oper) + if (IS_OPER(targetuser)) user->WriteServ("008 %s +%s :Server notice mask", targetuser->nick, targetuser->FormatNoticeMasks()); return; } @@ -266,15 +289,15 @@ void ModeParser::DisplayCurrentModes(userrec *user, userrec* targetuser, chanrec return; } -void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool servermode) +void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bool servermode) { std::string target = parameters[0]; ModeType type = MODETYPE_USER; unsigned char mask = 0; - chanrec* targetchannel = ServerInstance->FindChan(parameters[0]); - userrec* targetuser = ServerInstance->FindNick(parameters[0]); + Channel* targetchannel = ServerInstance->FindChan(parameters[0]); + User* targetuser = ServerInstance->FindNick(parameters[0]); - LastParse = ""; + LastParse.clear(); /* Special case for displaying the list for listmodes, * e.g. MODE #chan b, or MODE #chan +b without a parameter @@ -291,18 +314,20 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool while (mode && *mode) { + unsigned char mletter = *mode; + if (*mode == '+') { mode++; continue; } - + /* Ensure the user doesnt request the same mode twice, * so they cant flood themselves off out of idiocy. */ - if (!sent[*mode]) + if (!sent[mletter]) { - sent[*mode] = true; + sent[mletter] = true; } else { @@ -310,17 +335,26 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool continue; } - if (ServerInstance->Config->HideModeLists[*mode] && (targetchannel->GetStatus(user) < STATUS_HOP)) - { - user->WriteServ("482 %s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++); - continue; - } - ModeHandler *mh = this->FindMode(*mode, MODETYPE_CHANNEL); bool display = true; if ((mh) && (mh->IsListMode())) { + int MOD_RESULT = 0; + FOREACH_RESULT(I_OnRawMode, OnRawMode(user, targetchannel, *mode, "", true, 0)); + if (MOD_RESULT == ACR_DENY) + { + mode++; + continue; + } + + if (ServerInstance->Config->HideModeLists[mletter] && (targetchannel->GetStatus(user) < STATUS_HOP)) + { + user->WriteServ("482 %s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++); + mh->DisplayEmptyList(user, targetchannel); + continue; + } + /** See below for a description of what craq this is :D */ unsigned char handler_id = (*mode - 65) | mask; @@ -353,6 +387,8 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool } else if (pcnt > 1) { + bool SkipAccessChecks = false; + if (targetchannel) { type = MODETYPE_CHANNEL; @@ -362,27 +398,14 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool * (e.g. are they a (half)op? */ - if ((IS_LOCAL(user)) && (targetchannel->GetStatus(user) < STATUS_HOP)) + if ((IS_LOCAL(user)) && (!ServerInstance->ULine(user->server)) && (!servermode)) { /* We don't have halfop */ int MOD_RESULT = 0; FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user, NULL, targetchannel, AC_GENERAL_MODE)); if (MOD_RESULT == ACR_DENY) return; - - if (MOD_RESULT == ACR_DEFAULT) - { - /* Are we a uline or is it a servermode? */ - if ((!ServerInstance->ULine(user->server)) && (!servermode)) - { - /* Not enough permission: - * NOT a uline and NOT a servermode, - * OR, NOT halfop or above. - */ - user->WriteServ("482 %s %s :You're not a channel (half)operator",user->nick, targetchannel->name); - return; - } - } + SkipAccessChecks = (MOD_RESULT == ACR_ALLOW); } } else if (targetuser) @@ -403,9 +426,9 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool } std::string mode_sequence = parameters[1]; - std::string parameter = ""; + std::string parameter; std::ostringstream parameter_list; - std::string output_sequence = ""; + std::string output_sequence; bool adding = true, state_change = false; unsigned char handler_id = 0; int parameter_counter = 2; /* Index of first parameter */ @@ -467,6 +490,8 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool if (modehandlers[handler_id]->GetModeType() == type) { + int MOD_RESULT = 0; + if (modehandlers[handler_id]->GetNumParams(adding)) { /* This mode expects a parameter, do we have any parameters left in our list to use? */ @@ -476,7 +501,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool /* Yerk, invalid! */ if ((parameter.find(':') == 0) || (parameter.rfind(' ') != std::string::npos)) - parameter = ""; + parameter.clear(); } else { @@ -484,42 +509,88 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool continue; } - bool had_parameter = !parameter.empty(); - - for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++) + FOREACH_RESULT(I_OnRawMode, OnRawMode(user, targetchannel, modechar, parameter, adding, 1, servermode)); + } + else + { + FOREACH_RESULT(I_OnRawMode, OnRawMode(user, targetchannel, modechar, "", adding, 0, servermode)); + } + + if (IS_LOCAL(user) && (MOD_RESULT == ACR_DENY)) + continue; + + if (!SkipAccessChecks && IS_LOCAL(user) && (MOD_RESULT != ACR_ALLOW)) + { + ServerInstance->Logs->Log("MODE", DEBUG,"Enter minimum prefix check"); + /* Check access to this mode character */ + if ((type == MODETYPE_CHANNEL) && (modehandlers[handler_id]->GetNeededPrefix())) { - if ((*watchers)->BeforeMode(user, targetuser, targetchannel, parameter, adding, type) == false) - { - abort = true; - break; - } - /* A module whacked the parameter completely, and there was one. abort. */ - if ((had_parameter) && (parameter.empty())) + char needed = modehandlers[handler_id]->GetNeededPrefix(); + ModeHandler* prefixmode = FindPrefix(needed); + ServerInstance->Logs->Log("MODE", DEBUG,"Needed prefix: %c", needed); + + /* If the mode defined by the handler is not '\0', but the handler for it + * cannot be found, they probably dont have the right module loaded to implement + * the prefix they want to compare the mode against, e.g. '&' for m_chanprotect. + * Revert to checking against the minimum core prefix, '%'. + */ + if (needed && !prefixmode) + prefixmode = FindPrefix('%'); + + unsigned int neededrank = prefixmode->GetPrefixRank(); + /* Compare our rank on the channel against the rank of the required prefix, + * allow if >= ours. Because mIRC and xchat throw a tizz if the modes shown + * in NAMES(X) are not in rank order, we know the most powerful mode is listed + * first, so we don't need to iterate, we just look up the first instead. + */ + std::string modestring = targetchannel->GetAllPrefixChars(user); + char ml = (modestring.empty() ? '\0' : modestring[0]); + ModeHandler* ourmode = FindPrefix(ml); + if (!ourmode || ourmode->GetPrefixRank() < neededrank) { - abort = true; - break; + /* Bog off */ + user->WriteServ("482 %s %s :You must have channel privilege %c or above to %sset channel mode %c", + user->nick, targetchannel->name, needed, adding ? "" : "un", modechar); + continue; } } + } - if (abort) - continue; + bool had_parameter = !parameter.empty(); + + for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++) + { + if ((*watchers)->BeforeMode(user, targetuser, targetchannel, parameter, adding, type, servermode) == false) + { + abort = true; + break; + } + /* A module whacked the parameter completely, and there was one. abort. */ + if ((had_parameter) && (parameter.empty())) + { + abort = true; + break; + } } + if (abort) + continue; + /* It's an oper only mode, check if theyre an oper. If they arent, * eat any parameter that came with the mode, and continue to next */ - if ((IS_LOCAL(user)) && (modehandlers[handler_id]->NeedsOper()) && (!*user->oper)) + if ((IS_LOCAL(user)) && (modehandlers[handler_id]->NeedsOper()) && (!IS_OPER(user))) { - user->WriteServ("481 %s :Permission Denied- Only IRC operators may %sset %s mode %c", user->nick, + user->WriteServ("481 %s :Permission Denied - Only IRC operators may %sset %s mode %c", user->nick, adding ? "" : "un", type == MODETYPE_CHANNEL ? "channel" : "user", modehandlers[handler_id]->GetModeChar()); continue; } /* Call the handler for the mode */ - ModeAction ma = modehandlers[handler_id]->OnModeChange(user, targetuser, targetchannel, parameter, adding); + ModeAction ma = modehandlers[handler_id]->OnModeChange(user, targetuser, targetchannel, parameter, adding, servermode); - if ((modehandlers[handler_id]->GetNumParams(adding)) && (parameter == "")) + if ((modehandlers[handler_id]->GetNumParams(adding)) && (parameter.empty())) { /* The handler nuked the parameter and they are supposed to have one. * We CANT continue now, even if they actually returned MODEACTION_ALLOW, @@ -541,15 +612,17 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool /* Add the mode letter */ output_sequence.push_back(modechar); + modehandlers[handler_id]->ChangeCount(adding ? 1 : -1); + /* Is there a valid parameter for this mode? If so add it to the parameter list */ - if ((modehandlers[handler_id]->GetNumParams(adding)) && (parameter != "")) + if ((modehandlers[handler_id]->GetNumParams(adding)) && (!parameter.empty())) { parameter_list << " " << parameter; parameter_count++; /* Does this mode have a prefix? */ if (modehandlers[handler_id]->GetPrefix() && targetchannel) { - userrec* user_to_prefix = ServerInstance->FindNick(parameter); + User* user_to_prefix = ServerInstance->FindNick(parameter); if (user_to_prefix) targetchannel->SetPrefix(user_to_prefix, modehandlers[handler_id]->GetPrefix(), modehandlers[handler_id]->GetPrefixRank(), adding); @@ -558,7 +631,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool /* Call all the AfterMode events in the mode watchers for this mode */ for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++) - (*watchers)->AfterMode(user, targetuser, targetchannel, parameter, adding, type); + (*watchers)->AfterMode(user, targetuser, targetchannel, parameter, adding, type, servermode); /* Reset the state change flag */ state_change = false; @@ -576,13 +649,14 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool else { /* No mode handler? Unknown mode character then. */ - user->WriteServ("472 %s %c :is unknown mode char to me",user->nick, modechar); + user->WriteServ("%d %s %c :is unknown mode char to me", type == MODETYPE_CHANNEL ? 472 : 501, user->nick, modechar); } break; } } + /* Was there at least one valid mode in the sequence? */ - if (output_sequence != "") + if (!output_sequence.empty()) { if (servermode) { @@ -658,7 +732,7 @@ void ModeParser::CleanMask(std::string &mask) } } -bool ModeParser::AddMode(ModeHandler* mh, unsigned const char modeletter) +bool ModeParser::AddMode(ModeHandler* mh) { unsigned char mask = 0; unsigned char pos = 0; @@ -667,7 +741,7 @@ bool ModeParser::AddMode(ModeHandler* mh, unsigned const char modeletter) * If they do that, thats their problem, and if i ever EVER see an * official InspIRCd developer do that, i'll beat them with a paddle! */ - if ((mh->GetModeChar() < 'A') || (mh->GetModeChar() > 'z')) + if ((mh->GetModeChar() < 'A') || (mh->GetModeChar() > 'z') || (mh->GetPrefix() > 126)) return false; /* A mode prefix of ',' is not acceptable, it would fuck up server to server. @@ -704,7 +778,7 @@ bool ModeParser::DelMode(ModeHandler* mh) switch (mh->GetModeType()) { case MODETYPE_USER: - for (user_hash::iterator i = ServerInstance->clientlist->begin(); i != ServerInstance->clientlist->end(); i++) + for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); i++) { mh->RemoveMode(i->second); } @@ -759,6 +833,9 @@ std::string ModeParser::ChannelModeList() for (unsigned char mode = 'A'; mode <= 'z'; mode++) { + if ((!ServerInstance->Config->AllowHalfop) && (mode == 'h')) + continue; + unsigned char pos = (mode-65) | MASK_CHANNEL; if (modehandlers[pos]) @@ -775,6 +852,9 @@ std::string ModeParser::ParaModeList() for (unsigned char mode = 'A'; mode <= 'z'; mode++) { + if ((!ServerInstance->Config->AllowHalfop) && (mode == 'h')) + continue; + unsigned char pos = (mode-65) | MASK_CHANNEL; if ((modehandlers[pos]) && (modehandlers[pos]->GetNumParams(true))) @@ -798,7 +878,7 @@ ModeHandler* ModeParser::FindPrefix(unsigned const char pfxletter) return NULL; } -std::string ModeParser::ModeString(userrec* user, chanrec* channel) +std::string ModeParser::ModeString(User* user, Channel* channel) { std::string types; std::string pars; @@ -835,6 +915,9 @@ std::string ModeParser::ChanModes() for (unsigned char mode = 'A'; mode <= 'z'; mode++) { + if ((!ServerInstance->Config->AllowHalfop) && (mode == 'h')) + continue; + unsigned char pos = (mode-65) | MASK_CHANNEL; /* One parameter when adding */ if (modehandlers[pos]) @@ -874,20 +957,23 @@ std::string ModeParser::ChanModes() return type1 + "," + type2 + "," + type3 + "," + type4; } -bool ModeParser::PrefixComparison(const prefixtype one, const prefixtype two) +bool ModeParser::PrefixComparison(prefixtype one, prefixtype two) { return one.second > two.second; } std::string ModeParser::BuildPrefixes() { - std::string mletters = ""; - std::string mprefixes = ""; + std::string mletters; + std::string mprefixes; pfxcontainer pfx; std::map prefix_to_mode; for (unsigned char mode = 'A'; mode <= 'z'; mode++) { + if ((!ServerInstance->Config->AllowHalfop) && (mode == 'h')) + continue; + unsigned char pos = (mode-65) | MASK_CHANNEL; if ((modehandlers[pos]) && (modehandlers[pos]->GetPrefix())) @@ -923,6 +1009,7 @@ bool ModeParser::AddModeWatcher(ModeWatcher* mw) pos = (mw->GetModeChar()-65) | mask; modewatchers[pos].push_back(mw); + return true; } @@ -954,7 +1041,7 @@ bool ModeParser::DelModeWatcher(ModeWatcher* mw) /** This default implementation can remove simple user modes */ -void ModeHandler::RemoveMode(userrec* user) +void ModeHandler::RemoveMode(User* user) { char moderemove[MAXBUF]; const char* parameters[] = { user->nick, moderemove }; @@ -969,51 +1056,40 @@ void ModeHandler::RemoveMode(userrec* user) /** This default implementation can remove simple channel modes * (no parameters) */ -void ModeHandler::RemoveMode(chanrec* channel) +void ModeHandler::RemoveMode(Channel* channel) { char moderemove[MAXBUF]; const char* parameters[] = { channel->name, moderemove }; if (channel->IsModeSet(this->GetModeChar())) { - userrec* n = new userrec(ServerInstance); - sprintf(moderemove,"-%c",this->GetModeChar()); - n->SetFd(FD_MAGIC_NUMBER); - - ServerInstance->SendMode(parameters, 2, n); - - delete n; + ServerInstance->SendMode(parameters, 2, ServerInstance->FakeClient); } } ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance) { - struct Initializer + ModeHandler* modes[] = { - char modechar; - ModeHandler* handler; - }; - - Initializer modes[] = { - { 's', new ModeChannelSecret(Instance) }, - { 'p', new ModeChannelPrivate(Instance) }, - { 'm', new ModeChannelModerated(Instance) }, - { 't', new ModeChannelTopicOps(Instance) }, - { 'n', new ModeChannelNoExternal(Instance) }, - { 'i', new ModeChannelInviteOnly(Instance) }, - { 'k', new ModeChannelKey(Instance) }, - { 'l', new ModeChannelLimit(Instance) }, - { 'b', new ModeChannelBan(Instance) }, - { 'o', new ModeChannelOp(Instance) }, - { 'h', new ModeChannelHalfOp(Instance) }, - { 'v', new ModeChannelVoice(Instance) }, - { 's', new ModeUserServerNotice(Instance) }, - { 'w', new ModeUserWallops(Instance) }, - { 'i', new ModeUserInvisible(Instance) }, - { 'o', new ModeUserOperator(Instance) }, - { 'n', new ModeUserServerNoticeMask(Instance) }, - { 0, NULL } + new ModeChannelSecret(Instance), + new ModeChannelPrivate(Instance), + new ModeChannelModerated(Instance), + new ModeChannelTopicOps(Instance), + new ModeChannelNoExternal(Instance), + new ModeChannelInviteOnly(Instance), + new ModeChannelKey(Instance), + new ModeChannelLimit(Instance), + new ModeChannelBan(Instance), + new ModeChannelOp(Instance), + new ModeChannelHalfOp(Instance), + new ModeChannelVoice(Instance), + new ModeUserServerNotice(Instance), + new ModeUserWallops(Instance), + new ModeUserInvisible(Instance), + new ModeUserOperator(Instance), + new ModeUserServerNoticeMask(Instance), + NULL }; /* Clear mode list */ @@ -1021,9 +1097,9 @@ ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance) memset(modewatchers, 0, sizeof(modewatchers)); /* Last parse string */ - LastParse = ""; + LastParse.clear(); /* Initialise the RFC mode letters */ - for (int index = 0; modes[index].modechar; index++) - this->AddMode(modes[index].handler, modes[index].modechar); + for (int index = 0; modes[index]; index++) + this->AddMode(modes[index]); }