summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-21 23:45:44 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-21 23:45:44 +0000
commita30abe26fc803900eaf5dc4c08a31aa1d3c9c89f (patch)
tree7d59c15a9c23401b91e100ebb9e98df2c7179e53 /include
parentff3eef491aa9e107d09d9dd9560ef7715b37b3b3 (diff)
Change User::oper to an OperInfo reference
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11945 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/configreader.h35
-rw-r--r--include/users.h11
2 files changed, 31 insertions, 15 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 3ec4ca826..d4bc4b71b 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -61,8 +61,6 @@ struct CoreExport ConfigTag : public refcountbase
*/
typedef std::multimap<std::string, reference<ConfigTag> > ConfigDataHash;
-typedef std::map<std::string, reference<ConfigTag> > TagIndex;
-
/** Defines the server's length limits on various length-limited
* items such as topics, nicknames, channel names etc.
*/
@@ -112,6 +110,30 @@ class ServerLimits
}
};
+class CoreExport OperInfo : public refcountbase
+{
+ public:
+ /** <oper> block used for this oper-up. May be NULL. */
+ reference<ConfigTag> oper_block;
+ /** <type> block used for this oper-up. Valid for local users, may be NULL on remote */
+ reference<ConfigTag> type_block;
+ /** <class> blocks referenced from the <type> block. These define individual permissions */
+ std::vector<reference<ConfigTag> > class_blocks;
+ /** Name of the oper type; i.e. the one shown in WHOIS */
+ std::string name;
+
+ /** Get a configuration item, searching in the oper, type, and class blocks (in that order) */
+ std::string getConfig(const std::string& key);
+
+ inline const char* NameStr()
+ {
+ return irc::Spacify(name.c_str());
+ }
+};
+
+typedef std::map<std::string, reference<ConfigTag> > TagIndex;
+typedef std::map<std::string, reference<OperInfo> > OperIndex;
+
/** This class holds the bulk of the runtime configuration for the ircd.
* It allows for reading new config values, accessing configuration files,
* and storage of the configuration data needed to run the ircd, such as
@@ -495,13 +517,10 @@ class CoreExport ServerConfig
*/
bool FullHostInTopic;
- /** All oper type definitions from the config file
- */
- TagIndex opertypes;
-
- /** All oper class definitions from the config file
+ /** Oper block and type index.
+ * For anonymous oper blocks (type only), prefix with a space.
*/
- TagIndex operclass;
+ OperIndex oper_blocks;
/** Saved argv from startup
*/
diff --git a/include/users.h b/include/users.h
index 51600e3af..bb8fba007 100644
--- a/include/users.h
+++ b/include/users.h
@@ -60,6 +60,7 @@ enum RegistrationState {
class Channel;
class UserResolver;
struct ConfigTag;
+class OperInfo;
/** Holds information relevent to &lt;connect allow&gt; and &lt;connect deny&gt; tags in the config file.
*/
@@ -348,11 +349,8 @@ class CoreExport User : public StreamSocket
time_t awaytime;
/** The oper type they logged in as, if they are an oper.
- * This is used to check permissions in operclasses, so that
- * we can say 'yea' or 'nay' to any commands they issue.
- * The value of this was the value of a valid 'type name=' tag
*/
- std::string oper;
+ reference<OperInfo> oper;
/** Used by User to indicate the registration status of the connection
* It is a bitfield of the REG_NICK, REG_USER and REG_ALL bits to indicate
@@ -530,9 +528,8 @@ class CoreExport User : public StreamSocket
/** Oper up the user using the given opertype.
* This will also give the +o usermode.
- * @param opertype The oper type to oper as
*/
- void Oper(const std::string &opertype, const std::string &opername);
+ void Oper(OperInfo* info);
/** Change this users hash key to a new string.
* You should not call this function directly. It is used by the core
@@ -949,7 +946,7 @@ inline FakeUser* IS_SERVER(User* u)
return u->GetFd() == FD_FAKEUSER_NUMBER ? static_cast<FakeUser*>(u) : NULL;
}
/** Is an oper */
-#define IS_OPER(x) (!x->oper.empty())
+#define IS_OPER(x) (x->oper)
/** Is away */
#define IS_AWAY(x) (!x->awaymsg.empty())