EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SlashService Class Reference

#include "SlashService.h"

Inheritance diagram for SlashService:
Collaboration diagram for SlashService:

Public Member Functions

 SlashService (PyServiceMgr *mgr, CommandDispatcher *cd)
 
virtual ~SlashService ()
 
PyResult SlashCommand (Client *client, std::string command)
 
- Public Member Functions inherited from PyService
 PyService (PyServiceMgr *mgr, const char *serviceName)
 
virtual ~PyService ()
 
virtual PyResult Call (const std::string &method, PyCallArgs &args)
 
const char * GetName () const
 
- Public Member Functions inherited from PyCallable
 PyCallable ()
 
virtual ~PyCallable ()
 

Protected Member Functions

 PyCallable_DECL_CALL (SlashCmd)
 
- Protected Member Functions inherited from PyService
PyObject_BuildCachedReturn (PySubStream **result, const char *sessionInfo, CacheCheckTime check)
 
virtual PyBoundObjectCreateBoundObject (Client *pClient, const PyRep *bind_args)
 
virtual PyResult Handle_MachoResolveObject (PyCallArgs &call)
 
virtual PyResult Handle_MachoBindObject (PyCallArgs &call)
 
- Protected Member Functions inherited from PyCallable
void _SetCallDispatcher (CallDispatcher *d)
 

Protected Attributes

Dispatcher *const m_dispatch
 
CommandDispatcher *const m_commandDispatch
 
- Protected Attributes inherited from PyService
PyServiceMgr *const m_manager
 

Additional Inherited Members

- Protected Types inherited from PyService
enum  CacheCheckTime {
  check_Always = 0, check_Never, check_in_year, check_in_6_months,
  check_in_3_months, check_in_1_month, check_in_1_week, check_in_1_day,
  check_in_12_hours, check_in_6_hours, check_in_3_hours, check_in_2_hours,
  check_in_1_hour, check_in_30_minutes, check_in_15_minutes, check_in_5_minutes,
  check_in_1_minute, check_in_30_seconds, check_in_15_seconds, check_in_5_seconds,
  check_in_1_second, _checkCount
}
 
- Static Protected Attributes inherited from PyService
static const char *const s_checkTimeStrings [_checkCount]
 

Detailed Description

Definition at line 32 of file SlashService.h.

Constructor & Destructor Documentation

SlashService::SlashService ( PyServiceMgr mgr,
CommandDispatcher cd 
)
SlashService::~SlashService ( )
virtual

Definition at line 46 of file SlashService.cpp.

References m_dispatch.

46  {
47  delete m_dispatch;
48 }
Dispatcher *const m_dispatch
Definition: SlashService.h:41

Member Function Documentation

SlashService::PyCallable_DECL_CALL ( SlashCmd  )
protected
PyResult SlashService::SlashCommand ( Client client,
std::string  command 
)

Definition at line 65 of file SlashService.cpp.

References _log, CommandDispatcher::Execute(), Client::GetAccountRole(), PyService::GetName(), Client::GetName(), m_commandDispatch, and Acct::Role::SLASH.

66 {
67  if ((client->GetAccountRole() & Acct::Role::SLASH) != Acct::Role::SLASH) {
68  _log( COMMAND__ERROR, "%s: Client '%s' used a slash command but does not have Acct::Role::SLASH.", GetName(), client->GetName() );
69  throw CustomError ("You need to have Acct::Role::SLASH to execute commands.");
70  }
71 
72  return m_commandDispatch->Execute( client, command.c_str() );
73 }
int64 GetAccountRole() const
Definition: Client.h:118
#define _log(type, fmt,...)
Definition: logsys.h:124
PyResult Execute(Client *from, const char *msg)
const char * GetName() const
Definition: PyService.h:54
Advanced version of UserError that allows to send a full custom message.
Definition: PyExceptions.h:453
CommandDispatcher *const m_commandDispatch
Definition: SlashService.h:43
const char * GetName() const
Definition: Client.h:94

Here is the call graph for this function:

Member Data Documentation

CommandDispatcher* const SlashService::m_commandDispatch
protected

Definition at line 43 of file SlashService.h.

Referenced by SlashCommand().

Dispatcher* const SlashService::m_dispatch
protected

Definition at line 41 of file SlashService.h.

Referenced by ~SlashService().


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