diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-09-04 12:27:04 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-09-04 12:27:04 +0200 |
commit | 679411e500fb0c81ad403edb4aae54d3660a098d (patch) | |
tree | 919f9be6bbb87079098ae446edfaffb4f7f5dbff /src/mode.cpp | |
parent | db248e7d99636809a88f0ddb5ccf9a8034cbdf36 (diff) |
Let callers customize the begin/end positions for ModeParser::ModeParamsToChangeList()
This helps spanningtree when it deals with a vector of parameters where the modes begin at different positions
Diffstat (limited to 'src/mode.cpp')
-rw-r--r-- | src/mode.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index d9dba196d..770e6a2e2 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -425,12 +425,15 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User* user, } } -void ModeParser::ModeParamsToChangeList(User* user, ModeType type, const std::vector<std::string>& parameters, Modes::ChangeList& changelist) +void ModeParser::ModeParamsToChangeList(User* user, ModeType type, const std::vector<std::string>& parameters, Modes::ChangeList& changelist, unsigned int beginindex, unsigned int endindex) { - const std::string& mode_sequence = parameters[1]; + if (endindex > parameters.size()) + endindex = parameters.size(); + + const std::string& mode_sequence = parameters[beginindex]; bool adding = true; - unsigned int param_at = 2; + unsigned int param_at = beginindex+1; for (std::string::const_iterator letter = mode_sequence.begin(); letter != mode_sequence.end(); letter++) { @@ -450,7 +453,7 @@ void ModeParser::ModeParamsToChangeList(User* user, ModeType type, const std::ve } std::string parameter; - if (mh->GetNumParams(adding) && param_at < parameters.size()) + if (mh->GetNumParams(adding) && param_at < endindex) parameter = parameters[param_at++]; changelist.push(mh, adding, parameter); |