]> jfr.im git - irc/rqf/shadowircd.git/blame - extensions/m_opme.c
Add SHA256/SHA512 support to crypt.c and fix up the MD5 component (it seemed to have...
[irc/rqf/shadowircd.git] / extensions / m_opme.c
CommitLineData
212380e3 1/* contrib/m_opme.c
2 * Copyright (C) 2002 Hybrid Development Team
3 * Copyright (C) 2004 ircd-ratbox development team
4 *
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)
8 * any later version.
9 *
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.
14 *
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.
18 *
212380e3 19 */
20#include "stdinc.h"
212380e3 21#include "channel.h"
22#include "client.h"
23#include "ircd.h"
24#include "numeric.h"
d3455e2c 25#include "logger.h"
212380e3 26#include "s_serv.h"
27#include "send.h"
28#include "whowas.h"
13ae2f4b 29#include "match.h"
212380e3 30#include "hash.h"
31#include "msg.h"
32#include "parse.h"
33#include "modules.h"
34#include "s_conf.h"
35#include "s_newconf.h"
36
37static int mo_opme(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
38
39struct Message opme_msgtab = {
40 "OPME", 0, 0, 0, MFLG_SLOW,
41 {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_opme, 2}}
42};
43
44mapi_clist_av1 opme_clist[] = { &opme_msgtab, NULL };
45
8e8f4ffc 46DECLARE_MODULE_AV1(opme, NULL, NULL, opme_clist, NULL, NULL, "$Revision: 3554 $");
212380e3 47
48
49/*
50** mo_opme
212380e3 51** parv[1] = channel
52*/
53static int
54mo_opme(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
55{
56 struct Channel *chptr;
57 struct membership *msptr;
71f6ebfa 58 rb_dlink_node *ptr;
212380e3 59
60 /* admins only */
61 if(!IsOperAdmin(source_p))
62 {
a5ea0e0d 63 sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
212380e3 64 return 0;
65 }
66
67 if((chptr = find_channel(parv[1])) == NULL)
68 {
69 sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
70 form_str(ERR_NOSUCHCHANNEL), parv[1]);
71 return 0;
72 }
73
71f6ebfa 74 RB_DLINK_FOREACH(ptr, chptr->members.head)
212380e3 75 {
76 msptr = ptr->data;
77
c1c91f94 78 if(is_chanop(msptr) || is_admin(msptr))
212380e3 79 {
5366977b 80 sendto_one_notice(source_p, ":%s Channel is not opless", parv[1]);
212380e3 81 return 0;
82 }
83 }
84
85 msptr = find_channel_membership(chptr, source_p);
86
87 if(msptr == NULL)
88 return 0;
89
90 msptr->flags |= CHFL_CHANOP;
91
92 sendto_wallops_flags(UMODE_WALLOP, &me,
93 "OPME called for [%s] by %s!%s@%s",
94 parv[1], source_p->name, source_p->username, source_p->host);
95 ilog(L_MAIN, "OPME called for [%s] by %s",
96 parv[1], get_oper_name(source_p));
97
98 /* dont send stuff for local channels remotely. */
99 if(*chptr->chname != '&')
100 {
101 sendto_server(NULL, NULL, NOCAPS, NOCAPS,
102 ":%s WALLOPS :OPME called for [%s] by %s!%s@%s",
103 me.name, parv[1], source_p->name, source_p->username, source_p->host);
8e8f4ffc 104 sendto_server(NULL, chptr, CAP_TS6, NOCAPS, ":%s PART %s", source_p->id, parv[1]);
8e8f4ffc 105 sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
106 ":%s SJOIN %ld %s + :@%s",
107 me.id, (long) chptr->channelts, parv[1], source_p->id);
212380e3 108 }
109
110 sendto_channel_local(ALL_MEMBERS, chptr,
111 ":%s MODE %s +o %s", me.name, parv[1], source_p->name);
112
113 return 0;
114}