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 int mo_extendchans(struct MsgBuf
*, struct Client
*, struct Client
*, int, const char **);
35 static int me_extendchans(struct MsgBuf
*, struct Client
*, struct Client
*, int, const char **);
37 struct Message extendchans_msgtab
= {
38 "EXTENDCHANS", 0, 0, 0, MFLG_SLOW
,
39 { mg_unreg
, mg_ignore
, mg_ignore
, mg_ignore
, {me_extendchans
, 2}, {mo_extendchans
, 2}}
42 mapi_clist_av1 extendchans_clist
[] = { &extendchans_msgtab
, NULL
};
44 DECLARE_MODULE_AV1(extendchans
, NULL
, NULL
, extendchans_clist
, NULL
, NULL
, "$Revision: $");
47 mo_extendchans(struct MsgBuf
*msgbuf_p
, struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
49 struct Client
*target_p
;
51 if(!HasPrivilege(source_p
, "oper:extendchans"))
53 sendto_one(source_p
, form_str(ERR_NOPRIVS
), me
.name
, source_p
->name
, "extendchans");
57 if(EmptyString(parv
[1]))
59 sendto_one(source_p
, form_str(ERR_NEEDMOREPARAMS
), me
.name
, source_p
->name
, "EXTENDCHANS");
63 if((target_p
= find_chasing(source_p
, parv
[1], NULL
)) == NULL
)
66 /* Is the target user local? */
67 if(MyClient(target_p
))
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
);
73 else /* Target user isn't local, so pass it on. */
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
));
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
);
87 me_extendchans(struct MsgBuf
*msgbuf_p
, struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
89 struct Client
*target_p
;
91 target_p
= find_person(parv
[1]);
94 sendto_one_numeric(source_p
, ERR_NOSUCHNICK
, form_str(ERR_NOSUCHNICK
), parv
[1]);
98 /* Is the target user local? If not, pass it on. */
99 if(!MyClient(target_p
))
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
));
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
);