xhtmlim.cpp
/*
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.
*/
#include "xhtmlim.h"
#include "tag.h"
namespace gloox
{
XHtmlIM::XHtmlIM( const Tag* xhtml )
: StanzaExtension( ExtXHtmlIM ), m_xhtml( 0 )
{
if( !xhtml|| xhtml->name() != "html" || xhtml->xmlns() != XMLNS_XHTML_IM )
return;
if( !xhtml->hasChild( "body", XMLNS, "http://www.w3.org/1999/xhtml" ) )
return;
m_xhtml = xhtml->clone();
}
XHtmlIM::~XHtmlIM()
{
delete m_xhtml;
}
const std::string& XHtmlIM::filterString() const
{
static const std::string filter = "/message/html[@xmlns='" + XMLNS_XHTML_IM + "']";
return filter;
}
Tag* XHtmlIM::tag() const
{
return m_xhtml->clone();
}
StanzaExtension* XHtmlIM::clone() const
{
XHtmlIM* x = new XHtmlIM();
x->m_xhtml = m_xhtml ? m_xhtml->clone() : 0;
return x;
}
}
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::Tag::clone
Tag * clone() const
Definition tag.cpp:670
gloox::XHtmlIM::xhtml
const Tag * xhtml() const
Definition xhtmlim.h:54
gloox::XHtmlIM::~XHtmlIM
virtual ~XHtmlIM()
Definition xhtmlim.cpp:33
gloox::XHtmlIM::clone
virtual StanzaExtension * clone() const
Definition xhtmlim.cpp:49
gloox::XHtmlIM::filterString
virtual const std::string & filterString() const
Definition xhtmlim.cpp:38
gloox::XHtmlIM::XHtmlIM
XHtmlIM(const Tag *xhtml=0)
Definition xhtmlim.cpp:21
gloox::XHtmlIM::tag
virtual Tag * tag() const
Definition xhtmlim.cpp:44
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::XMLNS
const std::string XMLNS
Definition gloox.cpp:122
gloox::ExtXHtmlIM
@ ExtXHtmlIM
Definition stanzaextension.h:58
gloox::XMLNS_XHTML_IM
const std::string XMLNS_XHTML_IM
Definition gloox.cpp:36