]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sslmodes.cpp
Remove unneeded headers from spanningtree. This was done to the rest of the source...
[user/henk/code/inspircd.git] / src / modules / m_sslmodes.cpp
index b2d86fe44ae19d7b01f93ab97dcc6e10e3ea86c5..e772e212d40691903a656e62dc8bc8ee372f93b6 100644 (file)
@@ -1,28 +1,24 @@
 /*       +------------------------------------+
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
- *                              
- *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                       E-mail:
- *                <brain@chatspike.net>
- *                <Craig@chatspike.net>
- *      
- * 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.
  *
  * ---------------------------------------------------
- */     
+ */
 
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 #include "inspircd.h"
 
 /* $ModDesc: Provides support for unreal-style channel mode +z */
 
 static char* dummy;
 
+/** Handle channel mode +z
+ */
 class SSLMode : public ModeHandler
 {
  public:
@@ -39,7 +35,7 @@ class SSLMode : public ModeHandler
                                        CUList* userlist = channel->GetUsers();
                                        for(CUList::iterator i = userlist->begin(); i != userlist->end(); i++)
                                        {
-                                               if(!i->second->GetExt("ssl", dummy))
+                                               if(!i->first->GetExt("ssl", dummy))
                                                {
                                                        source->WriteServ("490 %s %s :all members of the channel must be connected via SSL", source->nick, channel->name);
                                                        return MODEACTION_DENY;
@@ -74,12 +70,13 @@ class ModuleSSLModes : public Module
        
  public:
        ModuleSSLModes(InspIRCd* Me)
-               : Module::Module(Me)
+               : Module(Me)
        {
                
 
                sslm = new SSLMode(ServerInstance);
-               ServerInstance->AddMode(sslm, 'z');
+               if (!ServerInstance->AddMode(sslm, 'z'))
+                       throw ModuleException("Could not add new modes!");
        }
 
        void Implements(char* List)
@@ -99,7 +96,7 @@ class ModuleSSLModes : public Module
                        else
                        {
                                // Deny
-                               user->WriteServ( "489 %s %s :Cannot join channel (+z)", user->nick, cname);
+                               user->WriteServ( "489 %s %s :Cannot join channel; SSL users only (+z)", user->nick, cname);
                                return 1;
                        }
                }
@@ -115,7 +112,7 @@ class ModuleSSLModes : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1, 0, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
        }
 };
 
@@ -139,7 +136,7 @@ class ModuleSSLModesFactory : public ModuleFactory
 };
 
 
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
 {
        return new ModuleSSLModesFactory;
 }