00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "gpgencrypted.h"
00015 #include "tag.h"
00016
00017 namespace gloox
00018 {
00019
00020 GPGEncrypted::GPGEncrypted( const std::string& encrypted )
00021 : StanzaExtension( ExtGPGEncrypted ),
00022 m_encrypted( encrypted ), m_valid( true )
00023 {
00024 if( m_encrypted.empty() )
00025 m_valid = false;
00026 }
00027
00028 GPGEncrypted::GPGEncrypted( const Tag* tag )
00029 : StanzaExtension( ExtGPGEncrypted ),
00030 m_valid( false )
00031 {
00032 if( tag && tag->name() == "x" && tag->hasAttribute( XMLNS, XMLNS_X_GPGENCRYPTED ) )
00033 {
00034 m_valid = true;
00035 m_encrypted = tag->cdata();
00036 }
00037 }
00038
00039 GPGEncrypted::~GPGEncrypted()
00040 {
00041 }
00042
00043 const std::string& GPGEncrypted::filterString() const
00044 {
00045 static const std::string filter = "/message/x[@xmlns='" + XMLNS_X_GPGENCRYPTED + "']";
00046 return filter;
00047 }
00048
00049 Tag* GPGEncrypted::tag() const
00050 {
00051 if( !m_valid )
00052 return 0;
00053
00054 Tag* x = new Tag( "x", m_encrypted );
00055 x->addAttribute( XMLNS, XMLNS_X_GPGENCRYPTED );
00056
00057 return x;
00058 }
00059
00060 }