25 FlexibleOffline::Offline::Offline(
const Tag* )
31 FlexibleOffline::Offline::Offline(
int context,
const StringList& msgs )
32 : StanzaExtension(
ExtFlexOffline ), m_context( context ), m_msgs( msgs )
36 FlexibleOffline::Offline::~Offline()
40 const std::string& FlexibleOffline::Offline::filterString()
const
42 static const std::string filter =
"/iq/offline[@xmlns='" +
XMLNS_OFFLINE +
"']";
46 Tag* FlexibleOffline::Offline::tag()
const
48 Tag* t =
new Tag(
"offline" );
52 new Tag( t, m_context == FORequestMsgs ?
"fetch" :
"purge" );
55 const std::string action = m_context == FORequestMsgs ?
"view" :
"remove";
56 StringList::const_iterator it = m_msgs.begin();
57 for( ; it != m_msgs.end(); ++it )
59 Tag* i =
new Tag( t,
"item",
"action", action );
60 i->addAttribute(
"node", (*it) );
69 : m_parent( parent ), m_flexibleOfflineHandler( 0 )
96 void FlexibleOffline::messageOperation(
int context,
const StringList& msgs )
98 const std::string&
id = m_parent->
getID();
100 IQ iq( iqType,
JID(),
id );
101 iq.addExtension(
new Offline( context, msgs ) );
102 m_parent->
send( iq,
this, context );
107 m_flexibleOfflineHandler = foh;
112 m_flexibleOfflineHandler = 0;
117 if( !m_flexibleOfflineHandler )
129 num = atoi( info.
form()->
field(
"number_of_messages" )->
value().c_str() );
138 if( context == FORequestHeaders && m_flexibleOfflineHandler )
151 if( !m_flexibleOfflineHandler )
virtual void handleFlexibleOfflineSupport(bool support)=0
virtual ~FlexibleOffline()
An abstraction of a Disco query element (from Service Discovery, XEP-0030) in the disco::items namesp...
StanzaError error() const
const ItemList & items() const
void removeIDHandler(IqHandler *ih)
std::list< std::string > StringList
virtual void handleIqID(const IQ &iq, int context)
An abstraction of an IQ stanza.
void getDiscoItems(const JID &to, const std::string &node, DiscoHandler *dh, int context, const std::string &tid=EmptyString)
FlexibleOffline(ClientBase *parent)
void registerStanzaExtension(StanzaExtension *ext)
A stanza error abstraction implemented as a StanzaExtension.
virtual void handleFlexibleOfflineResult(FlexibleOfflineResult foResult)=0
virtual void handleFlexibleOfflineMsgNum(int num)=0
virtual void handleFlexibleOfflineMessageHeaders(const Disco::ItemList &headers)=0
virtual void handleDiscoError(const JID &from, const Error *error, int context)
The namespace for the gloox library.
virtual Disco * disco() const
Implementation of this virtual interface allows for retrieval of offline messages following XEP-0030...
An abstraction of a Disco Info element (from Service Discovery, XEP-0030) as a StanzaExtension.
const DataForm * form() const
void removeFlexibleOfflineHandler()
void getDiscoInfo(const JID &to, const std::string &node, DiscoHandler *dh, int context, const std::string &tid=EmptyString)
const std::string getID()
const Error * error() const
virtual void handleDiscoItems(const JID &from, const Disco::Items &items, int context)
bool hasFeature(const std::string &feature) const
const std::string & server() const
void registerFlexibleOfflineHandler(FlexibleOfflineHandler *foh)
virtual void handleDiscoInfo(const JID &from, const Disco::Info &info, int context)
const std::string EmptyString
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
const std::string XMLNS_OFFLINE
const std::string & node() const