summaryrefslogtreecommitdiff
path: root/include/opertype.h
diff options
context:
space:
mode:
authorrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2009-02-15 15:21:35 +0000
committerrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2009-02-15 15:21:35 +0000
commitf07229a9ee06bd989efd14f4223e787b90f9148e (patch)
tree2be730bfae5a09eba1e2e4b22fd300ce706d4490 /include/opertype.h
parentf92bf30f15b8f4d287abe3ba9e600cb832fa4e7e (diff)
Blah, blah..
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2061 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'include/opertype.h')
-rw-r--r--include/opertype.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/include/opertype.h b/include/opertype.h
new file mode 100644
index 000000000..9d5e77224
--- /dev/null
+++ b/include/opertype.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2008-2009 Robin Burchell <w00t@inspircd.org>
+ * Copyright (C) 2008-2009 Anope Team <team@anope.org>
+ *
+ * Please read COPYING and README for further details.
+ *
+ *
+ * $Id$
+ *
+ */
+
+class OperType
+{
+ private:
+ /** The name of this opertype, e.g. "sra".
+ */
+ std::string name;
+
+ /** Privs that this opertype may use, e.g. 'users/auspex'.
+ * This *must* be std::list, see commands comment for details.
+ */
+ std::list<std::string> privs;
+
+ /** Commands this user may execute, e.g:
+ * botserv/set/ *, botserv/set/private, botserv/ *
+ * et cetera.
+ *
+ * This *must* be std::list, not std::map, because
+ * we support full globbing here. This shouldn't be a problem
+ * as we don't invoke it often.
+ */
+ std::list<std::string> commands;
+ public:
+ /** Create a new opertype of the given name.
+ * @param nname The opertype name, e.g. "sra".
+ */
+ OperType(const std::string &nname);
+
+ /** Check whether this opertype has access to run the given command string.
+ * @param cmdstr The string to check, e.g. botserv/set/private.
+ * @return True if this opertype may run the specified command, false otherwise.
+ */
+ bool HasCommand(const std::string &cmdstr);
+
+ /** Check whether this opertype has access to the given special permission.
+ * @param privstr The priv to check for, e.g. users/auspex.
+ * @return True if this opertype has the specified priv, false otherwise.
+ */
+ bool HasPriv(const std::string &privstr);
+
+ /** Add the specified command to this opertype.
+ * @param cmdstr The command mask to grant this opertype access to, e.g: nickserv/ *, chanserv/set/ *, botserv/set/private.
+ */
+ void AddCommand(const std::string &cmdstr);
+
+ /** Add the specified priv mask to this opertype.
+ * @param privstr The specified mask of privs to grant this opertype access to, e.g. users/auspex, users/ *, etc.
+ */
+ void AddPriv(const std::string &privstr);
+};