class Command

Base class for commands. More...

Contains pure virtuals
Definition#include <DCCUser.h>
InheritsQObject
Inherited byCmdAccess, CmdExit, CmdJoin, CmdWho
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods

Protected Members


Detailed Description

Command (IRCModule* ircModule, DCCUser* pUser, QString text)

Construct a new Command object.

PRECONDITIONS: ircModule != 0 ; pUser != 0

Parameters:
ircModuleA pointer to the IRCModule object the command should use to interact with the IRC server.
pUserA pointer to the DCCUser object of the user initiating the command.
textA string containing the text the user sent (including the command's name and parameters).

void execute ()
[pure virtual]

Make the command execute. Subclasses must redefine this method and implement their specific behavior.

void unExecute ()
[virtual]

Cancel the effects of a command, if possible. Subclasses can redefine this method to implement command undoing. This method does nothing by default.

bool hasAccess (unsigned int level)
[protected]

Determine if the user pointed to by the _user member has the specified access on his current channel.

Parameters:
levelThe minimum level needed to execute the command.

Returns: true if the user's level on his current channel is equal or higher than level, false otherwise.

bool hasGlobalAccess (unsigned int level)
[protected]

Determine if the user pointed to by the _user member has the specified global access (access on channel "*")

Parameters:
levelThe minimum level needed to execute the command.

Returns: true if the user's level on special channel "*" is equal or higher than level, false otherwise.

bool hasEnoughParams (unsigned int min,QString syntax = "")
[protected]

Determine if the user specified enough parameters for the command. If the user specified less than min parameters, he is given an error message with the syntax parameter for more details.

Parameters:
minMinimum necessary number of parameters to the command.
syntaxA string containing an explanation of the command's syntax. this string is displayed to the user if he did not supply enough parameters.