00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef SIMANAGER_H__
00015 #define SIMANAGER_H__
00016
00017 #include "iqhandler.h"
00018
00019 namespace gloox
00020 {
00021
00022 class ClientBase;
00023 class SIProfileHandler;
00024 class SIHandler;
00025
00034 class GLOOX_API SIManager : public IqHandler
00035 {
00036
00037 public:
00041 enum SIError
00042 {
00043 NoValidStreams,
00044 BadProfile,
00045 RequestRejected
00046 };
00047
00053 SIManager( ClientBase* parent, bool advertise = true );
00054
00058 virtual ~SIManager();
00059
00074 const std::string requestSI( SIHandler* sih, const JID& to, const std::string& profile, Tag* child1,
00075 Tag* child2 = 0, const std::string& mimetype = "binary/octet-stream" );
00076
00088 void acceptSI( const JID& to, const std::string& id, Tag* child1, Tag* child2 = 0 );
00089
00098 void declineSI( const JID& to, const std::string& id, SIError reason, const std::string& text = "" );
00099
00108 void registerProfile( const std::string& profile, SIProfileHandler* sih );
00109
00114 void removeProfile( const std::string& profile );
00115
00116
00117 virtual bool handleIq( Stanza *stanza );
00118
00119
00120 virtual bool handleIqID( Stanza *stanza, int context );
00121
00122 private:
00123 enum TrackContext
00124 {
00125 OfferSI
00126 };
00127
00128 struct TrackStruct
00129 {
00130 std::string sid;
00131 std::string profile;
00132 SIHandler* sih;
00133 };
00134 typedef std::map<std::string, TrackStruct> TrackMap;
00135 TrackMap m_track;
00136
00137 ClientBase* m_parent;
00138
00139 typedef std::map<std::string, SIProfileHandler*> HandlerMap;
00140 HandlerMap m_handlers;
00141
00142 bool m_advertise;
00143
00144 };
00145
00146 }
00147
00148 #endif // SIMANAGER_H__