]> jfr.im git - solanum.git/blame - extensions/m_extendchans.c
msg: remove last vestiges of the fakelag system. charybdis has never supported fakelag.
[solanum.git] / extensions / m_extendchans.c
CommitLineData
a4721f5e
AC
1/*
2 * charybdis
3 * m_extendchans.c: Allow an oper or service to let a given user join more channels.
4 *
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2006 ircd-ratbox development team
8 * Copyright (C) 2006-2016 ircd-seven development team
9 * Copyright (C) 2015-2016 ChatLounge IRC Network Development Team
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 * USA
25 */
26
27#include "stdinc.h"
28#include "client.h"
29#include "modules.h"
30#include "s_newconf.h"
31#include "send.h"
32#include "numeric.h"
33
760bafda
AC
34static int mo_extendchans(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
35static int me_extendchans(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
a4721f5e
AC
36
37struct Message extendchans_msgtab = {
7baa37a9 38 "EXTENDCHANS", 0, 0, 0, 0,
a4721f5e
AC
39 { mg_unreg, mg_ignore, mg_ignore, mg_ignore, {me_extendchans, 2}, {mo_extendchans, 2}}
40};
41
42mapi_clist_av1 extendchans_clist[] = { &extendchans_msgtab, NULL };
43
44DECLARE_MODULE_AV1(extendchans, NULL, NULL, extendchans_clist, NULL, NULL, "$Revision: $");
45
46static int
760bafda 47mo_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
a4721f5e
AC
48{
49 struct Client *target_p;
50
51 if(!HasPrivilege(source_p, "oper:extendchans"))
52 {
53 sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "extendchans");
54 return 0;
55 }
56
57 if(EmptyString(parv[1]))
58 {
59 sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "EXTENDCHANS");
60 return 0;
61 }
62
63 if((target_p = find_chasing(source_p, parv[1], NULL)) == NULL)
64 return 0;
65
66 /* Is the target user local? */
67 if(MyClient(target_p))
68 {
69 sendto_one_notice(target_p, ":*** %s (%s@%s) is extending your channel limit",
70 source_p->name, source_p->username, source_p->host);
71 SetExtendChans(target_p);
72 }
73 else /* Target user isn't local, so pass it on. */
74 {
75 struct Client *cptr = target_p->servptr;
76 sendto_one(cptr, ":%s ENCAP %s EXTENDCHANS %s",
77 get_id(source_p, cptr), cptr->name, get_id(target_p, cptr));
78 }
79
80 sendto_one_notice(source_p, ":You have extended the channel limit on: %s (%s@%s)",
81 target_p->name, target_p->username, target_p->orighost);
82
83 return 0;
84}
85
86static int
760bafda 87me_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
a4721f5e
AC
88{
89 struct Client *target_p;
90
91 target_p = find_person(parv[1]);
92 if(target_p == NULL)
93 {
94 sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]);
95 return 0;
96 }
97
98 /* Is the target user local? If not, pass it on. */
99 if(!MyClient(target_p))
100 {
101 struct Client *cptr = target_p->servptr;
102 sendto_one(cptr, ":%s ENCAP %s EXTENDCHANS %s",
103 get_id(source_p, cptr), cptr->name, get_id(target_p, cptr));
104 return 0;
105 }
106
107 sendto_one_notice(target_p, ":*** %s (%s@%s) is extending your channel limit",
108 source_p->name, source_p->username, source_p->host);
109 SetExtendChans(target_p);
110
111 return 0;
112}