summaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-07 01:29:45 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-07 01:29:45 +0000
commit96a4a1d41e42dba806c2e9954e148ed838262511 (patch)
tree3d1b2679437012f10133182d0aa8a8d9b7479350 /src/mode.cpp
parent526f5a4a02882b19056fe755dff1f64b764ff313 (diff)
Include explicit parameter list in ProtocolInterface::SendMode
Also leave the strings split into deque, there's no need to pack it into a string just to unpack it during the translate. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11181 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index da8f10294..40bd70963 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -371,6 +371,8 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user,
User* targetuser = ServerInstance->FindNick(parameters[0]);
LastParse.clear();
+ LastParseParams.clear();
+ LastParseTranslate.clear();
/* Special case for displaying the list for listmodes,
* e.g. MODE #chan b, or MODE #chan +b without a parameter
@@ -503,14 +505,13 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user,
std::string mode_sequence = parameters[1];
std::string parameter;
std::ostringstream parameter_list;
- std::vector<TranslateType> parameter_xlate;
- parameter_xlate.push_back(TR_TEXT);
std::string output_sequence;
bool adding = true, state_change = false;
unsigned char handler_id = 0;
unsigned int parameter_counter = 2; /* Index of first parameter */
unsigned int parameter_count = 0;
bool last_successful_state_change = false;
+ LastParseTranslate.push_back(TR_TEXT);
/* A mode sequence that doesnt start with + or -. Assume +. - Thanks for the suggestion spike (bug#132) */
if ((*mode_sequence.begin() != '+') && (*mode_sequence.begin() != '-'))
@@ -717,7 +718,8 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user,
if ((modehandlers[handler_id]->GetNumParams(adding)) && (!parameter.empty()))
{
parameter_list << " " << parameter;
- parameter_xlate.push_back(modehandlers[handler_id]->GetTranslateType());
+ LastParseParams.push_back(parameter);
+ LastParseTranslate.push_back(modehandlers[handler_id]->GetTranslateType());
parameter_count++;
/* Does this mode have a prefix? */
if (modehandlers[handler_id]->GetPrefix() && targetchannel)
@@ -773,16 +775,17 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user,
}
else
{
+ LastParseParams.push_front(output_sequence);
if (type == MODETYPE_CHANNEL)
{
targetchannel->WriteChannel(user, "MODE %s %s%s", targetchannel->name.c_str(), output_sequence.c_str(), parameter_list.str().c_str());
- FOREACH_MOD(I_OnMode,OnMode(user, targetchannel, TYPE_CHANNEL, output_sequence + parameter_list.str(), parameter_xlate));
+ FOREACH_MOD(I_OnMode,OnMode(user, targetchannel, TYPE_CHANNEL, LastParseParams, LastParseTranslate));
this->LastParse = targetchannel->name;
}
else
{
user->WriteTo(targetuser, "MODE %s %s%s", targetuser->nick.c_str(), output_sequence.c_str(), parameter_list.str().c_str());
- FOREACH_MOD(I_OnMode,OnMode(user, targetuser, TYPE_USER, output_sequence + parameter_list.str(), parameter_xlate));
+ FOREACH_MOD(I_OnMode,OnMode(user, targetuser, TYPE_USER, LastParseParams, LastParseTranslate));
this->LastParse = targetuser->nick;
}
}