2 * Copyright (C) 2002 Hybrid Development Team
3 * Copyright (C) 2004 ircd-ratbox development team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 1, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 * $Id: m_opme.c 19174 2005-05-19 08:50:25Z leeh $
32 #include "irc_string.h"
37 #include "s_newconf.h"
39 static int mo_opme(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[]);
41 struct Message opme_msgtab
= {
42 "OPME", 0, 0, 0, MFLG_SLOW
,
43 {mg_unreg
, mg_not_oper
, mg_ignore
, mg_ignore
, mg_ignore
, {mo_opme
, 2}}
46 mapi_clist_av1 opme_clist
[] = { &opme_msgtab
, NULL
};
48 DECLARE_MODULE_AV1(opme
, NULL
, NULL
, opme_clist
, NULL
, NULL
, "$Revision: 19174 $");
53 ** parv[0] = sender prefix
57 mo_opme(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
59 struct Channel
*chptr
;
60 struct membership
*msptr
;
64 if(!IsOperAdmin(source_p
))
66 sendto_one(source_p
, form_str(ERR_NOPRIVS
), me
.name
, source_p
->name
, "opme");
70 if((chptr
= find_channel(parv
[1])) == NULL
)
72 sendto_one_numeric(source_p
, ERR_NOSUCHCHANNEL
,
73 form_str(ERR_NOSUCHCHANNEL
), parv
[1]);
77 DLINK_FOREACH(ptr
, chptr
->members
.head
)
83 sendto_one(source_p
, ":%s NOTICE %s :%s Channel is not opless",
84 me
.name
, parv
[0], parv
[1]);
89 msptr
= find_channel_membership(chptr
, source_p
);
94 msptr
->flags
|= CHFL_CHANOP
;
96 sendto_wallops_flags(UMODE_WALLOP
, &me
,
97 "OPME called for [%s] by %s!%s@%s",
98 parv
[1], source_p
->name
, source_p
->username
, source_p
->host
);
99 ilog(L_MAIN
, "OPME called for [%s] by %s!%s@%s",
100 parv
[1], source_p
->name
, source_p
->username
, source_p
->host
);
102 /* dont send stuff for local channels remotely. */
103 if(*chptr
->chname
!= '&')
105 sendto_server(NULL
, NULL
, NOCAPS
, NOCAPS
,
106 ":%s WALLOPS :OPME called for [%s] by %s!%s@%s",
107 me
.name
, parv
[1], source_p
->name
, source_p
->username
, source_p
->host
);
108 sendto_server(NULL
, chptr
, NOCAPS
, NOCAPS
, ":%s PART %s", source_p
->name
, parv
[1]);
109 sendto_server(NULL
, chptr
, NOCAPS
, NOCAPS
,
110 ":%s SJOIN %ld %s + :@%s",
111 me
.name
, (long) chptr
->channelts
, parv
[1], source_p
->name
);
114 sendto_channel_local(ALL_MEMBERS
, chptr
,
115 ":%s MODE %s +o %s", me
.name
, parv
[1], source_p
->name
);