gloox  1.0.28
jinglefiletransfer.h
1 /*
2  Copyright (c) 2013-2023 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__
An abstraction of the signaling part of Jingle File Transfer (XEP-0234), implemented as a Jingle::Plu...
const FileList & files() const
virtual Plugin * clone() const
An abstraction of a Jingle plugin. This is part of Jingle (XEP-0166 et al.)
Definition: jingleplugin.h:68
This is an abstraction of an XML element.
Definition: tag.h:47
The namespace for the gloox library.
Definition: adhoc.cpp:28
std::list< Tag * > TagList
Definition: tag.h:26
std::list< std::string > StringList
Definition: gloox.h:1251