diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mode.cpp | 24 | ||||
-rw-r--r-- | src/modules/m_samode.cpp | 15 |
2 files changed, 28 insertions, 11 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index f74a2ac60..ddc2d4d16 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -509,10 +509,18 @@ 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; + LastParse.append(" "); + LastParse.append(output_sequence); + LastParse.append(parameter_list.str()); } else { targetuser->WriteServ("MODE %s %s%s",targetuser->nick,output_sequence.c_str(), parameter_list.str().c_str()); + this->LastParse = targetuser->nick; + LastParse.append(" "); + LastParse.append(output_sequence); + LastParse.append(parameter_list.str()); } } else @@ -522,17 +530,30 @@ 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; + LastParse.append(" "); + LastParse.append(output_sequence); + LastParse.append(parameter_list.str()); } 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 +926,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 */ diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 95c13f69a..781875594 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -54,21 +54,14 @@ class cmd_samode : public command_t /* * Handles an SAMODE request. Notifies all +s users. */ - std::string result; - ServerInstance->Log(DEBUG,"SAMODE: Being handled"); + userrec* n = new userrec(ServerInstance); n->SetFd(FD_MAGIC_NUMBER); ServerInstance->SendMode(parameters,pcnt,n); delete n; - ServerInstance->Log(DEBUG,"SAMODE: Modechange handled"); - result = std::string(user->nick); - result.append(" used SAMODE"); - for (int n = 0; n < pcnt; n++) - { - result.append(" "); - result.append(parameters[n]); - } - ServerInstance->WriteOpers(result); + + if (ServerInstance->Modes->GetLastParse().length()) + ServerInstance->WriteOpers(std::string(user->nick)+" used SAMODE: "+ServerInstance->Modes->GetLastParse()); return CMD_SUCCESS; } |