gloox  1.0
subscription.h
1 /*
2  Copyright (c) 2007-2009 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 #ifndef SUBSCRIPTION_H__
14 #define SUBSCRIPTION_H__
15 
16 #include "stanza.h"
17 
18 #include <string>
19 
20 namespace gloox
21 {
22 
23  class JID;
24 
31  class GLOOX_API Subscription : public Stanza
32  {
33 
34  public:
35 
36  friend class ClientBase;
37 
41  enum S10nType
42  {
43  Subscribe,
47  Invalid
48  };
49 
57  Subscription( S10nType type, const JID& to, const std::string& status = EmptyString,
58  const std::string& xmllang = EmptyString );
62  virtual ~Subscription();
63 
69  S10nType subtype() const { return m_subtype; }
70 
80  const std::string status( const std::string& lang = "default" ) const
81  {
82  return findLang( m_stati, m_status, lang );
83  }
84 
85  // reimplemented from Stanza
86  virtual Tag* tag() const;
87 
88  private:
89 #ifdef SUBSCRIPTION_TEST
90  public:
91 #endif
92 
96  Subscription( Tag* tag );
97 
98  S10nType m_subtype;
99  StringMap* m_stati;
100  std::string m_status;
101 
102  };
103 
104 }
105 
106 #endif // SUBSCRIPTION_H__