gloox  1.0.1
delayeddelivery.h
1 /*
2  Copyright (c) 2006-2012 by Jakob Schroeter <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 DELAYEDDELIVERY_H__
15 #define DELAYEDDELIVERY_H__
16 
17 #include "gloox.h"
18 #include "jid.h"
19 #include "stanzaextension.h"
20 
21 #include <string>
22 
23 namespace gloox
24 {
25 
26  class Tag;
27 
38  class GLOOX_API DelayedDelivery : public StanzaExtension
39  {
40 
41  public:
48  DelayedDelivery( const JID& from, const std::string stamp,
49  const std::string& reason = "" );
50 
55  DelayedDelivery( const Tag* tag = 0 );
56 
60  virtual ~DelayedDelivery();
61 
68  const std::string& stamp() const { return m_stamp; }
69 
74  void setStamp( const std::string& stamp ) { m_stamp = stamp; }
75 
83  const JID& from() const { return m_from; }
84 
89  void setFrom( const JID& from ) { m_from = from; }
90 
95  const std::string& reason() const { return m_reason; }
96 
101  void setReason( const std::string& reason ) { m_reason = reason; }
102 
103  // reimplemented from StanzaExtension
104  virtual const std::string& filterString() const;
105 
106  // reimplemented from StanzaExtension
107  virtual StanzaExtension* newInstance( const Tag* tag ) const
108  {
109  return new DelayedDelivery( tag );
110  }
111 
112  // reimplemented from StanzaExtension
113  virtual Tag* tag() const;
114 
115  // reimplemented from StanzaExtension
116  virtual StanzaExtension* clone() const
117  {
118  return new DelayedDelivery( *this );
119  }
120 
121  private:
122  JID m_from;
123  std::string m_stamp;
124  std::string m_reason;
125  bool m_valid;
126  };
127 
128 }
129 
130 #endif // DELAYEDDELIVERY_H__