X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodes%2Fcmode_v.cpp;h=0ea887073392e22254e7291f4f921c26a55614c6;hb=2829ce8112ead4808969808b1f3ae216aae55d05;hp=7b14d84d435552bfd6a17405ae203a50d6e65d54;hpb=8b864c8a828d6ca97b5ec15fa7bf8fcc35027294;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 7b14d84d4..0ea887073 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -1,17 +1,22 @@ -#include -#include -#include "inspircd_config.h" -#include "configreader.h" -#include "hash_map.h" +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + #include "inspircd.h" +#include "configreader.h" #include "mode.h" #include "channels.h" #include "users.h" - -#include "commands.h" #include "modules.h" -#include "inspstring.h" -#include "hashcomp.h" #include "modes/cmode_v.h" ModeChannelVoice::ModeChannelVoice(InspIRCd* Instance) : ModeHandler(Instance, 'v', 1, 1, true, MODETYPE_CHANNEL, false, '+') @@ -28,7 +33,7 @@ ModePair ModeChannelVoice::ModeSet(userrec* source, userrec* dest, chanrec* chan userrec* x = ServerInstance->FindNick(parameter); if (x) { - if (channel->GetStatus(x) == STATUS_VOICE) + if (channel->GetStatusFlags(x) & UCMODE_VOICE) { return std::make_pair(true, x->nick); } @@ -40,6 +45,30 @@ ModePair ModeChannelVoice::ModeSet(userrec* source, userrec* dest, chanrec* chan return std::make_pair(false, parameter); } +void ModeChannelVoice::RemoveMode(chanrec* channel) +{ + CUList* list = channel->GetVoicedUsers(); + CUList copy; + char moderemove[MAXBUF]; + + for (CUList::iterator i = list->begin(); i != list->end(); i++) + { + userrec* n = i->first; + copy.insert(std::make_pair(n,n->nick)); + } + + 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); + } +} + +void ModeChannelVoice::RemoveMode(userrec* user) +{ +} + ModeAction ModeChannelVoice::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { int status = channel->GetStatus(source); @@ -58,7 +87,10 @@ ModeAction ModeChannelVoice::OnModeChange(userrec* source, userrec* dest, chanre * the return value and is always MODEACTION_DENY if the mode is supposed to have * a parameter. */ - return MODEACTION_ALLOW; + if (parameter.length()) + return MODEACTION_ALLOW; + else + return MODEACTION_DENY; } std::string ModeChannelVoice::AddVoice(userrec *user,const char* dest,chanrec *chan,int status)