X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodes%2Fcmode_k.cpp;h=6e5ba0269f9723fc1c2e5f384898da2da27a7bf3;hb=e84bf9f3ec5a60078c32b272d3d7885c0708c544;hp=5e55ce972fe751af9d3d2cf8d445548b462bdb56;hpb=354cf0401283c67a6cf8962dfb55fc0558662cdd;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index 5e55ce972..6e5ba0269 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -4,11 +4,11 @@ #include "users.h" #include "modes/cmode_k.h" -ModeChannelKey::ModeChannelKey() : ModeHandler('k', 1, 1, false, MODETYPE_CHANNEL, false) +ModeChannelKey::ModeChannelKey(InspIRCd* Instance) : ModeHandler(Instance, 'k', 1, 1, false, MODETYPE_CHANNEL, false) { } -std::pair ModeChannelKey::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) +ModePair ModeChannelKey::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { if (channel->modes[CM_KEY]) { @@ -20,6 +20,11 @@ std::pair ModeChannelKey::ModeSet(userrec* source, userrec* de } } +bool ModeChannelKey::CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) +{ + /* When TS is equal, the alphabetically later channel key wins */ + return (their_param < our_param); +} ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -28,7 +33,7 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec* if (((channel->modes[CM_KEY]) && (strcasecmp(parameter.c_str(),channel->key))) && (IS_LOCAL(source))) { /* Key is currently set and the correct key wasnt given */ - log(DEBUG,"Key Cond 2"); + ServerInstance->Log(DEBUG,"Key Cond 2"); return MODEACTION_DENY; } else if ((!channel->modes[CM_KEY]) || ((adding) && (!IS_LOCAL(source)))) @@ -45,12 +50,12 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec* channel->modes[CM_KEY] = adding; return MODEACTION_ALLOW; } - log(DEBUG,"Key Cond three"); + ServerInstance->Log(DEBUG,"Key Cond three"); return MODEACTION_DENY; } else { - log(DEBUG,"Key Condition one"); + ServerInstance->Log(DEBUG,"Key Condition one"); return MODEACTION_DENY; } }