/*
* IRC - Internet Relay Chat, modules/m_gnotice.c
*
* Copyright (C) 2000-2003 TR-IRCD Development
*
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Co Center
*
* 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 2, 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 "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "channel.h"
#include "h.h"
static struct Message _msgtab[] = {
{MSG_GNOTICE, 0, MAXPARA, M_SLOW | M_IDLE_RESET, 0L,
m_unregistered, m_permission, m_permission, m_gnotice, m_gnotice}
};
static char *token = TOK1_GNOTICE;
#ifndef STATIC_MODULES
char *_version = "$Revision: 1.3 $";
void _modinit(void)
{
mod_add_cmd(_msgtab);
tok1_msgtab[(u_char) *token].msg = &_msgtab[0];
}
void _moddeinit(void)
{
mod_del_cmd(_msgtab);
tok1_msgtab[(u_char) *token].msg = NULL;
}
#else
void m_gnotice_init(void)
{
mod_add_cmd(_msgtab);
tok1_msgtab[(u_char) *token].msg = _msgtab;
}
#endif
/*
* m_gnotice (Russell) sort of like wallop, but only to +g clients on *
* this server.
* parv[0] = sender prefix
* parv[1] = message text
* ported from df465 to hybrid -mjs
*
* This function itself doesnt need any changes for the move to +n routing
* notices, to sendto takes care of it. Now only sends to +n clients -epi
*/
int m_gnotice(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
char *message = parc > 1 ? parv[1] : NULL;
if (BadPtr(message)) {
send_me_numeric(sptr, ERR_NEEDMOREPARAMS, MSG_GNOTICE);
return 0;
}
sendto_serv_butone(IsServer(cptr) ? cptr : NULL, sptr, TOK1_GNOTICE, ":%s", message);
sendto_gnotice("from %C: %s", sptr, message);
return 0;
}
syntax highlighted by Code2HTML, v. 0.9.1