00001 /* 00002 Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net> 00003 This file is part of the gloox library. http://camaya.net/gloox 00004 00005 This software is distributed under a license. The full license 00006 agreement can be found in the file LICENSE in this distribution. 00007 This software may not be copied, modified, sold or distributed 00008 other than expressed in the named license agreement. 00009 00010 This software is distributed without any warranty. 00011 */ 00012 00013 00014 #include "xhtmlim.h" 00015 00016 #include "tag.h" 00017 00018 namespace gloox 00019 { 00020 00021 XHtmlIM::XHtmlIM( const Tag* xhtml ) 00022 : StanzaExtension( ExtXHtmlIM ), m_xhtml( 0 ) 00023 { 00024 if( !xhtml|| xhtml->name() != "html" || xhtml->xmlns() != XMLNS_XHTML_IM ) 00025 return; 00026 00027 if( !xhtml->hasChild( "body", XMLNS, "http://www.w3.org/1999/xhtml" ) ) 00028 return; 00029 00030 m_xhtml = xhtml->clone(); 00031 } 00032 00033 XHtmlIM::~XHtmlIM() 00034 { 00035 delete m_xhtml; 00036 } 00037 00038 const std::string& XHtmlIM::filterString() const 00039 { 00040 static const std::string filter = "/message/html[@xmlns='" + XMLNS_XHTML_IM + "']"; 00041 return filter; 00042 } 00043 00044 Tag* XHtmlIM::tag() const 00045 { 00046 return m_xhtml->clone(); 00047 } 00048 00049 StanzaExtension* XHtmlIM::clone() const 00050 { 00051 XHtmlIM* x = new XHtmlIM(); 00052 x->m_xhtml = m_xhtml ? m_xhtml->clone() : 0; 00053 return 0; 00054 } 00055 00056 }