2
* Copyright (c) 2013 by Jakob Schroeter <js@camaya.net>
3
* This file is part of the gloox library. http://camaya.net/gloox
5
* This software is distributed under a license. The full license
6
* agreement can be found in the file LICENSE in this distribution.
7
* This software may not be copied, modified, sold or distributed
8
* other than expressed in the named license agreement.
10
* This software is distributed without any warranty.
21
/* chat state type values */
22
static const char* typeValues [] = {
30
Carbons::Carbons( Carbons::Type type )
31
: StanzaExtension( ExtCarbons ), m_forward( 0 ), m_type( type )
35
Carbons::Carbons( const Tag* tag )
36
: StanzaExtension( ExtCarbons ), m_forward( 0 ), m_type( Invalid )
41
const std::string& name = tag->name();
42
m_type = (Type)util::lookup( name, typeValues );
49
Tag* f = tag->findChild( "forwarded", XMLNS, XMLNS_STANZA_FORWARDING );
51
m_forward = new Forward( f );
64
const std::string& Carbons::filterString() const
66
static const std::string filter = "/message/*[@xmlns='" + XMLNS_MESSAGE_CARBONS + "']";
70
Stanza* Carbons::embeddedStanza() const
72
if( !m_forward || m_type == Invalid )
75
return m_forward->embeddedStanza();
78
Tag* Carbons::embeddedTag() const
80
if( !m_forward || m_type == Invalid )
83
return m_forward->embeddedTag();
86
Tag* Carbons::tag() const
88
if( m_type == Invalid )
91
Tag* t = new Tag( util::lookup( m_type, typeValues ), XMLNS, XMLNS_MESSAGE_CARBONS );
92
if( m_forward && ( m_type == Received || m_type == Sent ) )
93
t->addChild( m_forward->tag() );
98
StanzaExtension* Carbons::clone() const