Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

privacymanager.h

00001 /*
00002   Copyright (c) 2005-2008 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 PRIVACYMANAGER_H__
00015 #define PRIVACYMANAGER_H__
00016 
00017 #include "iqhandler.h"
00018 #include "privacylisthandler.h"
00019 
00020 #include <string>
00021 
00022 namespace gloox
00023 {
00024 
00025   class ClientBase;
00026 
00033   class GLOOX_API PrivacyManager : public IqHandler
00034   {
00035     public:
00040       PrivacyManager( ClientBase* parent );
00041 
00045       virtual ~PrivacyManager();
00046 
00053       std::string store( const std::string& name, const PrivacyListHandler::PrivacyList& list );
00054 
00058       std::string requestListNames()
00059         { return operation( PLRequestNames, EmptyString ); }
00060 
00065       std::string requestList( const std::string& name )
00066         { return operation( PLRequestList, name ); }
00067 
00072       std::string removeList( const std::string& name )
00073         { return operation( PLRemove, name ); }
00074 
00079       std::string setDefault( const std::string& name )
00080         { return operation( PLDefault, name ); }
00081 
00085       std::string unsetDefault()
00086         { return operation( PLUnsetDefault, EmptyString ); }
00087 
00092       std::string setActive( const std::string& name )
00093         { return operation( PLActivate, name ); }
00094 
00098       std::string unsetActive()
00099         { return operation( PLUnsetActivate, EmptyString ); }
00100 
00106       void registerPrivacyListHandler( PrivacyListHandler* plh )
00107         { m_privacyListHandler = plh; }
00108 
00112       void removePrivacyListHandler()
00113         { m_privacyListHandler = 0; }
00114 
00115       // reimplemented from IqHandler.
00116       virtual bool handleIq( const IQ& iq );
00117 
00118       // reimplemented from IqHandler.
00119       virtual void handleIqID( const IQ& iq, int context );
00120 
00121     private:
00122       enum IdType
00123       {
00124         PLRequestNames,
00125         PLRequestList,
00126         PLActivate,
00127         PLDefault,
00128         PLUnsetActivate,
00129         PLUnsetDefault,
00130         PLRemove,
00131         PLStore
00132       };
00133 
00134       std::string operation( int context, const std::string& name );
00135 
00136       ClientBase* m_parent;
00137       PrivacyListHandler* m_privacyListHandler;
00138   };
00139 
00140 }
00141 
00142 #endif // PRIVACYMANAGER_H__

Generated on Mon Jun 23 10:50:19 2008 for gloox by  doxygen 1.4.1