00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
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
00116 virtual bool handleIq( const IQ& iq );
00117
00118
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__