ehhh
This commit is contained in:
parent
1422ee74d7
commit
8a64bbc986
2 changed files with 138 additions and 0 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -369,6 +369,7 @@ modules/m_smo.c -text
|
|||
modules/m_stats.c -text
|
||||
modules/m_svinfo.c -text
|
||||
modules/m_svscmds.c -text
|
||||
modules/m_swhois.c -text
|
||||
modules/m_testline.c -text
|
||||
modules/m_time.c -text
|
||||
modules/m_topic.c -text
|
||||
|
|
137
modules/m_swhois.c
Normal file
137
modules/m_swhois.c
Normal file
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
* NeoIRCd: NeoStats Group. Based on Hybird7
|
||||
* m_swhois.c: Sends a notice when someone uses WHOIS.
|
||||
*
|
||||
* Copyright (C) 2002 by the past and present ircd coders, and others.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* $Id: m_swhois.c,v 1.1 2002/09/14 16:00:20 fishwaldo Exp $
|
||||
*/
|
||||
#include "stdinc.h"
|
||||
#include "tools.h"
|
||||
#include "common.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "hash.h"
|
||||
#include "channel.h"
|
||||
#include "channel_mode.h"
|
||||
#include "hash.h"
|
||||
#include "ircd.h"
|
||||
#include "numeric.h"
|
||||
#include "s_conf.h"
|
||||
#include "s_serv.h"
|
||||
#include "s_user.h"
|
||||
#include "send.h"
|
||||
#include "list.h"
|
||||
#include "irc_string.h"
|
||||
#include "s_conf.h"
|
||||
#include "msg.h"
|
||||
#include "parse.h"
|
||||
#include "modules.h"
|
||||
#include "hook.h"
|
||||
|
||||
int send_swhois(struct hook_mfunc_data *);
|
||||
static void mo_swhois(struct Client*, struct Client*, int, char**);
|
||||
static void ms_swhois(struct Client*, struct Client*, int, char**);
|
||||
|
||||
struct Message swhois_msgtab = {
|
||||
"SWHOIS", 0, 0, 3, 0, MFLG_SLOW, 0L,
|
||||
{m_unregistered, m_not_oper, ms_swhois, mo_swhois}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
_modinit(void)
|
||||
{
|
||||
hook_add_hook("doing_whois", (hookfn *)send_swhois);
|
||||
mod_add_cmd(&swhois_msgtab);
|
||||
}
|
||||
|
||||
void
|
||||
_moddeinit(void)
|
||||
{
|
||||
hook_del_hook("doing_whois", (hookfn *)send_swhois);
|
||||
mod_del_cmd(&swhois_msgtab);
|
||||
}
|
||||
|
||||
const char *_version = "$Revision: 1.1 $";
|
||||
|
||||
/* show a whois notice
|
||||
source_p does a /whois on client_p */
|
||||
int
|
||||
send_swhois(struct hook_mfunc_data *data)
|
||||
{
|
||||
if (data->client_p->swhois)
|
||||
sendto_one(data->source_p, form_str(RPL_SWHOIS), me.name, data->source_p->name, data->client_p->name, data->client_p->swhois);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* mo_swhois
|
||||
* Allows a Admin to set swhois on clients
|
||||
* inputs - target to change
|
||||
* - swhois string
|
||||
* outputs - none
|
||||
* sideeffect - Sets the swhois string for that user
|
||||
*
|
||||
*/
|
||||
static void mo_swhois(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
|
||||
{
|
||||
struct Client *target_p;
|
||||
|
||||
target_p = find_client(parv[1]);
|
||||
if (!target_p) {
|
||||
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, parv[0], parv[1]);
|
||||
return;
|
||||
}
|
||||
if (!IsAdmin(source_p)) {
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVILEGES),me.name,source_p->name);
|
||||
return;
|
||||
}
|
||||
strncpy(target_p->swhois, parv[2], REALLEN);
|
||||
sendto_one(source_p, ":%s NOTICE %s :*** NOTICE: swhois updated for %s", me.name, source_p->name, target_p->name);
|
||||
sendto_server(NULL, target_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, ":%s SWHOIS %s :%s", me.name, target_p->name, parv[2]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* ms_swhois
|
||||
* Allows a Admin to set swhois on clients
|
||||
* inputs - target to change
|
||||
* - swhois string
|
||||
* outputs - none
|
||||
* sideeffect - Sets the swhois string for that user
|
||||
*
|
||||
*/
|
||||
static void ms_swhois(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
|
||||
{
|
||||
struct Client *target_p;
|
||||
|
||||
target_p = find_client(parv[1]);
|
||||
if (!target_p) {
|
||||
return;
|
||||
}
|
||||
if (!IsServer(source_p)) {
|
||||
return;
|
||||
}
|
||||
strncpy(target_p->swhois, parv[2], REALLEN);
|
||||
sendto_server(client_p, target_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, ":%s SWHOIS %s :%s", me.name, target_p->name, parv[2]);
|
||||
|
||||
}
|
Reference in a new issue