summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_settings.cpp
blob: 32226055772faf9b6219f5adf92a758d7aaedd85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "skype_proto.h"

TCHAR* CSkypeProto::GetSettingString(const char *szSetting, TCHAR* defVal)
{
	return this->GetSettingString(NULL, szSetting, defVal);
}

TCHAR* CSkypeProto::GetSettingString(HANDLE hContact, const char *szSetting, TCHAR* defVal)
{
	TCHAR* result = DBGetStringW(hContact, this->m_szModuleName, szSetting);
	return result != NULL ? result : defVal;
}

TCHAR* CSkypeProto::GetDecodeSettingString(const char *szSetting, TCHAR* defVal)
{
	return this->GetSettingString(NULL, szSetting, defVal);
}

TCHAR* CSkypeProto::GetDecodeSettingString(HANDLE hContact, const char *szSetting, TCHAR* defVal)
{
	DBVARIANT dbv;
	TCHAR* result = NULL;
	if ( !DBGetContactSettingWString(0, this->m_szModuleName, szSetting, &dbv))
	{
		CallService(
			MS_DB_CRYPT_DECODESTRING,
			wcslen(dbv.ptszVal) + 1,
			reinterpret_cast<LPARAM>(dbv.ptszVal));
		result = mir_wstrdup(dbv.pwszVal);
		DBFreeVariant(&dbv);
	}
	return result;
}