/************************************************************************
* IRC - Internet Relay Chat, modules/m_version.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_version.c,v 1.3 2003/06/14 13:55:51 tr-ircd Exp $
*/
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "msg.h"
#include "numeric.h"
#include "s_conf.h"
#include "channel.h"
#include "patchlevel.h"
#include "h.h"
static char *token = TOK1_VERSION;
static char serveropts[500];
static void init_serveropts(void);
static struct Message _msgtab[] = {
{MSG_VERSION, 0, MAXPARA, M_SLOW | M_IDLE_RESET, 0L,
m_unregistered, m_version, m_version, m_version, m_version}
};
#ifndef STATIC_MODULES
char *_version = "$Revision: 1.3 $";
void _modinit(void)
{
init_serveropts();
mod_add_cmd(_msgtab);
tok1_msgtab[(u_char) *token].msg = _msgtab;
}
void _moddeinit(void)
{
mod_del_cmd(_msgtab);
tok1_msgtab[(u_char) *version].msg = NULL;
}
#else
void m_version_init(void)
{
init_serveropts();
mod_add_cmd(_msgtab);
tok1_msgtab[(u_char) *token].msg = _msgtab;
}
#endif
void init_serveropts(void)
{
ircsnprintf(serveropts, 500, "%s-%s%s%s%s-%s-%s [%s]", "TS7-Z",
#ifdef HAVE_ENCRYPTION_ON
"E",
#else
"",
#endif
#ifdef IPV6
"6",
#else
"",
#endif
"G",
#ifdef STATIC_MODULES
"SM",
#else
"DM",
#endif
#ifdef NOBALLOC
"NB",
#else
"B",
#endif
SELECT_TYPE, BRANCHSTATUS);
}
/*
* * m_version
* parv[0] = sender prefix
* parv[1] = remote server
*/
int m_version(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
if (hunt_server(cptr, sptr, ":%s %s :%s", TOK1_VERSION, 1, parc, parv) == HUNTED_ISME) {
send_me_numeric(sptr, RPL_VERSION, version, GeneralOpts.debuglevel ? "D" : "", me.name,
serveropts);
send_supported(sptr);
}
return 0;
}
syntax highlighted by Code2HTML, v. 0.9.1