gloox  1.0.28
Classes | Public Types | Public Member Functions | List of all members
Adhoc::Command Class Reference

#include <adhoc.h>

Inheritance diagram for Adhoc::Command:
Inheritance graph
[legend]

Classes

class  Note
 

Public Types

enum  Action {
  Execute = 1 , Cancel = 2 , Previous = 4 , Next = 8 ,
  Complete = 16 , InvalidAction = 32
}
 
enum  Status { Executing , Completed , Canceled , InvalidStatus }
 
typedef std::list< const Note * > NoteList
 

Public Member Functions

 Command (const std::string &node, const std::string &sessionid, Action action, AdhocPlugin *plugin=0)
 
 Command (const std::string &node, const std::string &sessionid, Status status, AdhocPlugin *plugin=0)
 
 Command (const std::string &node, const std::string &sessionid, Status status, Action executeAction, int allowedActions=Complete, AdhocPlugin *plugin=0)
 
 Command (const std::string &node, Action action, AdhocPlugin *plugin=0)
 
 Command (const Tag *tag=0)
 
virtual ~Command ()
 
const std::string & node () const
 
const std::string & sessionID () const
 
Status status () const
 
Action action () const
 
int actions () const
 
const NoteListnotes () const
 
void addNote (const Note *note)
 
GLOOX_DEPRECATED const AdhocPluginform () const
 
const AdhocPluginplugin () const
 
virtual const std::string & filterString () const
 
virtual StanzaExtensionnewInstance (const Tag *tag) const
 
virtual Tagtag () const
 
virtual StanzaExtensionclone () const
 
- Public Member Functions inherited from StanzaExtension
 StanzaExtension (int type)
 
virtual ~StanzaExtension ()
 
virtual StanzaembeddedStanza () const
 
virtual TagembeddedTag () const
 
int extensionType () const
 

Detailed Description

An abstraction of an Adhoc Command element (from Adhoc Commands, XEP-0050) as a StanzaExtension.

Author
Jakob Schröter js@ca.nosp@m.maya.nosp@m..net
Since
1.0

Definition at line 91 of file adhoc.h.

Member Typedef Documentation

◆ NoteList

typedef std::list<const Note*> NoteList

A list of command notes.

Definition at line 198 of file adhoc.h.

Member Enumeration Documentation

◆ Action

enum Action

Specifies the action to undertake with the given command.

Enumerator
Execute 

The command should be executed or continue to be executed. This is the default value.

Cancel 

The command should be canceled.

Previous 

The command should be digress to the previous stage of execution.

Next 

The command should progress to the next stage of execution.

Complete 

The command should be completed (if possible).

InvalidAction 

The action is unknown or invalid.

Definition at line 100 of file adhoc.h.

◆ Status

enum Status

Describes the current status of a command.

Enumerator
Executing 

The command is being executed.

Completed 

The command has completed. The command session has ended.

Canceled 

The command has been canceled. The command session has ended.

InvalidStatus 

The status is unknown or invalid.

Definition at line 116 of file adhoc.h.

Constructor & Destructor Documentation

◆ Command() [1/5]

Command ( const std::string &  node,
const std::string &  sessionid,
Action  action,
AdhocPlugin plugin = 0 
)

Creates a Command object that can be used to perform the provided Action. This constructor is used best to continue execution of a multi stage command (for which the session ID must be known).

Parameters
nodeThe node (command) to perform the action on.
sessionidThe session ID of an already running adhoc command session.
actionThe action to perform.
pluginAn optional AdhocPlugin (e.g. DataForm) to include in the request. Will be deleted in Command's destructor.

Definition at line 97 of file adhoc.cpp.

◆ Command() [2/5]

Command ( const std::string &  node,
const std::string &  sessionid,
Status  status,
AdhocPlugin plugin = 0 
)

Creates a Command object that can be used to perform the provided Action. This constructor is used best to reply to an execute request.

Parameters
nodeThe node (command) to perform the action on.
sessionidThe (possibly newly created) session ID of the adhoc command session.
statusThe execution status.
pluginAn optional AdhocPlugin (e.g. DataForm) to include in the reply. Will be deleted in Command's destructor.

Definition at line 90 of file adhoc.cpp.

◆ Command() [3/5]

Command ( const std::string &  node,
const std::string &  sessionid,
Status  status,
Action  executeAction,
int  allowedActions = Complete,
AdhocPlugin plugin = 0 
)

Creates a Command object that can be used to perform the provided Action. This constructor is used best to reply to a multi stage command that is not yet completed (for which the session ID must be known).

Parameters
nodeThe node (command) to perform the action on.
sessionidThe (possibly newly created) session ID of the adhoc command session.
statusThe execution status.
executeActionThe action to execute.
allowedActionsAllowed reply actions.
pluginAn optional AdhocPlugin (e.g. DataForm) to include in the reply. Will be deleted in Command's destructor.

Definition at line 105 of file adhoc.cpp.

◆ Command() [4/5]

Command ( const std::string &  node,
Action  action,
AdhocPlugin plugin = 0 
)

Creates a Command object that can be used to perform the provided Action. This constructor is used best to execute the initial step of a command (single or multi stage).

Parameters
nodeThe node (command) to perform the action on.
actionThe action to perform.
pluginAn optional AdhocPlugin (e.g. DataForm) to include in the request. Will be deleted in Command's destructor.

Definition at line 83 of file adhoc.cpp.

◆ Command() [5/5]

Command ( const Tag tag = 0)

Creates a Command object from the given Tag.

Parameters
tagA <command> tag in the adhoc commands' namespace.

Definition at line 113 of file adhoc.cpp.

◆ ~Command()

~Command ( )
virtual

Virtual destructor.

Definition at line 156 of file adhoc.cpp.

Member Function Documentation

◆ action()

Action action ( ) const
inline

Returns the command's action.

Returns
The command's action.

Definition at line 287 of file adhoc.h.

◆ actions()

int actions ( ) const
inline

Returns the ORed actions that are allowed to be executed on the current stage.

Returns
An int containing the ORed actions.

Definition at line 294 of file adhoc.h.

◆ addNote()

void addNote ( const Note note)
inline

Use this function to add a note to the command.

Parameters
noteA pointer to a Note object. The Command will own the Note.

Definition at line 307 of file adhoc.h.

◆ clone()

virtual StanzaExtension* clone ( ) const
inlinevirtual

Returns an identical copy of the current StanzaExtension.

Returns
An identical copy of the current StanzaExtension.

Implements StanzaExtension.

Definition at line 335 of file adhoc.h.

◆ filterString()

const std::string & filterString ( ) const
virtual

Returns an XPath expression that describes a path to child elements of a stanza that an extension handles.

Returns
The extension's filter string.

Implements StanzaExtension.

Definition at line 162 of file adhoc.cpp.

◆ form()

GLOOX_DEPRECATED const AdhocPlugin* form ( ) const
inline

Returns the command's embedded AdhocPlugin (e.g. DataForm).

Returns
The command's embedded AdhocPlugin (e.g. DataForm). May be 0.
Note
This will be removed in 1.1. Use plugin() instead.

Definition at line 314 of file adhoc.h.

◆ newInstance()

virtual StanzaExtension* newInstance ( const Tag tag) const
inlinevirtual

Returns a new Instance of the derived type. Usually, for a derived class FooExtension, the implementation of this function looks like:

StanzaExtension* FooExtension::newInstance( const Tag* tag ) const
{
return new FooExtension( tag );
}
virtual Tag * tag() const
Definition: adhoc.cpp:168
Returns
The derived extension's new instance.

Implements StanzaExtension.

Definition at line 326 of file adhoc.h.

◆ node()

const std::string& node ( ) const
inline

Returns the node identifier (the command).

Returns
The node identifier.

Definition at line 268 of file adhoc.h.

◆ notes()

const NoteList& notes ( ) const
inline

Returns the list of notes associated with the command.

Returns
The list of notes.

Definition at line 300 of file adhoc.h.

◆ plugin()

const AdhocPlugin* plugin ( ) const
inline

Returns the command's embedded AdhocPlugin (e.g. DataForm).

Returns
The command's embedded AdhocPlugin (e.g. DataForm). May be 0.

Definition at line 320 of file adhoc.h.

◆ sessionID()

const std::string& sessionID ( ) const
inline

Returns the command's session ID, if any.

Returns
The command's session ID.

Definition at line 274 of file adhoc.h.

◆ status()

Status status ( ) const
inline

Returns the execution status for a command. Only valid for execution results.

Returns
The execution status for a command.

Definition at line 281 of file adhoc.h.

◆ tag()

Tag * tag ( ) const
virtual

Returns a Tag representation of the extension.

Returns
A Tag representation of the extension.

Implements StanzaExtension.

Definition at line 168 of file adhoc.cpp.


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