ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/contrib/oper_override.c
Revision: 812
Committed: Thu Sep 7 09:41:54 2006 UTC (19 years, 11 months ago) by michael
Content type: text/x-csrc
File size: 2225 byte(s)
Log Message:
- Imported contrib/

File Contents

# User Rev Content
1 michael 812 /*
2     * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3     * oper_override.c: Gives flagged IRC opers channel mode privileges.
4     *
5     * Copyright (C) 2006 by the past and present ircd coders, and others.
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20     * USA
21     *
22     * $Id$
23     */
24    
25     #include "stdinc.h"
26     #include "conf/conf.h"
27     #include "channel.h"
28     #include "channel_mode.h"
29     #include "client.h"
30     #include "ircd.h"
31     #include "send.h"
32    
33     static unsigned int flag_override;
34     static dlink_node *haccess;
35    
36     static void *
37     get_channel_access(va_list args)
38     {
39     struct Client *client_p = va_arg(args, struct Client *);
40     struct Membership *ms = va_arg(args, struct Membership *);
41     int *level = va_arg(args, int *);
42    
43     if (MyOper(client_p) && (client_p->localClient->operflags & flag_override))
44     *level = CHACCESS_CHANOP;
45     else
46     pass_callback(haccess, client_p, ms, level);
47    
48     return NULL;
49     }
50    
51     INIT_MODULE(oper_override, "$Revision$")
52     {
53     flag_override = register_conf_flag(oper_flag_map, 'V', "override");
54     haccess = install_hook(channel_access_cb, get_channel_access);
55     }
56    
57     CLEANUP_MODULE
58     {
59     dlink_node *ptr;
60    
61     DLINK_FOREACH(ptr, oper_list.head)
62     ((struct Client *) ptr->data)->localClient->operflags &= ~flag_override;
63    
64     DLINK_FOREACH(ptr, oper_confs.head)
65     ((struct OperatorConf *) ptr->data)->flags &= ~flag_override;
66    
67     uninstall_hook(channel_access_cb, get_channel_access);
68     unregister_conf_flag(oper_flag_map, flag_override);
69    
70     sendto_realops_flags(UMODE_ALL, L_ALL,
71     "Disabled override flag for all oper{} blocks, rehash to re-enable");
72     }

Properties

Name Value
svn:eol-style native
svn:keywords "Id Revision"