/*
***********************************************************************
***   Module Name :    m_maph.c                                       *
***   Author      :    Ldunda  <Ldunda@Rekor.NET> , <Ldunda@gmail.com>*
***   Description :    Only HelpOp and Opers Can use  /map            *
***********************************************************************
***  INSTALL                                                          *
***  copy m_maph.c "src/modules"                                      *
***  Login SSH and " make custommodule MODULEFILE=m_maph "            *
***  unrealircd.conf  add                                             *
***  loadmodule "src/modules/m_maph.so";                              *
***  IRC Server                                                       *
***  /rehash                                                          *
***********************************************************************
*/

#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "channel.h"
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <io.h>
#endif
#include <fcntl.h>
#include "h.h"
#ifdef STRIPBADWORDS
#include "badwords.h"
#endif
#ifdef _WIN32
#include "version.h"
#endif

#define MSG_MAP   "MAP"

ModuleInfo *m_maph_modinfo = NULL;

Cmdoverride *maph_override = NULL;

DLLFUNC int maph(Cmdoverride *anoverride, aClient *cptr, aClient *sptr, int parc, char *parv[]);


ModuleHeader MOD_HEADER(m_maph)
 ={
      "m_maph",
      " ",
      "only helpop and opers can use this /map ( Author : Ldunda <Ldunda@Rekor.NET>)",
      "3.2-b8-1",
      NULL
};

DLLFUNC int MOD_INIT(m_maph)(ModuleInfo *modinfo)
{
     m_maph_modinfo = modinfo;
     return MOD_SUCCESS;
}

DLLFUNC int MOD_LOAD(m_maph)(int module_load)
{
      maph_override = CmdoverrideAdd(m_maph_modinfo->handle, MSG_MAP, maph);
      
      return MOD_SUCCESS;
}

DLLFUNC int MOD_UNLOAD(m_maph)(int module_unload)
{
   CmdoverrideDel(maph_override);

   return MOD_SUCCESS;
}

DLLFUNC int maph(Cmdoverride *anoverride, aClient *cptr, aClient *sptr, int parc, char *parv[])
{
      if (!IsHelpOp(sptr) && !IsAnOper(sptr) && !IsServer(sptr))
      {
          sendto_one(sptr, ":%s %s %s : Only opers and helpop can use this command", me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", sptr->name);
          return 0;
      }

       return CallCmdoverride(maph_override, cptr, sptr, parc, parv);
}
