glooxd  0.3-svn
featureresourcebind.h
1 /*
2  Copyright (c) 2009 by Jakob Schroeter <js@camaya.net>
3  This file is part of the glooxd library. http://camaya.net/glooxd
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 FEATURERESOURCEBIND_H__
15 #define FEATURERESOURCEBIND_H__
16 
17 #include "glooxd.h"
18 #include "streamfeature.h"
19 
20 #include <gloox/jid.h>
21 
22 namespace glooxd
23 {
24 
25  class SM;
26 
33  class GLOOXD_API FeatureResourceBind : public StreamFeature
34  {
35  public:
39  FeatureResourceBind( SM& sm );
40 
44  virtual ~FeatureResourceBind() {}
45 
46  // reimplemented from StreamFeature
47  virtual const std::string& filterString() const;
48 
49  // reimplemented from StreamFeature
50  virtual gloox::Tag* tag( int state, const std::string& domain );
51 
52  // reimplemented from StreamFeature
53  virtual StreamFeature* newInstance() const
54  {
55  return new FeatureResourceBind( m_sm );
56  }
57 
58  // reimplemented from StreamFeature
59  virtual void handleTag( gloox::Tag* tag );
60 
61  private:
62  enum State
63  {
64  BindOffered,
65  BindRequested,
66  BindDone,
67  BindCanceled
68  };
69 
70  SM& m_sm;
71  State m_state;
72 
73  };
74 
75 }
76 
77 #endif // FEATURERESOURCEBIND_H__