+ if (stack)
+ {
+ stack->Push(this->GetModeChar(), channel->GetModeParameter('k'));
+ }
+ else
+ {
+ std::vector<std::string> parameters; parameters.push_back(channel->name); parameters.push_back("-k"); parameters.push_back(channel->GetModeParameter('k'));
+ ServerInstance->SendMode(parameters, ServerInstance->FakeClient);
+ }
+ }
+}
+
+void ModeChannelKey::RemoveMode(User*, irc::modestacker* stack)
+{
+}
+
+bool ModeChannelKey::CheckTimeStamp(time_t, time_t, const std::string &their_param, const std::string &our_param, Channel*)
+{
+ /* When TS is equal, the alphabetically later channel key wins */
+ return (their_param < our_param);
+}
+
+ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding, bool servermode)
+{
+ if ((channel->IsModeSet('k') != adding) || (!IS_LOCAL(source)))
+ {
+ if (((channel->IsModeSet('k')) && (parameter != channel->GetModeParameter('k'))) && (IS_LOCAL(source)))