1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-05 18:33:12 +02:00
Files
unrealircd/src/modules/sdesc.c
T
Bram Matthys bb1bb35f50 MOD_LOAD(xyz) is now just MOD_LOAD(), same for MOD_TEST, MOD_INIT,
MOD_UNLOAD. And MOD_HEADER(xyz) is now MOD_HEADER even without ()
since this isn't a function, really.
To make things understandable I added the following to the
developer section of the release notes:

* The module header is now as follows:
  ModuleHeader MOD_HEADER
    = {
          "nameofmodule",
          "5.0",
          "Some description",
          "Name of Author",
          "unrealircd-5",
      };
  There's a new author field, the version must start with a digit,
  and also the name of the module must match the loadmodule name.
  So for example third/funmod must also be named third/funmod.
* The MOD_TEST, MOD_INIT, MOD_LOAD and MOD_UNLOAD functions no longer
  take a name argument. So: MOD_INIT(mymod) is now MOD_INIT()
2019-09-13 15:27:40 +02:00

99 lines
2.4 KiB
C

/*
* IRC - Internet Relay Chat, src/modules/m_sdesc.c
* (C) 1999-2001 Carsten Munk (Techie/Stskeeps) <stskeeps@tspre.org>
*
* See file AUTHORS in IRC package for additional names of
* the programmers.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "unrealircd.h"
CMD_FUNC(m_sdesc);
#define MSG_SDESC "SDESC" /* sdesc */
ModuleHeader MOD_HEADER
= {
"sdesc", /* Name of module */
"5.0", /* Version */
"command /sdesc", /* Short description of module */
"UnrealIRCd Team",
"unrealircd-5",
};
MOD_INIT()
{
CommandAdd(modinfo->handle, MSG_SDESC, m_sdesc, 1, M_USER);
MARK_AS_OFFICIAL_MODULE(modinfo);
return MOD_SUCCESS;
}
MOD_LOAD()
{
return MOD_SUCCESS;
}
MOD_UNLOAD()
{
return MOD_SUCCESS;
}
/* m_sdesc - 15/05/1999 - Stskeeps
* :prefix SDESC
* parv[1] - description
* D: Sets server info if you are Server Admin (ONLINE)
*/
CMD_FUNC(m_sdesc)
{
if (!ValidatePermissionsForPath("server:description",sptr,NULL,NULL,NULL))
{
sendnumeric(sptr, ERR_NOPRIVILEGES);
return 0;
}
if ((parc < 2) || BadPtr(parv[1]))
{
sendnumeric(sptr, ERR_NEEDMOREPARAMS, "SDESC");
return 0;
}
if (strlen(parv[1]) > REALLEN)
{
if (MyConnect(sptr))
{
sendnotice(sptr, "*** /SDESC Error: \"Server info\" may maximum be %i characters of length",
REALLEN);
return 0;
}
parv[1][REALLEN] = '\0';
}
ircsnprintf(sptr->srvptr->info, sizeof(sptr->srvptr->info), "%s", parv[1]);
sendto_server(cptr, 0, 0, NULL, ":%s SDESC :%s", sptr->name, parv[1]);
if (MyConnect(sptr))
sendnotice(sptr,
"Your \"server description\" is now set to be %s - you have to set it manually to undo it",
parv[1]);
sendto_ops("Server description for %s is now '%s' changed by %s",
sptr->srvptr->name, sptr->srvptr->info, sptr->name);
return 0;
}