X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_restrictbanned.cpp;h=9315385a1aeb416bf0d2ad63a0ec5967b54404ee;hb=fed58f5c25915d60d40c0f407914ff7381902f9d;hp=51ff39772bf3d8f4dcaaf91d4dcdaa439a9fe556;hpb=2e52ff280dca14d1598b84fab7a8c2e93fa30910;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_restrictbanned.cpp b/src/modules/m_restrictbanned.cpp index 51ff39772..9315385a1 100644 --- a/src/modules/m_restrictbanned.cpp +++ b/src/modules/m_restrictbanned.cpp @@ -2,33 +2,27 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * - * - * Written by Craig Edwards, Craig McLure, and others. + * 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. * * --------------------------------------------------- */ -using namespace std; - +#include "inspircd.h" #include "users.h" #include "channels.h" #include "modules.h" -#include "inspircd.h" - /* $ModDesc: Restricts banned users in a channel. May not speak, etc. */ class ModuleRestrictBanned : public Module { private: public: - ModuleRestrictBanned(InspIRCd* Me) : Module::Module(Me) + ModuleRestrictBanned(InspIRCd* Me) : Module(Me) { } @@ -52,7 +46,7 @@ class ModuleRestrictBanned : public Module if (!IS_LOCAL(user)) return 0; - if (channel->IsBanned(user) && channel->GetStatus(user) < STATUS_VOICE) + if (channel->GetStatus(user) < STATUS_VOICE && channel->IsBanned(user)) { /* banned, boned. drop the message. */ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** You may not " + action + ", as you are banned on channel " + channel->name); @@ -69,15 +63,10 @@ class ModuleRestrictBanned : public Module return 0; /* bit of a special case. */ - for (std::vector::iterator i = user->chans.begin(); i != user->chans.end(); i++) + for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++) { - if (((ucrec*)(*i))->channel != NULL) - { - chanrec *channel = ((ucrec*)(*i))->channel; - - if (CheckRestricted(user, channel, "change your nickname") == 1) - return 1; - } + if (CheckRestricted(user, i->first, "change your nickname") == 1) + return 1; } return 0; @@ -106,28 +95,4 @@ class ModuleRestrictBanned : public Module } }; - -class ModuleRestrictBannedFactory : public ModuleFactory -{ - public: - ModuleRestrictBannedFactory() - { - } - - ~ModuleRestrictBannedFactory() - { - } - - virtual Module * CreateModule(InspIRCd* Me) - { - return new ModuleRestrictBanned(Me); - } - -}; - - -extern "C" void * init_module( void ) -{ - return new ModuleRestrictBannedFactory; -} - +MODULE_INIT(ModuleRestrictBanned)