receipt.h
/*
Copyright (c) 2007-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef RECEIPT_H__
#define RECEIPT_H__
#include "gloox.h"
#include "stanzaextension.h"
#include <string>
namespace gloox
{
class Tag;
class GLOOX_API Receipt : public StanzaExtension
{
public:
enum ReceiptType
{
Request,
Received,
Invalid
};
Receipt( const Tag* tag );
Receipt( ReceiptType rcpt, const std::string& id = EmptyString )
: StanzaExtension( ExtReceipt ), m_rcpt( rcpt ), m_id( id )
{}
virtual ~Receipt() {}
ReceiptType rcpt() const { return m_rcpt; }
std::string id() const { return m_id; }
// reimplemented from StanzaExtension
virtual const std::string& filterString() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* newInstance( const Tag* tag ) const
{
return new Receipt( tag );
}
// reimplemented from StanzaExtension
Tag* tag() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* clone() const
{
return new Receipt( *this );
}
private:
ReceiptType m_rcpt;
std::string m_id;
};
}
#endif // RECEIPT_H__
gloox::Receipt
An implementation of Message Receipts (XEP-0184) as a StanzaExtension.
Definition receipt.h:33
gloox::Receipt::ReceiptType
ReceiptType
Definition receipt.h:39
gloox::Receipt::Received
@ Received
Definition receipt.h:41
gloox::Receipt::Invalid
@ Invalid
Definition receipt.h:42
gloox::Receipt::Request
@ Request
Definition receipt.h:40
gloox::Receipt::Receipt
Receipt(ReceiptType rcpt, const std::string &id=EmptyString)
Definition receipt.h:56
gloox::Receipt::clone
virtual StanzaExtension * clone() const
Definition receipt.h:90
gloox::Receipt::id
std::string id() const
Definition receipt.h:75
gloox::Receipt::~Receipt
virtual ~Receipt()
Definition receipt.h:63
gloox::Receipt::newInstance
virtual StanzaExtension * newInstance(const Tag *tag) const
Definition receipt.h:81
gloox::Receipt::Receipt
Receipt(const Tag *tag)
Definition receipt.cpp:31
gloox::Receipt::rcpt
ReceiptType rcpt() const
Definition receipt.h:69
gloox::Receipt::tag
Tag * tag() const
Definition receipt.cpp:49
gloox::StanzaExtension::StanzaExtension
StanzaExtension(int type)
Definition stanzaextension.h:211
gloox::Tag
This is an abstraction of an XML element.
Definition tag.h:47
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::EmptyString
const std::string EmptyString
Definition gloox.cpp:124
gloox::ExtReceipt
@ ExtReceipt
Definition stanzaextension.h:41