Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/VibeDevelopers/Comet.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141/* * ircd-ratbox: A slightly useful ircd. * m_admin.c: Sends administrative information to a user. * * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center * Copyright (C) 1996-2002 Hybrid Development Team * Copyright (C) 2002-2005 ircd-ratbox development team * * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */
#include "stdinc.h"#include "client.h"#include "ircd.h"#include "numeric.h"#include "s_conf.h"#include "s_serv.h"#include "send.h"#include "msg.h"#include "parse.h"#include "hook.h"#include "modules.h"#include "response.h"
const char admin_desc[] = "Provides the ADMIN command to show server administrator information";
static void m_admin(struct MsgBuf *, struct Client *, struct Client *, int, const char **);static void mr_admin(struct MsgBuf *, struct Client *, struct Client *, int, const char **);static void ms_admin(struct MsgBuf *, struct Client *, struct Client *, int, const char **);static void do_admin(struct Client *source_p);
struct Message admin_msgtab = { "ADMIN", 0, 0, 0, 0, {{mr_admin, 0}, {m_admin, 0}, {ms_admin, 0}, mg_ignore, mg_ignore, {ms_admin, 0}}};
mapi_clist_av1 admin_clist[] = { &admin_msgtab, NULL };
DECLARE_MODULE_AV2(admin, NULL, NULL, admin_clist, NULL, NULL, NULL, NULL, admin_desc);
/* * mr_admin - ADMIN command handler * parv[1] = servername */static voidmr_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]){ static time_t last_used = 0L;
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) { sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, EmptyString(source_p->name) ? "*" : source_p->name, "ADMIN"); return; } else last_used = rb_current_time();
begin_local_response_batch(); do_admin(source_p);}
/* * m_admin - ADMIN command handler * parv[1] = servername */static voidm_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]){ static time_t last_used = 0L;
if(parc > 1) { if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) { sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "ADMIN"); return; } else last_used = rb_current_time();
if (hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME) return; }
begin_local_response_batch(); do_admin(source_p);}
/* * ms_admin - ADMIN command handler, used for OPERS as well * parv[1] = servername */static voidms_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]){ if (hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME) return;
begin_local_response_batch(); do_admin(source_p);}
/* * do_admin * * inputs - pointer to client to report to * output - none * side effects - admin info is sent to client given */static voiddo_admin(struct Client *source_p){ sendto_one_numeric(source_p, RPL_ADMINME, form_str(RPL_ADMINME), me.name); if(AdminInfo.name != NULL) sendto_one_numeric(source_p, RPL_ADMINLOC1, form_str(RPL_ADMINLOC1), AdminInfo.name); if(AdminInfo.description != NULL) sendto_one_numeric(source_p, RPL_ADMINLOC2, form_str(RPL_ADMINLOC2), AdminInfo.description); if(AdminInfo.email != NULL) sendto_one_numeric(source_p, RPL_ADMINEMAIL, form_str(RPL_ADMINEMAIL), AdminInfo.email);}