]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/cmode_v.cpp
Allow forward linking compatability by accepting higher protocol version numbers...
[user/henk/code/inspircd.git] / src / modes / cmode_v.cpp
index 2abf4e16120a77b7fee16c58be6bb32be3e541d3..053475d3d3c89dd67e720a4867f90156ac39bac4 100644 (file)
@@ -3,8 +3,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -20,7 +20,7 @@
 #include "modules.h"
 #include "modes/cmode_v.h"
 
-ModeChannelVoice::ModeChannelVoice(InspIRCd* Instance) : ModeHandler(Instance, 'v', 1, 1, true, MODETYPE_CHANNEL, false, '+')
+ModeChannelVoice::ModeChannelVoice(InspIRCd* Instance) : ModeHandler(Instance, 'v', 1, 1, true, MODETYPE_CHANNEL, false, '+', '%', TR_NICK)
 {
 }
 
@@ -46,11 +46,10 @@ ModePair ModeChannelVoice::ModeSet(User*, User*, Channel* channel, const std::st
        return std::make_pair(false, parameter);
 }
 
-void ModeChannelVoice::RemoveMode(Channel* channel)
+void ModeChannelVoice::RemoveMode(Channel* channel, irc::modestacker* stack)
 {
        CUList* clist = channel->GetVoicedUsers();
        CUList copy;
-       char moderemove[MAXBUF];
 
        for (CUList::iterator i = clist->begin(); i != clist->end(); i++)
        {
@@ -60,17 +59,21 @@ void ModeChannelVoice::RemoveMode(Channel* channel)
 
        for (CUList::iterator i = copy.begin(); i != copy.end(); i++)
        {
-               sprintf(moderemove,"-%c",this->GetModeChar());
-               const char* parameters[] = { channel->name, moderemove, i->first->nick };
-               ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient);
+               if (stack)
+                       stack->Push(this->GetModeChar(), i->first->nick);
+               else
+               {
+                       std::vector<std::string> parameters; parameters.push_back(channel->name); parameters.push_back("-v"); parameters.push_back(i->first->nick);
+                       ServerInstance->SendMode(parameters, ServerInstance->FakeClient);
+               }
        }
 }
 
-void ModeChannelVoice::RemoveMode(User*)
+void ModeChannelVoice::RemoveMode(User*, irc::modestacker* stack)
 {
 }
 
-ModeAction ModeChannelVoice::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding)
+ModeAction ModeChannelVoice::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
 {
        int status = channel->GetStatus(source);
 
@@ -111,7 +114,7 @@ std::string ModeChannelVoice::AddVoice(User *user,const char* dest,Channel *chan
                        {
                                if ((status < STATUS_HOP) && (!ServerInstance->ULine(user->server)))
                                {
-                                       user->WriteServ("482 %s %s :You're not a channel (half)operator",user->nick, chan->name);
+                                       user->WriteServ("482 %s %s :You're not a channel (half)operator",user->nick.c_str(), chan->name.c_str());
                                        return "";
                                }
                        }
@@ -139,7 +142,7 @@ std::string ModeChannelVoice::DelVoice(User *user,const char *dest,Channel *chan
                        {
                                if ((status < STATUS_HOP) && (!ServerInstance->ULine(user->server)))
                                {
-                                       user->WriteServ("482 %s %s :You are not a channel (half)operator",user->nick, chan->name);
+                                       user->WriteServ("482 %s %s :You are not a channel (half)operator",user->nick.c_str(), chan->name.c_str());
                                        return "";
                                }
                        }