From e1828057c322f6e905bcc55a9b5613853d394081 Mon Sep 17 00:00:00 2001 From: rburchell Date: Sun, 15 Feb 2009 15:20:23 +0000 Subject: Add include/svsoper.h, add skeleton methods/doc. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2058 5417fbe8-f217-4b02-8779-1006273d7864 --- include/services.h | 1 + include/svsoper.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 include/svsoper.h (limited to 'include') diff --git a/include/services.h b/include/services.h index dc3f740b3..bceb829a0 100644 --- a/include/services.h +++ b/include/services.h @@ -433,6 +433,7 @@ typedef struct csmodeutil_ CSModeUtil; typedef struct session_ Session; #include "bots.h" +#include "svsoper.h" /*************************************************************************/ diff --git a/include/svsoper.h b/include/svsoper.h new file mode 100644 index 000000000..bf5c5c486 --- /dev/null +++ b/include/svsoper.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2008-2009 Robin Burchell + * Copyright (C) 2008-2009 Anope Team + * + * Please read COPYING and README for further details. + * + * + * $Id$ + * + */ + +class SVSOper +{ + 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 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 commands; + public: + + /** 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); +}; -- cgit