3 * m_extendchans.c: Allow an oper or service to let a given user join more channels.
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
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.
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.
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
30 #include "s_newconf.h"
34 static const char extendchans_desc
[] =
35 "Allow an oper or service to let a given user join more channels";
37 static void mo_extendchans(struct MsgBuf
*, struct Client
*, struct Client
*, int, const char **);
38 static void me_extendchans(struct MsgBuf
*, struct Client
*, struct Client
*, int, const char **);
40 struct Message extendchans_msgtab
= {
41 "EXTENDCHANS", 0, 0, 0, 0,
42 { mg_unreg
, mg_ignore
, mg_ignore
, mg_ignore
, {me_extendchans
, 2}, {mo_extendchans
, 2}}
45 mapi_clist_av1 extendchans_clist
[] = { &extendchans_msgtab
, NULL
};
47 DECLARE_MODULE_AV2(extendchans
, NULL
, NULL
, extendchans_clist
, NULL
, NULL
, NULL
, NULL
, extendchans_desc
);
50 mo_extendchans(struct MsgBuf
*msgbuf_p
, struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
52 struct Client
*target_p
;
54 if(!HasPrivilege(source_p
, "oper:extendchans"))
56 sendto_one(source_p
, form_str(ERR_NOPRIVS
), me
.name
, source_p
->name
, "extendchans");
60 if(EmptyString(parv
[1]))
62 sendto_one(source_p
, form_str(ERR_NEEDMOREPARAMS
), me
.name
, source_p
->name
, "EXTENDCHANS");
66 if((target_p
= find_chasing(source_p
, parv
[1], NULL
)) == NULL
)
69 /* Is the target user local? */
70 if(MyClient(target_p
))
72 sendto_one_notice(target_p
, ":*** %s (%s@%s) is extending your channel limit",
73 source_p
->name
, source_p
->username
, source_p
->host
);
74 SetExtendChans(target_p
);
76 else /* Target user isn't local, so pass it on. */
78 struct Client
*cptr
= target_p
->servptr
;
79 sendto_one(cptr
, ":%s ENCAP %s EXTENDCHANS %s",
80 get_id(source_p
, cptr
), cptr
->name
, get_id(target_p
, cptr
));
83 sendto_one_notice(source_p
, ":You have extended the channel limit on: %s (%s@%s)",
84 target_p
->name
, target_p
->username
, target_p
->orighost
);
88 me_extendchans(struct MsgBuf
*msgbuf_p
, struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
90 struct Client
*target_p
;
92 target_p
= find_person(parv
[1]);
95 sendto_one_numeric(source_p
, ERR_NOSUCHNICK
, form_str(ERR_NOSUCHNICK
), parv
[1]);
99 /* Is the target user local? If not, pass it on. */
100 if(!MyClient(target_p
))
102 struct Client
*cptr
= target_p
->servptr
;
103 sendto_one(cptr
, ":%s ENCAP %s EXTENDCHANS %s",
104 get_id(source_p
, cptr
), cptr
->name
, get_id(target_p
, cptr
));
108 sendto_one_notice(target_p
, ":*** %s (%s@%s) is extending your channel limit",
109 source_p
->name
, source_p
->username
, source_p
->host
);
110 SetExtendChans(target_p
);