gpgsigned.cpp

00001 /*
00002   Copyright (c) 2006-2008 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 "gpgsigned.h"
00015 #include "tag.h"
00016 
00017 namespace gloox
00018 {
00019 
00020   GPGSigned::GPGSigned( const std::string& signature )
00021     : StanzaExtension( ExtGPGSigned ),
00022       m_signature( signature ), m_valid( true )
00023   {
00024     if( m_signature.empty() )
00025       m_valid = false;
00026   }
00027 
00028   GPGSigned::GPGSigned( Tag *tag )
00029     : StanzaExtension( ExtGPGSigned ),
00030       m_valid( false )
00031   {
00032     if( tag && tag->name() == "x" && tag->hasAttribute( "xmlns", XMLNS_X_GPGSIGNED ) )
00033     {
00034       m_valid = true;
00035       m_signature = tag->cdata();
00036     }
00037   }
00038 
00039   GPGSigned::~GPGSigned()
00040   {
00041   }
00042 
00043   Tag* GPGSigned::tag() const
00044   {
00045     if( !m_valid )
00046       return 0;
00047 
00048     Tag *x = new Tag( "x", m_signature );
00049     x->addAttribute( "xmlns", XMLNS_X_GPGSIGNED );
00050 
00051     return x;
00052   }
00053 
00054 }

Generated on Sun Apr 27 11:08:13 2008 for gloox by  doxygen 1.5.5