/************************************************************************
 *   IRC - Internet Relay Chat, modules/m_admin.c
 *
 *   Copyright (C) 2000-2003 TR-IRCD Development
 *
 *   Copyright (C) 1990 Jarkko Oikarinen and
 *                      University of Oulu, Co Center
 *
 *   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 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.
 */

/*
 * $Id: m_admin.c,v 1.4 2003/07/17 10:07:13 tr-ircd Exp $ 
 */

#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "channel.h"
#include "h.h"
#include "s_conf.h"

static struct Message _msgtab[] = {
    {MSG_ADMIN, 0, MAXPARA, M_SLOW | M_IDLE_RESET, 0L,
     m_unregistered, m_admin, m_admin, m_admin, m_admin}
};

static char *token = TOK1_ADMIN;

#ifndef STATIC_MODULES

char *_version = "$Revision: 1.4 $";

void _modinit(void)
{
    mod_add_cmd(_msgtab);
    tok1_msgtab[(u_char) *token].msg = _msgtab;
}

void _moddeinit(void)
{
    mod_del_cmd(_msgtab);
    tok1_msgtab[(u_char) *token].msg = NULL;
}
#else
void m_admin_init(void)
{
    mod_add_cmd(_msgtab);
    tok1_msgtab[(u_char) *token].msg = _msgtab;
}
#endif

int m_admin(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
    if (hunt_server(cptr, sptr, ":%s %s :%s", TOK1_ADMIN, 1, parc, parv) != HUNTED_ISME)
	return 0;

    if (IsPerson(sptr))
	sendto_lev(SPY_LEV, "ADMIN requested by %^C [%s]", sptr, sptr->user->server);

    if (AdminInfo.name) {
	send_me_numeric(sptr, RPL_ADMINME, me.name);
	send_me_numeric(sptr, RPL_ADMINLOC1, AdminInfo.name);
	send_me_numeric(sptr, RPL_ADMINLOC2, AdminInfo.email ? AdminInfo.email : "");
	send_me_numeric(sptr, RPL_ADMINEMAIL, AdminInfo.description ? AdminInfo.description : "");
    } else
	send_me_numeric(sptr, ERR_NOADMININFO, me.name);
    return 0;
}


syntax highlighted by Code2HTML, v. 0.9.1