]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/cmode_h.cpp
Drop channel keys if they are identical to the already-set key (fix for bug #756...
[user/henk/code/inspircd.git] / src / modes / cmode_h.cpp
index 8217ccc2d8dedce8cb0bd677a979d59c584ada9c..c3bb92576e05ddd85172614821c7373a85294c26 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -49,7 +49,6 @@ void ModeChannelHalfOp::RemoveMode(Channel* channel, irc::modestacker* stack)
 {
        CUList* clist = channel->GetHalfoppedUsers();
        CUList copy;
-       char moderemove[MAXBUF];
 
        for (CUList::iterator i = clist->begin(); i != clist->end(); i++)
        {
@@ -65,9 +64,8 @@ void ModeChannelHalfOp::RemoveMode(Channel* channel, irc::modestacker* stack)
                }
                else
                {
-                       sprintf(moderemove,"-%c",this->GetModeChar());
-                       const char* parameters[] = { channel->name, moderemove, i->first->nick };
-                       ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient);
+                       std::vector<std::string> parameters; parameters.push_back(channel->name); parameters.push_back("-h"); parameters.push_back(i->first->nick);
+                       ServerInstance->SendMode(parameters, ServerInstance->FakeClient);
                }
        }
 
@@ -79,15 +77,6 @@ void ModeChannelHalfOp::RemoveMode(User*, irc::modestacker* stack)
 
 ModeAction ModeChannelHalfOp::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
 {
-       /* If halfops are not enabled in the conf, we don't execute
-        * anything in this class at all.
-        */
-       if (!ServerInstance->Config->AllowHalfop)
-       {
-               parameter = "";
-               return MODEACTION_DENY;
-       }
-
        int status = channel->GetStatus(source);
 
        /* Call the correct method depending on wether we're adding or removing the mode */
@@ -127,7 +116,7 @@ std::string ModeChannelHalfOp::AddHalfOp(User *user,const char* dest,Channel *ch
                        {
                                if ((status < STATUS_OP) && (!ServerInstance->ULine(user->server)))
                                {
-                                       user->WriteServ("482 %s %s :You're not a channel operator",user->nick, chan->name);
+                                       user->WriteServ("482 %s %s :You're not a channel operator",user->nick.c_str(), chan->name.c_str());
                                        return "";
                                }
                        }
@@ -155,7 +144,7 @@ std::string ModeChannelHalfOp::DelHalfOp(User *user,const char *dest,Channel *ch
                        {
                                if ((user != d) && ((status < STATUS_OP) && (!ServerInstance->ULine(user->server))))
                                {
-                                       user->WriteServ("482 %s %s :You are not a channel operator",user->nick, chan->name);
+                                       user->WriteServ("482 %s %s :You are not a channel operator",user->nick.c_str(), chan->name.c_str());
                                        return "";
                                }
                        }