14 #include "jinglefiletransfer.h"
28 static const char* typeValues [] = {
48 if( name ==
"description" )
50 const Tag* c =
tag->
findTag(
"description/offer|description/request" );
57 else if( name ==
"checksum" || name ==
"abort" || name ==
"received" )
62 m_type =
static_cast<Type>( util::lookup( name, typeValues ) );
65 void FileTransfer::parseFileList(
const TagList& files )
67 TagList::const_iterator it =
files.begin();
68 for( ; it !=
files.end(); ++it )
78 f.size = t ? atoi( t->
cdata().c_str() ) : -1;
91 m_files.push_back( f );
129 Tag* o =
new Tag( r, util::lookup( m_type, typeValues ) );
130 FileList::const_iterator it = m_files.begin();
131 for( ; it != m_files.end(); ++it )
133 Tag* f =
new Tag( o,
"file" );
134 new Tag( f,
"date", (*it).date );
135 new Tag( f,
"name", (*it).
name );
136 new Tag( f,
"desc", (*it).desc );
137 new Tag( f,
"size", util::long2string( (*it).size ) );
142 new Tag( f,
"range",
"offset", (*it).offset ? util::long2string( (*it).offset ) :
EmptyString );
151 FileList::const_iterator it = m_files.begin();
152 Tag* f =
new Tag( r,
"file" );
153 new Tag( f,
"date", (*it).date );
154 new Tag( f,
"name", (*it).
name );
155 new Tag( f,
"desc", (*it).desc );
156 new Tag( f,
"size", util::long2string( (*it).size ) );
161 new Tag( f,
"range" );
const FileList & files() const
std::list< File > FileList
FileTransfer(Type type, const FileList &files)
virtual Plugin * newInstance(const Tag *tag) const
virtual const StringList features() const
virtual const std::string & filterString() const
virtual Tag * tag() const
An abstraction of a Jingle plugin. This is part of Jingle (XEP-0166 et al.)
This is an abstraction of an XML element.
Tag * findChild(const std::string &name) const
bool setCData(const std::string &cdata)
const Tag * findTag(const std::string &expression) const
const std::string xmlns() const
bool addAttribute(Attribute *attr)
bool hasAttribute(const std::string &name, const std::string &value=EmptyString) const
const std::string cdata() const
const std::string & findAttribute(const std::string &name) const
TagList findChildren(const std::string &name, const std::string &xmlns=EmptyString) const
const std::string & name() const
The namespace for the gloox library.
std::list< Tag * > TagList
std::list< std::string > StringList
const std::string EmptyString
const std::string XMLNS_HASHES
const std::string XMLNS_JINGLE_FILE_TRANSFER