gloox  1.0.24
jinglefiletransfer.h
1 /*
2  Copyright (c) 2013-2019 by Jakob Schröter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
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.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 #ifndef JINGLEFILETRANSFER_H__
15 #define JINGLEFILETRANSFER_H__
16 
17 #include "jingleplugin.h"
18 #include "tag.h"
19 
20 #include <string>
21 #include <list>
22 
23 namespace gloox
24 {
25 
26  namespace Jingle
27  {
28 
37  class GLOOX_API FileTransfer : public Plugin
38  {
39  public:
40 
44  enum Type
45  {
51  Invalid
52  };
53 
57  struct File
58  {
59  std::string name;
60  std::string date;
61  std::string desc;
62  std::string hash;
63  std::string hash_algo;
64  long int size;
65  bool range;
66  long int offset;
67  };
68 
70  typedef std::list<File> FileList;
71 
78  FileTransfer( Type type, const FileList& files );
79 
84  FileTransfer( const Tag* tag = 0 );
85 
89  virtual ~FileTransfer() {}
90 
95  Type type() const { return m_type; }
96 
101  const FileList& files() const { return m_files; }
102 
103  // reimplemented from Plugin
104  virtual const StringList features() const;
105 
106  // reimplemented from Plugin
107  virtual const std::string& filterString() const;
108 
109  // reimplemented from Plugin
110  virtual Tag* tag() const;
111 
112  // reimplemented from Plugin
113  virtual Plugin* newInstance( const Tag* tag ) const;
114 
115  // reimplemented from Plugin
116  virtual Plugin* clone() const
117  {
118  return new FileTransfer( *this );
119  }
120 
121  private:
122 
123  void parseFileList( const TagList& files );
124 
125  Type m_type;
126  FileList m_files;
127 
128  };
129 
130  }
131 
132 }
133 
134 #endif // JINGLEFILETRANSFER_H__
gloox::TagList
std::list< Tag * > TagList
Definition: tag.h:26
gloox::Jingle::FileTransfer::Checksum
@ Checksum
Definition: jinglefiletransfer.h:48
gloox::Jingle::FileTransfer::File
Definition: jinglefiletransfer.h:58
gloox::Jingle::FileTransfer::File::desc
std::string desc
Definition: jinglefiletransfer.h:61
gloox::Jingle::FileTransfer::Request
@ Request
Definition: jinglefiletransfer.h:47
gloox::Jingle::FileTransfer::File::range
bool range
Definition: jinglefiletransfer.h:65
gloox::Jingle::Plugin
An abstraction of a Jingle plugin. This is part of Jingle (XEP-0166 et al.)
Definition: jingleplugin.h:68
gloox::Jingle::FileTransfer::File::offset
long int offset
Definition: jinglefiletransfer.h:66
gloox::Jingle::FileTransfer::Abort
@ Abort
Definition: jinglefiletransfer.h:49
gloox::StringList
std::list< std::string > StringList
Definition: gloox.h:1251
gloox::Jingle::FileTransfer
An abstraction of the signaling part of Jingle File Transfer (XEP-0234), implemented as a Jingle::Plu...
Definition: jinglefiletransfer.h:38
gloox::Jingle::FileTransfer::Received
@ Received
Definition: jinglefiletransfer.h:50
gloox::Jingle::FileTransfer::files
const FileList & files() const
Definition: jinglefiletransfer.h:101
gloox
The namespace for the gloox library.
Definition: adhoc.cpp:28
gloox::Jingle::FileTransfer::Type
Type
Definition: jinglefiletransfer.h:45
gloox::Tag
This is an abstraction of an XML element.
Definition: tag.h:47
gloox::Jingle::FileTransfer::File::date
std::string date
Definition: jinglefiletransfer.h:60
gloox::Jingle::FileTransfer::File::hash_algo
std::string hash_algo
Definition: jinglefiletransfer.h:63
gloox::Jingle::FileTransfer::File::name
std::string name
Definition: jinglefiletransfer.h:59
gloox::Jingle::FileTransfer::File::hash
std::string hash
Definition: jinglefiletransfer.h:62
gloox::Jingle::FileTransfer::type
Type type() const
Definition: jinglefiletransfer.h:95
gloox::Jingle::FileTransfer::Offer
@ Offer
Definition: jinglefiletransfer.h:46
gloox::Jingle::FileTransfer::clone
virtual Plugin * clone() const
Definition: jinglefiletransfer.h:116
gloox::Jingle::FileTransfer::File::size
long int size
Definition: jinglefiletransfer.h:64
gloox::Jingle::FileTransfer::~FileTransfer
virtual ~FileTransfer()
Definition: jinglefiletransfer.h:89
gloox::Jingle::FileTransfer::FileList
std::list< File > FileList
Definition: jinglefiletransfer.h:70