]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_check.cpp
Argh, i give up
[user/henk/code/inspircd.git] / src / modules / m_check.cpp
index 4b38c9fcb2f84b17916b563da6f4a555b394db30..117ff72d07e71bb0b8350eb7cd5b2942c02db8d3 100644 (file)
@@ -11,9 +11,6 @@
  * ---------------------------------------------------
  */
 
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 #include "inspircd.h"
 #include "wildcard.h"
 
 
 /** Handle /CHECK
  */
-class cmd_check : public command_t
+class CommandCheck : public Command
 {
  public:
-       cmd_check (InspIRCd* Instance) : command_t(Instance,"CHECK", 'o', 1)
+       CommandCheck (InspIRCd* Instance) : Command(Instance,"CHECK", 'o', 1)
        {
                this->source = "m_check.so";
                syntax = "<nickname>|<ip>|<hostmask>|<channel>";
        }
 
-       CmdResult Handle (const char** parameters, int pcnt, userrec *user)
+       CmdResult Handle (const char** parameters, int pcnt, User *user)
        {
-               userrec *targuser;
-               chanrec *targchan;
+               User *targuser;
+               Channel *targchan;
                std::string checkstr;
                std::string chliststr;
 
@@ -64,16 +61,19 @@ class cmd_check : public command_t
                        user->WriteServ(checkstr + " modes +" + targuser->FormatModes());
                        user->WriteServ(checkstr + " snomasks +" + targuser->FormatNoticeMasks());
                        user->WriteServ(checkstr + " server " + targuser->server);
-                       if (targuser->awaymsg[0] != 0)
+
+                       if (IS_AWAY(targuser))
                        {
                                /* user is away */
                                user->WriteServ(checkstr + " awaymsg " + targuser->awaymsg);
                        }
+
                        if (IS_OPER(targuser))
                        {
                                /* user is an oper of type ____ */
                                user->WriteServ(checkstr + " opertype " + irc::Spacify(targuser->oper));
                        }
+
                        if (IS_LOCAL(targuser))
                        {
                                /* port information is only held for a local user! */
@@ -157,13 +157,14 @@ class cmd_check : public command_t
 class ModuleCheck : public Module
 {
  private:
-       cmd_check *mycommand;
+       CommandCheck *mycommand;
  public:
-       ModuleCheck(InspIRCd* Me) : Module::Module(Me)
+       ModuleCheck(InspIRCd* Me) : Module(Me)
        {
                
-               mycommand = new cmd_check(ServerInstance);
+               mycommand = new CommandCheck(ServerInstance);
                ServerInstance->AddCommand(mycommand);
+
        }
        
        virtual ~ModuleCheck()
@@ -175,35 +176,7 @@ class ModuleCheck : public Module
                return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
        }
 
-       void Implements(char* List)
-       {
-               /* we don't hook anything, nothing required */
-       }
        
 };
 
-
-
-class ModuleCheckFactory : public ModuleFactory
-{
- public:
-       ModuleCheckFactory()
-       {
-       }
-       
-       ~ModuleCheckFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleCheck(Me);
-       }
-       
-};
-
-extern "C" void * init_module( void )
-{
-       return new ModuleCheckFactory;
-}
-
+MODULE_INIT(ModuleCheck)