flexoff.h
/*
Copyright (c) 2005-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 FLEXOFF_H__
#define FLEXOFF_H__
#include "clientbase.h"
#include "discohandler.h"
#include "flexoffhandler.h"
#include "iqhandler.h"
#include "stanzaextension.h"
namespace gloox
{
class GLOOX_API FlexibleOffline : public DiscoHandler, public IqHandler
{
public:
FlexibleOffline( ClientBase* parent );
virtual ~FlexibleOffline();
void checkSupport();
void getMsgCount();
void fetchHeaders();
void fetchMessages( const StringList& msgs )
{ messageOperation( FORequestMsgs, msgs ); }
void removeMessages( const StringList& msgs )
{ messageOperation( FORemoveMsgs, msgs ); }
void registerFlexibleOfflineHandler( FlexibleOfflineHandler* foh );
void removeFlexibleOfflineHandler();
// reimplemented from DiscoHandler
virtual void handleDiscoInfo( const JID& from, const Disco::Info& info, int context );
// reimplemented from DiscoHandler
virtual void handleDiscoItems( const JID& from, const Disco::Items& items, int context );
// reimplemented from DiscoHandler
virtual void handleDiscoError( const JID& from, const Error* error, int context );
// reimplemented from IqHandler.
virtual bool handleIq( const IQ& iq ) { (void)iq; return false; }
// reimplemented from IqHandler.
virtual void handleIqID( const IQ& iq, int context );
private:
#ifdef FLEXOFF_TEST
public:
#endif
class Offline : public StanzaExtension
{
public:
Offline( const Tag* tag = 0 );
Offline( int context, const StringList& msgs );
virtual ~Offline();
// reimplemented from StanzaExtension
virtual const std::string& filterString() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* newInstance( const Tag* tag ) const
{
return new Offline( tag );
}
// reimplemented from StanzaExtension
virtual Tag* tag() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* clone() const
{
return new Offline( *this );
}
private:
int m_context;
StringList m_msgs;
};
void messageOperation( int context, const StringList& msgs );
enum FOContext
{
FOCheckSupport,
FORequestNum,
FORequestHeaders,
FORequestMsgs,
FORemoveMsgs
};
ClientBase* m_parent;
FlexibleOfflineHandler* m_flexibleOfflineHandler;
};
}
#endif // FLEXOFF_H__
gloox::ClientBase
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
Definition clientbase.h:79
gloox::DiscoHandler
A virtual interface that enables objects to receive Service Discovery (XEP-0030) events.
Definition discohandler.h:35
gloox::Disco::Info
An abstraction of a Disco Info element (from Service Discovery, XEP-0030) as a StanzaExtension.
Definition disco.h:66
gloox::Disco::Items
An abstraction of a Disco query element (from Service Discovery, XEP-0030) in the disco::items namesp...
Definition disco.h:276
gloox::Error
A stanza error abstraction implemented as a StanzaExtension.
Definition error.h:35
gloox::FlexibleOfflineHandler
Implementation of this virtual interface allows for retrieval of offline messages following XEP-0030.
Definition flexoffhandler.h:44
gloox::FlexibleOffline::checkSupport
void checkSupport()
Definition flexoff.cpp:81
gloox::FlexibleOffline::handleIq
virtual bool handleIq(const IQ &iq)
Definition flexoff.h:108
gloox::FlexibleOffline::getMsgCount
void getMsgCount()
Definition flexoff.cpp:86
gloox::FlexibleOffline::FlexibleOffline
FlexibleOffline(ClientBase *parent)
Definition flexoff.cpp:68
gloox::FlexibleOffline::removeMessages
void removeMessages(const StringList &msgs)
Definition flexoff.h:83
gloox::FlexibleOffline::fetchMessages
void fetchMessages(const StringList &msgs)
Definition flexoff.h:74
gloox::FlexibleOffline::fetchHeaders
void fetchHeaders()
Definition flexoff.cpp:91
gloox::IQ
An abstraction of an IQ stanza.
Definition iq.h:34
gloox::IqHandler
A virtual interface which can be reimplemented to receive IQ stanzas.
Definition iqhandler.h:32
gloox::JID
An abstraction of a JID.
Definition jid.h:31
gloox::StanzaExtension
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
Definition stanzaextension.h:204
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::StringList
std::list< std::string > StringList
Definition gloox.h:1251