Anope IRC Services  Version 2.0
Public Member Functions | Static Public Member Functions | Data Fields | Private Attributes
OperType Class Reference

#include <opertype.h>

Collaboration diagram for OperType:
Collaboration graph

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 44 of file opertype.h.

Constructor & Destructor Documentation

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

Create a new opertype of the given name.

nnameThe opertype name, e.g. "sra".

Definition at line 55 of file opertype.cpp.

Member Function Documentation

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

Add the specified command to this opertype.

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

Definition at line 103 of file opertype.cpp.

References commands.

Referenced by Configuration::Conf::Conf().

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

Add the specified priv mask to this opertype.

privstrThe specified mask of privs to grant this opertype access to, e.g. users/auspex, users/ *, etc.

Definition at line 108 of file opertype.cpp.

References privs.

Referenced by Configuration::Conf::Conf().

OperType * OperType::Find ( const Anope::string name)

Find an oper type by name

nameThe name
The oper type

Definition at line 42 of file opertype.cpp.

References GetName(), and name.

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

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

Gets the icommands for this opertype

A list of commands

Definition at line 124 of file opertype.cpp.

References commands, GetCommands(), and inheritances.

Referenced by MyXMLRPCEvent::DoOperType(), CommandOSOper::Execute(), GetCommands(), and CommandOSOper::HasPrivs().

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

Gets the privileges for this opertype

A list of privileges

Definition at line 137 of file opertype.cpp.

References GetPrivs(), inheritances, and privs.

Referenced by MyXMLRPCEvent::DoOperType(), CommandOSOper::Execute(), GetPrivs(), and CommandOSOper::HasPrivs().

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

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

cmdstrThe string to check, e.g. botserv/set/private.
True if this opertype may run the specified command, false otherwise.

Definition at line 59 of file opertype.cpp.

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

Referenced by CommandSource::HasCommand(), and HasCommand().

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

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

privstrThe priv to check for, e.g. users/auspex.
True if this opertype has the specified priv, false otherwise.

Definition at line 81 of file opertype.cpp.

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

Referenced by CommandSource::HasPriv(), and HasPriv().

void OperType::Inherits ( OperType ot)

Make this opertype inherit commands and privs from another opertype

otThe opertype to inherit from

Definition at line 118 of file opertype.cpp.

References inheritances.

Referenced by Configuration::Conf::Conf().

Field Documentation

std::list<Anope::string> OperType::commands

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 64 of file opertype.h.

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

std::set<OperType *> OperType::inheritances

Set of opertypes we inherit from

Definition at line 68 of file opertype.h.

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

Anope::string OperType::modes

Modes to set when someone identifys using this opertype

Definition at line 72 of file opertype.h.

Referenced by Configuration::Conf::Conf(), and CommandOSOper::Execute().

Anope::string OperType::name

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

Definition at line 49 of file opertype.h.

Referenced by Find(), and GetName().

std::list<Anope::string> OperType::privs

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

Definition at line 54 of file opertype.h.

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

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