]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/cmode_k.cpp
Chain ValidateServerName onto ValidateHostname so that the servername gets hostname...
[user/henk/code/inspircd.git] / src / modes / cmode_k.cpp
index f6a29af35f68bd64056a85896c25950e79b6c496..194c0efcbc0a14c679cdd9421dd1d2c9f3e5e680 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -21,7 +21,7 @@ ModeChannelKey::ModeChannelKey(InspIRCd* Instance) : ModeHandler(Instance, 'k',
 {
 }
 
-ModePair ModeChannelKey::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
+ModePair ModeChannelKey::ModeSet(User*, User*, Channel* channel, const std::string &parameter)
 {       
         if (channel->modes[CM_KEY])
         {
@@ -33,7 +33,7 @@ ModePair ModeChannelKey::ModeSet(userrec* source, userrec* dest, chanrec* channe
         }
 }
 
-void ModeChannelKey::RemoveMode(chanrec* channel)
+void ModeChannelKey::RemoveMode(Channel* channel, irc::modestacker* stack)
 {
        /** +k needs a parameter when being removed,
         * so we have a special-case RemoveMode here for it
@@ -43,22 +43,27 @@ void ModeChannelKey::RemoveMode(chanrec* channel)
 
        if (channel->IsModeSet(this->GetModeChar()))
        {
-               sprintf(moderemove,"-%c",this->GetModeChar());
-               ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient);
+               if (stack)
+                       stack->Push(this->GetModeChar(), channel->key);
+               else
+               {
+                       sprintf(moderemove,"-%c",this->GetModeChar());
+                       ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient);
+               }
        }
 }
 
-void ModeChannelKey::RemoveMode(userrec* user)
+void ModeChannelKey::RemoveMode(User*, irc::modestacker* stack)
 {
 }
 
-bool ModeChannelKey::CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel)
+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(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
 {
        if ((channel->modes[CM_KEY] != adding) || (!IS_LOCAL(source)))
        {