ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_svskill.c
Revision: 7997
Committed: Tue Mar 14 13:17:52 2017 UTC (9 years, 4 months ago) by michael
Content type: text/x-csrc
File size: 3665 byte(s)
Log Message:
- Rename get_client_name() to client_get_name()

File Contents

# User Rev Content
1 michael 2602 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 michael 2602 *
4 michael 2820 * Copyright (c) 1999 Bahamut development team.
5 michael 7924 * Copyright (c) 2013-2017 ircd-hybrid development team
6 michael 2602 *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
20 michael 2602 * USA
21     */
22    
23     /*! \file m_svskill.c
24     * \brief Includes required functions for processing the SVSKILL command.
25 michael 2605 * \version $Id$
26 michael 2602 */
27    
28     #include "stdinc.h"
29     #include "client.h"
30     #include "ircd.h"
31     #include "send.h"
32     #include "parse.h"
33     #include "modules.h"
34     #include "irc_string.h"
35     #include "conf.h"
36    
37    
38 michael 3300 /*! \brief SVSKILL command handler
39 michael 2602 *
40     * \param source_p Pointer to allocated Client struct from which the message
41     * originally comes from. This can be a local or remote client.
42     * \param parc Integer holding the number of supplied arguments.
43     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
44     * pointers.
45     * \note Valid arguments for this command are:
46 michael 3096 * - parv[0] = command
47 michael 2602 * - parv[1] = nickname
48 michael 3294 * - parv[2] = timestamp
49 michael 2602 * - parv[3] = kill message
50     */
51 michael 2820 static int
52 michael 3156 ms_svskill(struct Client *source_p, int parc, char *parv[])
53 michael 2602 {
54     struct Client *target_p = NULL;
55     const char *comment = NULL;
56 michael 7513 char reason[REASONLEN + 1] = "SVSKilled: ";
57 michael 7330 uintmax_t ts = 0;
58 michael 2602
59     if (!HasFlag(source_p, FLAGS_SERVICE))
60 michael 2820 return 0;
61 michael 2602
62     if (EmptyString(parv[1]))
63 michael 2820 return 0;
64 michael 2602
65     if (parc > 3)
66     {
67 michael 6462 comment = parv[3] ? parv[3] : CONF_NOREASON;
68 michael 7330 ts = strtoumax(parv[2], NULL, 10);
69 michael 2602 }
70     else
71 michael 6462 comment = (parc > 2 && parv[2]) ? parv[2] : CONF_NOREASON;
72 michael 2602
73 michael 3156 if ((target_p = find_person(source_p, parv[1])) == NULL)
74 michael 2820 return 0;
75 michael 2602
76     if (ts && (ts != target_p->tsinfo))
77 michael 2820 return 0;
78 michael 2602
79 michael 2621 if (MyConnect(target_p))
80 michael 2602 {
81     strlcpy(reason + 11, comment, sizeof(reason) - 11);
82 michael 3171 exit_client(target_p, reason);
83 michael 2820 return 0;
84 michael 2602 }
85    
86 michael 3156 if (target_p->from == source_p->from)
87 michael 2602 {
88     sendto_realops_flags(UMODE_DEBUG, L_ALL, SEND_NOTICE,
89     "Received wrong-direction SVSKILL "
90     "for %s (behind %s) from %s",
91 michael 3156 target_p->name, source_p->from->name,
92 michael 7997 client_get_name(source_p, HIDE_IP));
93 michael 2820 return 0;
94 michael 2602 }
95    
96     if (ts == 0)
97 michael 3184 sendto_one(target_p, ":%s SVSKILL %s :%s", source_p->id,
98     target_p->id, comment);
99 michael 2602 else
100 michael 6782 sendto_one(target_p, ":%s SVSKILL %s %ju :%s", source_p->id,
101 michael 3184 target_p->id, ts, comment);
102 michael 2820 return 0;
103 michael 2602 }
104    
105 michael 2820 static struct Message svskill_msgtab =
106     {
107 michael 5881 .cmd = "SVSKILL",
108     .args_min = 2,
109     .args_max = MAXPARA,
110     .handlers[UNREGISTERED_HANDLER] = m_ignore,
111     .handlers[CLIENT_HANDLER] = m_ignore,
112     .handlers[SERVER_HANDLER] = ms_svskill,
113     .handlers[ENCAP_HANDLER] = m_ignore,
114     .handlers[OPER_HANDLER] = m_ignore
115 michael 2602 };
116    
117     static void
118     module_init(void)
119     {
120     mod_add_cmd(&svskill_msgtab);
121     }
122    
123     static void
124     module_exit(void)
125     {
126     mod_del_cmd(&svskill_msgtab);
127     }
128    
129 michael 2820 struct module module_entry =
130     {
131 michael 2605 .version = "$Revision$",
132 michael 2602 .modinit = module_init,
133     .modexit = module_exit,
134     };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision