ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_svspart.c
Revision: 4565
Committed: Sun Aug 24 10:27:40 2014 UTC (11 years ago) by michael
Content type: text/x-csrc
File size: 3296 byte(s)
Log Message:
- Update GPL 2 license headers

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 2014-2014 ircd-hybrid development team
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file m_svspart.c
23 * \brief Includes required functions for processing the SVSPART command.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "list.h"
29 #include "channel.h"
30 #include "client.h"
31 #include "hash.h"
32 #include "irc_string.h"
33 #include "ircd.h"
34 #include "numeric.h"
35 #include "send.h"
36 #include "parse.h"
37 #include "modules.h"
38 #include "conf.h"
39 #include "packet.h"
40
41
42 /*! \brief SVSPART command handler
43 *
44 * \param source_p Pointer to allocated Client struct from which the message
45 * originally comes from. This can be a local or remote client.
46 * \param parc Integer holding the number of supplied arguments.
47 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
48 * pointers.
49 * \note Valid arguments for this command are:
50 * - parv[0] = command
51 * - parv[1] = nickname
52 * - parv[2] = channel name
53 * - parv[3] = part message
54 */
55 static int
56 ms_svspart(struct Client *source_p, int parc, char *parv[])
57 {
58 struct Client *target_p = NULL;
59
60 if (!HasFlag(source_p, FLAGS_SERVICE))
61 return 0;
62
63 if (EmptyString(parv[2]))
64 return 0;
65
66 if ((target_p = find_person(source_p, parv[1])) == NULL)
67 return 0;
68
69 if (MyConnect(target_p))
70 {
71 channel_do_part(target_p, parv[2], parv[3]);
72 return 0;
73 }
74
75 if (target_p->from == source_p->from)
76 {
77 sendto_realops_flags(UMODE_DEBUG, L_ALL, SEND_NOTICE,
78 "Received wrong-direction SVSPART "
79 "for %s (behind %s) from %s",
80 target_p->name, source_p->from->name,
81 get_client_name(source_p, HIDE_IP));
82 return 0;
83 }
84
85 if (parc == 3)
86 sendto_one(target_p, ":%s SVSPART %s %s", source_p->id,
87 target_p->id, parv[2]);
88 else
89 sendto_one(target_p, ":%s SVSPART %s %s :%s", source_p->id,
90 target_p->id, parv[2], parv[3]);
91 return 0;
92 }
93
94 static struct Message svspart_msgtab =
95 {
96 "SVSPART", NULL, 0, 0, 3, MAXPARA, MFLG_SLOW, 0,
97 { m_unregistered, m_ignore, ms_svspart, m_ignore, m_ignore, m_ignore }
98 };
99
100 static void
101 module_init(void)
102 {
103 mod_add_cmd(&svspart_msgtab);
104 }
105
106 static void
107 module_exit(void)
108 {
109 mod_del_cmd(&svspart_msgtab);
110 }
111
112 struct module module_entry =
113 {
114 .node = { NULL, NULL, NULL },
115 .name = NULL,
116 .version = "$Revision$",
117 .handle = NULL,
118 .modinit = module_init,
119 .modexit = module_exit,
120 .flags = 0
121 };

Properties

Name Value
svn:keywords Id Revision