gloox  1.0.9
jinglesessionmanager.h
1 /*
2  Copyright (c) 2013 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 JINGLESESSIONMANAGER_H__
15 #define JINGLESESSIONMANAGER_H__
16 
17 #include "macros.h"
18 #include "iqhandler.h"
19 #include "jinglepluginfactory.h"
20 
21 #include <list>
22 
23 namespace gloox
24 {
25 
26  class ClientBase;
27 
28  namespace Jingle
29  {
30 
31  class Session;
32  class SessionHandler;
33 
59  class GLOOX_API SessionManager : public IqHandler
60  {
61  public:
69 
73  virtual ~SessionManager();
74 
79  void registerPlugin( Plugin* plugin );
80 
88  Session* createSession( const JID& callee, SessionHandler* handler );
89 
94  void discardSession( Session* session );
95 
96 
97  // reimplemented from IqHandler
98  virtual bool handleIq( const IQ& iq );
99 
100  // reimplemented from IqHandler
101  virtual void handleIqID( const IQ& /*iq*/, int /*context*/ ) {}
102 
103  private:
104  typedef std::list<Jingle::Session*> SessionList;
105 
106  SessionList m_sessions;
107  ClientBase* m_parent;
108  SessionHandler* m_handler;
109  PluginFactory m_factory;
110 
111  };
112 
113  }
114 
115 }
116 
117 #endif // JINGLESESSIONMANAGER_H__