Public Member Functions | Protected Member Functions

Swift::Responder< PAYLOAD_TYPE > Class Template Reference

A class for handling incoming IQ Get and Set requests of a specific payload type. More...

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

List of all members.

Public Member Functions

 Responder (IQRouter *router)
 ~Responder ()
void start ()
 Starts the responder.
void stop ()
 Stops the responder.

Protected Member Functions

virtual bool handleGetRequest (const JID &from, const JID &to, const std::string &id, boost::shared_ptr< PAYLOAD_TYPE > payload)=0
 Handle an incoming IQ-Get request containing a payload of class PAYLOAD_TYPE.
virtual bool handleSetRequest (const JID &from, const JID &to, const std::string &id, boost::shared_ptr< PAYLOAD_TYPE > payload)=0
 Handle an incoming IQ-Set request containing a payload of class PAYLOAD_TYPE.
void sendResponse (const JID &to, const std::string &id, boost::shared_ptr< PAYLOAD_TYPE > payload)
 Convenience function for sending an IQ response.
void sendResponse (const JID &to, const JID &from, const std::string &id, boost::shared_ptr< PAYLOAD_TYPE > payload)
 Convenience function for sending an IQ response, with a specific from address.
void sendError (const JID &to, const std::string &id, ErrorPayload::Condition condition, ErrorPayload::Type type, Payload::ref payload=Payload::ref())
 Convenience function for responding with an error.
void sendError (const JID &to, const JID &from, const std::string &id, ErrorPayload::Condition condition, ErrorPayload::Type type, Payload::ref payload=Payload::ref())
 Convenience function for responding with an error from a specific from address.
IQRoutergetIQRouter () const

Detailed Description

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

A class for handling incoming IQ Get and Set requests of a specific payload type.

Concrete subclasses of this class need to implement handleGetRequest() and handleSetRequest() to implement the behavior of the responder.

Template Parameters:
PAYLOAD_TYPE The type of payload this Responder handles. Only IQ requests containing this payload type will be passed to handleGetRequest() and handleSetRequest()

Definition at line 24 of file Responder.h.


Constructor & Destructor Documentation

template<typename PAYLOAD_TYPE>
Swift::Responder< PAYLOAD_TYPE >::Responder ( IQRouter router  )  [inline]

Definition at line 26 of file Responder.h.

template<typename PAYLOAD_TYPE>
Swift::Responder< PAYLOAD_TYPE >::~Responder (  )  [inline]

Definition at line 29 of file Responder.h.


Member Function Documentation

template<typename PAYLOAD_TYPE>
IQRouter* Swift::Responder< PAYLOAD_TYPE >::getIQRouter (  )  const [inline, protected]

Definition at line 97 of file Responder.h.

template<typename PAYLOAD_TYPE>
virtual bool Swift::Responder< PAYLOAD_TYPE >::handleGetRequest ( const JID from,
const JID to,
const std::string &  id,
boost::shared_ptr< PAYLOAD_TYPE >  payload 
) [protected, pure virtual]

Handle an incoming IQ-Get request containing a payload of class PAYLOAD_TYPE.

This method is implemented in the concrete subclasses.

template<typename PAYLOAD_TYPE>
virtual bool Swift::Responder< PAYLOAD_TYPE >::handleSetRequest ( const JID from,
const JID to,
const std::string &  id,
boost::shared_ptr< PAYLOAD_TYPE >  payload 
) [protected, pure virtual]

Handle an incoming IQ-Set request containing a payload of class PAYLOAD_TYPE.

This method is implemented in the concrete subclasses.

template<typename PAYLOAD_TYPE>
void Swift::Responder< PAYLOAD_TYPE >::sendError ( const JID to,
const JID from,
const std::string &  id,
ErrorPayload::Condition  condition,
ErrorPayload::Type  type,
Payload::ref  payload = Payload::ref() 
) [inline, protected]

Convenience function for responding with an error from a specific from address.

Definition at line 93 of file Responder.h.

template<typename PAYLOAD_TYPE>
void Swift::Responder< PAYLOAD_TYPE >::sendError ( const JID to,
const std::string &  id,
ErrorPayload::Condition  condition,
ErrorPayload::Type  type,
Payload::ref  payload = Payload::ref() 
) [inline, protected]

Convenience function for responding with an error.

Definition at line 86 of file Responder.h.

template<typename PAYLOAD_TYPE>
void Swift::Responder< PAYLOAD_TYPE >::sendResponse ( const JID to,
const std::string &  id,
boost::shared_ptr< PAYLOAD_TYPE >  payload 
) [inline, protected]

Convenience function for sending an IQ response.

Definition at line 72 of file Responder.h.

template<typename PAYLOAD_TYPE>
void Swift::Responder< PAYLOAD_TYPE >::sendResponse ( const JID to,
const JID from,
const std::string &  id,
boost::shared_ptr< PAYLOAD_TYPE >  payload 
) [inline, protected]

Convenience function for sending an IQ response, with a specific from address.

Definition at line 79 of file Responder.h.

template<typename PAYLOAD_TYPE>
void Swift::Responder< PAYLOAD_TYPE >::start (  )  [inline]

Starts the responder.

After the responder has started, it will start receiving and responding to requests.

See also:
stop()

Definition at line 39 of file Responder.h.

template<typename PAYLOAD_TYPE>
void Swift::Responder< PAYLOAD_TYPE >::stop (  )  [inline]

Stops the responder.

When the responder is stopped, it will no longer receive incoming requests.

See also:
start()

Definition at line 50 of file Responder.h.