X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmode.cpp;h=bddd6cc3190f3d40dfb969f779a2baa194f78a93;hb=19b34cde73ce410fdc335127efe4d7080270feb2;hp=1b2ea344253f712b53bce94987728d6f0206fc96;hpb=d65ee10c00f8d4b23b4e55cae293605a1ce3c689;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/mode.cpp b/src/mode.cpp index 1b2ea3442..bddd6cc31 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -271,6 +271,8 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool ServerInstance->Log(DEBUG,"ModeParser::Process start"); + LastParse = ""; + /* Special case for displaying the list for listmodes, * e.g. MODE #chan b, or MODE #chan +b without a parameter */ @@ -487,7 +489,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool || (parameter_count > MAXMODES)) { /* We cant have a mode sequence this long */ - letter = mode_sequence.end(); + letter = mode_sequence.end() - 1; continue; } } @@ -509,10 +511,12 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool if (type == MODETYPE_CHANNEL) { targetchannel->WriteChannelWithServ(ServerInstance->Config->ServerName, "MODE %s %s%s", targetchannel->name, output_sequence.c_str(), parameter_list.str().c_str()); + this->LastParse = targetchannel->name; } else { targetuser->WriteServ("MODE %s %s%s",targetuser->nick,output_sequence.c_str(), parameter_list.str().c_str()); + this->LastParse = targetuser->nick; } } else @@ -522,17 +526,28 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool ServerInstance->Log(DEBUG,"Write output sequence and parameters to channel: %s %s%s",targetchannel->name,output_sequence.c_str(),parameter_list.str().c_str()); targetchannel->WriteChannel(user,"MODE %s %s%s",targetchannel->name,output_sequence.c_str(),parameter_list.str().c_str()); FOREACH_MOD(I_OnMode,OnMode(user, targetchannel, TYPE_CHANNEL, output_sequence + parameter_list.str())); + this->LastParse = targetchannel->name; } else { user->WriteTo(targetuser,"MODE %s %s%s",targetuser->nick,output_sequence.c_str(), parameter_list.str().c_str()); FOREACH_MOD(I_OnMode,OnMode(user, targetuser, TYPE_USER, output_sequence)); + this->LastParse = targetuser->nick; } } + + LastParse.append(" "); + LastParse.append(output_sequence); + LastParse.append(parameter_list.str()); } } } +const std::string& ModeParser::GetLastParse() +{ + return LastParse; +} + void ModeParser::CleanMask(std::string &mask) { std::string::size_type pos_of_pling = mask.find_first_of('!'); @@ -905,6 +920,9 @@ ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance) memset(modehandlers, 0, sizeof(modehandlers)); memset(modewatchers, 0, sizeof(modewatchers)); + /* Last parse string */ + LastParse = ""; + /* Initialise the RFC mode letters */ /* Start with channel simple modes, no params */