subscription.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 SUBSCRIPTION_H__
#define SUBSCRIPTION_H__
#include "stanza.h"
#include <string>
namespace gloox
{
class JID;
class GLOOX_API Subscription : public Stanza
{
public:
friend class ClientBase;
enum S10nType
{
Subscribe,
Subscribed,
Unsubscribe,
Unsubscribed,
Invalid
};
Subscription( S10nType type, const JID& to, const std::string& status = EmptyString,
const std::string& xmllang = EmptyString );
virtual ~Subscription();
S10nType subtype() const { return m_subtype; }
const std::string status( const std::string& lang = "default" ) const
{
return findLang( m_stati, m_status, lang );
}
// reimplemented from Stanza
virtual Tag* tag() const;
private:
#ifdef SUBSCRIPTION_TEST
public:
#endif
Subscription( Tag* tag );
S10nType m_subtype;
StringMap* m_stati;
std::string m_status;
};
}
#endif // SUBSCRIPTION_H__
gloox::JID
An abstraction of a JID.
Definition jid.h:31
gloox::Stanza::Stanza
Stanza(Tag *tag)
Definition stanza.cpp:31
gloox::Subscription
An abstraction of a subscription stanza.
Definition subscription.h:32
gloox::Subscription::S10nType
S10nType
Definition subscription.h:42
gloox::Subscription::Subscribed
@ Subscribed
Definition subscription.h:44
gloox::Subscription::Unsubscribed
@ Unsubscribed
Definition subscription.h:46
gloox::Subscription::Unsubscribe
@ Unsubscribe
Definition subscription.h:45
gloox::Subscription::Invalid
@ Invalid
Definition subscription.h:47
gloox::Subscription::Subscribe
@ Subscribe
Definition subscription.h:43
gloox::Subscription::subtype
S10nType subtype() const
Definition subscription.h:69
gloox::Subscription::status
const std::string status(const std::string &lang="default") const
Definition subscription.h:80
gloox::Subscription::Subscription
Subscription(S10nType type, const JID &to, const std::string &status=EmptyString, const std::string &xmllang=EmptyString)
Definition subscription.cpp:43
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::StringMap
std::map< std::string, std::string > StringMap
Definition gloox.h:1261