simanager.h

00001 /*
00002   Copyright (c) 2007 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
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       // re-implemented from IqHandler
00117       virtual bool handleIq( Stanza *stanza );
00118 
00119       // re-implemented from IqHandler
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__

Generated on Sat Nov 10 08:50:27 2007 for gloox by  doxygen 1.5.3-20071008