Public Member Functions | Public Attributes | Protected Member Functions

Swift::GenericRequest< PAYLOAD_TYPE > Class Template Reference

GenericRequest is used for managing the sending of, and handling of replies to, iq stanzas that do not have their own Request types. More...

Inheritance diagram for Swift::GenericRequest< PAYLOAD_TYPE >:
Collaboration diagram for Swift::GenericRequest< PAYLOAD_TYPE >:

List of all members.

Public Member Functions

 GenericRequest (IQ::Type type, const JID &receiver, boost::shared_ptr< Payload > payload, IQRouter *router)
 Create a request suitable for client use.
 GenericRequest (IQ::Type type, const JID &sender, const JID &receiver, boost::shared_ptr< Payload > payload, IQRouter *router)
 Create a request suitable for component or server use.
virtual void handleResponse (boost::shared_ptr< Payload > payload, ErrorPayload::ref error)
 Internal method, do not use.
void send ()
const JIDgetReceiver () const

Public Attributes

boost::signal< void(boost::shared_ptr
< PAYLOAD_TYPE >
, ErrorPayload::ref)> 
onResponse
 Signal emitted when a reply to the iq has been received.

Protected Member Functions

boost::shared_ptr< PAYLOAD_TYPE > getPayloadGeneric () const
virtual void setPayload (boost::shared_ptr< Payload > payload)
boost::shared_ptr< PayloadgetPayload () const
virtual void handleResponse (boost::shared_ptr< Payload >, boost::shared_ptr< ErrorPayload >)=0

Detailed Description

template<typename PAYLOAD_TYPE>
class Swift::GenericRequest< PAYLOAD_TYPE >

GenericRequest is used for managing the sending of, and handling of replies to, iq stanzas that do not have their own Request types.

To create an iq stanza, call a constructor with the type of the iq that needs to be sent (either Set or Get), addressing information (clients should use the constructor that doesn't specify a sender), the payload that should be sent in the iq, and the IQRouter for the connection, obtained through the Client or CoreClient object.

Having created a GenericRequest, connect to the onResponse signal to be told when a response (either a result or an error) has been received by Swiften.

To send the iq, then call send() - onResponse will be called when a reply is received.

Definition at line 23 of file GenericRequest.h.


Constructor & Destructor Documentation

template<typename PAYLOAD_TYPE>
Swift::GenericRequest< PAYLOAD_TYPE >::GenericRequest ( IQ::Type  type,
const JID receiver,
boost::shared_ptr< Payload payload,
IQRouter router 
) [inline]

Create a request suitable for client use.

Parameters:
type Iq type - Get or Set.
receiver JID to send request to.
payload Payload to send in stanza.
router IQRouter instance for current connection.

Definition at line 32 of file GenericRequest.h.

template<typename PAYLOAD_TYPE>
Swift::GenericRequest< PAYLOAD_TYPE >::GenericRequest ( IQ::Type  type,
const JID sender,
const JID receiver,
boost::shared_ptr< Payload payload,
IQRouter router 
) [inline]

Create a request suitable for component or server use.

As a client, use the other constructor instead.

Parameters:
type Iq type - Get or Set.
sender JID to use in "from" of stanza.
receiver JID to send request to.
payload Payload to send in stanza.
router IQRouter instance for current connection.

Definition at line 48 of file GenericRequest.h.


Member Function Documentation

boost::shared_ptr<Payload> Swift::Request::getPayload (  )  const [inline, protected, inherited]
template<typename PAYLOAD_TYPE>
boost::shared_ptr<PAYLOAD_TYPE> Swift::GenericRequest< PAYLOAD_TYPE >::getPayloadGeneric (  )  const [inline, protected]

Definition at line 65 of file GenericRequest.h.

const JID& Swift::Request::getReceiver (  )  const [inline, inherited]

Definition at line 29 of file Request.h.

template<typename PAYLOAD_TYPE>
virtual void Swift::GenericRequest< PAYLOAD_TYPE >::handleResponse ( boost::shared_ptr< Payload payload,
ErrorPayload::ref  error 
) [inline, virtual]

Internal method, do not use.

Definition at line 60 of file GenericRequest.h.

virtual void Swift::Request::handleResponse ( boost::shared_ptr< Payload ,
boost::shared_ptr< ErrorPayload  
) [protected, pure virtual, inherited]
void Swift::Request::send (  )  [inherited]
virtual void Swift::Request::setPayload ( boost::shared_ptr< Payload payload  )  [inline, protected, virtual, inherited]

Definition at line 74 of file Request.h.


Member Data Documentation

template<typename PAYLOAD_TYPE>
boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> Swift::GenericRequest< PAYLOAD_TYPE >::onResponse

Signal emitted when a reply to the iq has been received.

Contains a payload if one was present, and an error if one was present.

Definition at line 73 of file GenericRequest.h.

Referenced by Swift::GenericRequest< InBandRegistrationPayload >::handleResponse().