14 #include "connectioncompression.h"
15 #include "featurecompression.h"
16 #include "streambase.h"
18 #include <gloox/gloox.h>
19 #include <gloox/tag.h>
25 : m_state( ZlibCanceled )
31 static const std::string filter =
"/compress[@xmlns='" + gloox::XMLNS_COMPRESSION +
"']";
42 t =
new gloox::Tag(
"compression" );
43 t->setXmlns( gloox::XMLNS_STREAM_COMPRESS );
44 new gloox::Tag( t,
"method",
"zlib" );
46 m_state = ZlibOffered;
52 void FeatureCompression::handleTag( gloox::Tag* _tag )
54 if( !_tag || _tag->xmlns() != gloox::XMLNS_COMPRESSION )
57 const std::string& name = _tag->name();
59 if( _tag->findCData(
"/compress/method" ) ==
"zlib" )
61 gloox::Tag* c =
new gloox::Tag(
"compressed" );
62 c->setXmlns( gloox::XMLNS_COMPRESSION );
67 compression->connect();
70 m_state = ZlibEnabled;
72 else if( name ==
"failure" )
74 m_state = ZlibCanceled;
75 m_parent->
disconnect( gloox::ConnCompressionFailed );