Public Member Functions | Static Public Member Functions | Data Fields | Private Attributes

OperType Class Reference

#include <opertype.h>

Collaboration diagram for OperType:
Collaboration graph
[legend]

Public Member Functions

 OperType (const Anope::string &nname)
bool HasCommand (const Anope::string &cmdstr) const
bool HasPriv (const Anope::string &privstr) const
void AddCommand (const Anope::string &cmdstr)
void AddPriv (const Anope::string &privstr)
const Anope::stringGetName () const
void Inherits (OperType *ot)
const std::list< Anope::stringGetCommands () const
const std::list< Anope::stringGetPrivs () const

Static Public Member Functions

static OperTypeFind (const Anope::string &name)

Data Fields

Anope::string modes

Private Attributes

Anope::string name
std::list< Anope::stringprivs
std::list< Anope::stringcommands
std::set< OperType * > inheritances

Detailed Description

Definition at line 45 of file opertype.h.


Constructor & Destructor Documentation

OperType::OperType ( const Anope::string nname  ) 

Create a new opertype of the given name.

Parameters:
nname The opertype name, e.g. "sra".

Definition at line 41 of file opertype.cpp.


Member Function Documentation

void OperType::AddCommand ( const Anope::string cmdstr  ) 

Add the specified command to this opertype.

Parameters:
cmdstr The command mask to grant this opertype access to, e.g: nickserv/ *, chanserv/set/ *, botserv/set/private.

Definition at line 81 of file opertype.cpp.

References commands.

Referenced by DoOperType().

void OperType::AddPriv ( const Anope::string privstr  ) 

Add the specified priv mask to this opertype.

Parameters:
privstr The specified mask of privs to grant this opertype access to, e.g. users/auspex, users/ *, etc.

Definition at line 86 of file opertype.cpp.

References privs.

Referenced by DoOperType().

OperType * OperType::Find ( const Anope::string name  )  [static]

Find an oper type by name

Parameters:
name The name
Returns:
The oper type

Definition at line 28 of file opertype.cpp.

References Config, GetName(), and ServerConfig::MyOperTypes.

Referenced by CommandOSOper::Execute(), SQLOperResult::OnResult(), and IdentifyInterface::OnResult().

const std::list< Anope::string > OperType::GetCommands (  )  const

Gets the icommands for this opertype

Returns:
A list of commands

Definition at line 101 of file opertype.cpp.

References commands, GetPrivs(), and inheritances.

Referenced by CommandOSOper::Execute().

const Anope::string & OperType::GetName (  )  const
const std::list< Anope::string > OperType::GetPrivs (  )  const

Gets the privileges for this opertype

Returns:
A list of privileges

Definition at line 114 of file opertype.cpp.

References GetPrivs(), inheritances, and privs.

Referenced by CommandOSOper::Execute(), GetCommands(), and GetPrivs().

bool OperType::HasCommand ( const Anope::string cmdstr  )  const

Check whether this opertype has access to run the given command string.

Parameters:
cmdstr The string to check, e.g. botserv/set/private.
Returns:
True if this opertype may run the specified command, false otherwise.

Definition at line 45 of file opertype.cpp.

References commands, HasCommand(), inheritances, and Anope::Match().

Referenced by HasCommand().

bool OperType::HasPriv ( const Anope::string privstr  )  const

Check whether this opertype has access to the given special permission.

Parameters:
privstr The priv to check for, e.g. users/auspex.
Returns:
True if this opertype has the specified priv, false otherwise.

Definition at line 63 of file opertype.cpp.

References HasPriv(), inheritances, Anope::Match(), and privs.

Referenced by HasPriv().

void OperType::Inherits ( OperType ot  ) 

Make this opertype inherit commands and privs from another opertype

Parameters:
ot The opertype to inherit from

Definition at line 96 of file opertype.cpp.

References inheritances.

Referenced by DoOperType().


Field Documentation

std::list<Anope::string> OperType::commands [private]

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.

Definition at line 65 of file opertype.h.

Referenced by AddCommand(), GetCommands(), and HasCommand().

std::set<OperType *> OperType::inheritances [private]

Set of opertypes we inherit from

Definition at line 69 of file opertype.h.

Referenced by GetCommands(), GetPrivs(), HasCommand(), HasPriv(), and Inherits().

Modes to set when someone identifys using this opertype

Definition at line 73 of file opertype.h.

Referenced by DoOperType(), and CommandOSOper::Execute().

The name of this opertype, e.g. "sra".

Definition at line 50 of file opertype.h.

Referenced by GetName().

std::list<Anope::string> OperType::privs [private]

Privs that this opertype may use, e.g. 'users/auspex'. This *must* be std::list, see commands comment for details.

Definition at line 55 of file opertype.h.

Referenced by AddPriv(), GetPrivs(), and HasPriv().


The documentation for this class was generated from the following files: