summaryrefslogtreecommitdiff
path: root/plugins/Modernb/modern_skinned_profile.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-05-18 22:10:43 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-05-18 22:10:43 +0000
commit725f68b6808a8a30778f58223fac75386f082785 (patch)
treeccba410760749d45139e5e78fd5e08f416ade1a0 /plugins/Modernb/modern_skinned_profile.cpp
parentf920ef497f3299ae24fe783ce03bdd93b419f764 (diff)
plugins folders renaming
git-svn-id: http://svn.miranda-ng.org/main/trunk@61 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Modernb/modern_skinned_profile.cpp')
-rw-r--r--plugins/Modernb/modern_skinned_profile.cpp115
1 files changed, 115 insertions, 0 deletions
diff --git a/plugins/Modernb/modern_skinned_profile.cpp b/plugins/Modernb/modern_skinned_profile.cpp
new file mode 100644
index 0000000000..d31fe7d18f
--- /dev/null
+++ b/plugins/Modernb/modern_skinned_profile.cpp
@@ -0,0 +1,115 @@
+
+
+#include "hdr/modern_commonheaders.h"
+
+#ifdef _DEBUG // REMOVE ME, as soon as ghazan will implement msvcprt.lib msvcrt.lib analogs to vc6tovc7.lib
+#include "hdr/modern_skinned_profile.h"
+
+
+//need to be linked in: atls.lib msvcprt.lib msvcrt.lib
+
+CSkinnedProfile CSkinnedProfile::_me;
+
+
+CSkinnedProfile::CSkinnedProfile()
+{
+ Init();
+}
+
+CSkinnedProfile::~CSkinnedProfile()
+{
+
+}
+
+HRESULT CSkinnedProfile::Init()
+{
+ CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
+ SkinnedProfile.clear();
+ return S_OK;
+}
+
+HRESULT CSkinnedProfile::Clear()
+{
+ CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
+ SkinnedProfile.clear();
+ return S_OK;
+}
+
+
+ValueVariant* CSkinnedProfile::_GetValue( const char * szSection, const char * szKey )
+{
+ KeyList_t::iterator k_it = SkinnedProfile.find( szSection );
+ if ( k_it == SkinnedProfile.end() )
+ return NULL; // Not skinned
+
+ ValueList_t::iterator v_it = k_it->second.find( szKey );
+ if ( v_it == k_it->second.end() )
+ return NULL; // Not skinned
+
+ return &( v_it->second );
+};
+
+BYTE CSkinnedProfile::SpiGetSkinByte( HANDLE hContact, const char * szSection, const char * szKey, const BYTE defValue )
+{
+ if ( hContact )
+ return ModernGetSettingByte( hContact, szSection, szKey, defValue ); //per-contact settings are not skinnablr at all
+
+ CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
+
+ ValueVariant* value = SkinProfile()->_GetValue( szSection, szKey );
+
+ if ( value == NULL ) // not skinned => return DB
+ return ModernGetSettingWord( hContact, szSection, szKey, defValue );
+
+ else if ( !value->IsEmpty() )
+ return value->GetByte();
+
+ return defValue; // skinned but empty => return default value
+}
+
+WORD CSkinnedProfile::SpiGetSkinWord( HANDLE hContact, const char * szSection, const char * szKey, const WORD defValue )
+{
+ if ( hContact )
+ return ModernGetSettingWord( hContact, szSection, szKey, defValue ); //per-contact settings are not skinnablr at all
+
+ CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
+
+ ValueVariant* value = SkinProfile()->_GetValue( szSection, szKey );
+
+ if ( value == NULL ) // not skinned => return DB
+ return ModernGetSettingWord( hContact, szSection, szKey, defValue );
+
+ else if ( !value->IsEmpty() )
+ return value->GetWord();
+
+ return defValue; // skinned but empty => return default value
+}
+
+DWORD CSkinnedProfile::SpiGetSkinDword( HANDLE hContact, const char * szSection, const char * szKey, const DWORD defValue )
+{
+ if ( hContact )
+ return ModernGetSettingDword( hContact, szSection, szKey, defValue ); //per-contact settings are not skinnablr at all
+
+ CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
+
+ ValueVariant* value = SkinProfile()->_GetValue( szSection, szKey );
+
+ if ( value == NULL ) // not skinned => return DB
+ return ModernGetSettingDword( hContact, szSection, szKey, defValue );
+
+ else if ( !value->IsEmpty() )
+ return value->GetDword();
+
+ return defValue; // skinned but empty => return default value
+}
+
+BOOL CSkinnedProfile::SpiCheckSkinned( HANDLE hContact, const char * szSection, const char * szKey )
+{
+ if ( hContact )
+ return FALSE;
+
+ CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
+
+ return ( SkinProfile()->_GetValue( szSection, szKey ) == NULL );
+}
+#endif // _DEBUG // REMOVE ME, as soon as ghazan will implement msvcprt.lib msvcrt.lib analogs to vc6tovc7.lib \ No newline at end of file