summaryrefslogtreecommitdiffstats
blob: ea80bf5bd85cb4f47f2424898dc3fdfd047cb17a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef SWIFTEN_IQRouter_H
#define SWIFTEN_IQRouter_H

#include <boost/shared_ptr.hpp>
#include <vector>

#include "Swiften/Base/String.h"
#include "Swiften/Elements/IQ.h"

namespace Swift {
	class IQChannel;
	class IQHandler;

	class IQRouter {
		public:
			IQRouter(IQChannel* channel);

			void addHandler(IQHandler* handler);
			void addHandler(boost::shared_ptr<IQHandler> handler);
			void removeHandler(IQHandler* handler);
			void removeHandler(boost::shared_ptr<IQHandler> handler);

			void sendIQ(boost::shared_ptr<IQ> iq);
			String getNewIQID();

		private:
			void handleIQ(boost::shared_ptr<IQ> iq);

		private:
			IQChannel* channel_;
			std::vector< boost::shared_ptr<IQHandler> > handlers_;
	};
}

#endif