From f55703b2fb7590333d06008add5294a6bd711339 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 3 Sep 2014 15:11:27 +0200 Subject: Add a ModeParser::Process() overload that can process an entire Modes::ChangeList This is a wrapper that calls ProcessSingle() repeatedly until the entire changelist is processed --- src/mode.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/mode.cpp') diff --git a/src/mode.cpp b/src/mode.cpp index c44942bd6..2c22a6c65 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -486,6 +486,19 @@ static bool ShouldApplyMergedMode(Channel* chan, Modes::Change& item) return mh->ResolveModeConflict(item.param, ours, chan); } +void ModeParser::Process(User* user, Channel* targetchannel, User* targetuser, Modes::ChangeList& changelist, ModeProcessFlag flags) +{ + // Call ProcessSingle until the entire list is processed, but at least once to ensure + // LastParse and LastChangeList are cleared + unsigned int processed = 0; + do + { + unsigned int n = ProcessSingle(user, targetchannel, targetuser, changelist, flags, processed); + processed += n; + } + while (processed < changelist.size()); +} + unsigned int ModeParser::ProcessSingle(User* user, Channel* targetchannel, User* targetuser, Modes::ChangeList& changelist, ModeProcessFlag flags, unsigned int beginindex) { LastParse.clear(); -- cgit v1.3.1-10-gc9f91