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" );
49 t->setXmlns( XMLNS_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 )
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
const std::string getID()
virtual Disco * disco() const
void removeIDHandler(IqHandler *ih)
void registerStanzaExtension(StanzaExtension *ext)
An abstraction of a Disco Info element (from Service Discovery, XEP-0030) as a StanzaExtension.
const DataForm * form() const
bool hasFeature(const std::string &feature) const
An abstraction of a Disco query element (from Service Discovery, XEP-0030) in the disco::items namesp...
const std::string & node() const
const ItemList & items() const
void getDiscoInfo(const JID &to, const std::string &node, DiscoHandler *dh, int context, const std::string &tid=EmptyString)
void getDiscoItems(const JID &to, const std::string &node, DiscoHandler *dh, int context, const std::string &tid=EmptyString)
A stanza error abstraction implemented as a StanzaExtension.
StanzaError error() const
Implementation of this virtual interface allows for retrieval of offline messages following XEP-0030.
virtual void handleFlexibleOfflineResult(FlexibleOfflineResult foResult)=0
virtual void handleFlexibleOfflineMsgNum(int num)=0
virtual void handleFlexibleOfflineSupport(bool support)=0
virtual void handleFlexibleOfflineMessageHeaders(const Disco::ItemList &headers)=0
void removeFlexibleOfflineHandler()
virtual void handleIqID(const IQ &iq, int context)
virtual void handleDiscoInfo(const JID &from, const Disco::Info &info, int context)
void registerFlexibleOfflineHandler(FlexibleOfflineHandler *foh)
virtual void handleDiscoError(const JID &from, const Error *error, int context)
virtual void handleDiscoItems(const JID &from, const Disco::Items &items, int context)
virtual ~FlexibleOffline()
An abstraction of an IQ stanza.
const std::string & server() const
const Error * error() const
The namespace for the gloox library.
std::list< std::string > StringList
const std::string EmptyString
@ StanzaErrorItemNotFound
const std::string XMLNS_OFFLINE