… | |
… | |
7 | * |
7 | * |
8 | * Portions of this file were derived from sources bearing the following license: |
8 | * Portions of this file were derived from sources bearing the following license: |
9 | * Copyright © 2005 Jilles Tjoelker, et al. |
9 | * Copyright © 2005 Jilles Tjoelker, et al. |
10 | * Rights to this code are as documented in doc/pod/license.pod. |
10 | * Rights to this code are as documented in doc/pod/license.pod. |
11 | * |
11 | * |
12 | * $Id: privs.h,v 1.4 2007/09/16 18:54:42 pippijn Exp $ |
12 | * $Id: privs.h,v 1.5 2007/09/22 14:27:26 pippijn Exp $ |
13 | */ |
13 | */ |
14 | |
14 | |
15 | #ifndef PRIVS_H |
15 | #ifndef PRIVS_H |
16 | #define PRIVS_H |
16 | #define PRIVS_H |
|
|
17 | |
|
|
18 | #include <util/containers.h> |
17 | |
19 | |
18 | #define PRIV_NONE NULL |
20 | #define PRIV_NONE NULL |
19 | |
21 | |
20 | /* nickserv/userserv */ |
22 | /* nickserv/userserv */ |
21 | #define PRIV_USER_AUSPEX "user:auspex" |
23 | #define PRIV_USER_AUSPEX "user:auspex" |
… | |
… | |
54 | #define AC_IRCOP "special:ircop" |
56 | #define AC_IRCOP "special:ircop" |
55 | #define AC_SRA "general:admin" |
57 | #define AC_SRA "general:admin" |
56 | |
58 | |
57 | struct operclass_t : zero_initialised |
59 | struct operclass_t : zero_initialised |
58 | { |
60 | { |
|
|
61 | unsigned index; |
|
|
62 | typedef indexing_vector<operclass_t> list_type; |
|
|
63 | /* privs.c */ |
|
|
64 | static list_type list; |
|
|
65 | |
59 | char *name; |
66 | char *name; |
60 | char *privs; /* priv1 priv2 priv3... */ |
67 | char *privs; /* priv1 priv2 priv3... */ |
61 | int flags; |
68 | int flags; |
62 | }; |
69 | }; |
63 | |
70 | |
64 | #define OPERCLASS_NEEDOPER 0x1 /* only give privs to IRCops */ |
71 | #define OPERCLASS_NEEDOPER 0x1 /* only give privs to IRCops */ |
65 | |
72 | |
66 | /* soper list struct */ |
73 | /* soper list struct */ |
67 | struct soper_t : zero_initialised |
74 | struct soper_t : zero_initialised |
68 | { |
75 | { |
|
|
76 | unsigned index; |
|
|
77 | typedef indexing_vector<soper_t> list_type; |
|
|
78 | /* privs.c */ |
|
|
79 | static list_type list; |
|
|
80 | |
69 | myuser_t *myuser; |
81 | myuser_t *myuser; |
70 | char *name; |
82 | char *name; |
71 | operclass_t *operclass; |
83 | operclass_t *operclass; |
72 | char *classname; |
84 | char *classname; |
73 | int flags; |
85 | int flags; |
74 | }; |
86 | }; |
75 | |
87 | |
76 | #define SOPER_CONF 0x1 /* oper is listed in atheme.conf */ |
88 | #define SOPER_CONF 0x1 /* oper is listed in atheme.conf */ |
77 | |
89 | |
78 | /* privs.c */ |
|
|
79 | E list_t operclasslist; |
|
|
80 | E list_t soperlist; |
|
|
81 | |
|
|
82 | E void init_privs (void); |
90 | E void init_privs (void); |
83 | |
91 | |
84 | E operclass_t *operclass_add (char *name, char const *privs); |
92 | E operclass_t *operclass_add (char *name, char const *privs); |
85 | E void operclass_delete (operclass_t *operclass); |
93 | E void operclass_delete (operclass_t *operclass); |
86 | E operclass_t *operclass_find (char const * const name); |
94 | E operclass_t *operclass_find (char const * const name); |
|
|
95 | E void operclass_cleanup (); |
87 | |
96 | |
88 | E soper_t *soper_add (char *name, char *classname, int flags); |
97 | E soper_t *soper_add (char *name, char *classname, int flags); |
89 | E void soper_delete (soper_t *soper); |
98 | E void soper_delete (soper_t *soper); |
90 | E soper_t *soper_find (myuser_t *myuser); |
99 | E soper_t *soper_find (myuser_t *myuser); |
91 | E soper_t *soper_find_named (char *name); |
100 | E soper_t *soper_find_named (char *name); |
|
|
101 | E void soper_cleanup (); |
92 | |
102 | |
93 | E bool is_soper (myuser_t *myuser); |
103 | E bool is_soper (myuser_t *myuser); |
94 | E bool is_conf_soper (myuser_t *myuser); |
104 | E bool is_conf_soper (myuser_t *myuser); |
95 | |
105 | |
96 | /* has_any_privs(): used to determine whether we should give detailed |
106 | /* has_any_privs(): used to determine whether we should give detailed |