summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/UserInfoEx/src')
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flags.cpp24
-rw-r--r--plugins/UserInfoEx/src/classMAnnivDate.cpp85
-rw-r--r--plugins/UserInfoEx/src/classMTime.cpp6
-rw-r--r--plugins/UserInfoEx/src/classPsTree.cpp18
-rw-r--r--plugins/UserInfoEx/src/classPsTreeItem.cpp24
-rw-r--r--plugins/UserInfoEx/src/ctrl_annivedit.cpp10
-rw-r--r--plugins/UserInfoEx/src/ctrl_base.cpp12
-rw-r--r--plugins/UserInfoEx/src/ctrl_combo.cpp14
-rw-r--r--plugins/UserInfoEx/src/ctrl_contact.cpp24
-rw-r--r--plugins/UserInfoEx/src/ctrl_edit.cpp6
-rw-r--r--plugins/UserInfoEx/src/ctrl_tzcombo.cpp10
-rw-r--r--plugins/UserInfoEx/src/dlg_anniversarylist.cpp30
-rw-r--r--plugins/UserInfoEx/src/dlg_msgbox.cpp4
-rw-r--r--plugins/UserInfoEx/src/dlg_propsheet.cpp22
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp34
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp4
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp6
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp4
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp8
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp35
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp6
-rw-r--r--plugins/UserInfoEx/src/init.cpp2
-rw-r--r--plugins/UserInfoEx/src/mir_db.cpp311
-rw-r--r--plugins/UserInfoEx/src/mir_db.h60
-rw-r--r--plugins/UserInfoEx/src/mir_icolib.cpp2
-rw-r--r--plugins/UserInfoEx/src/mir_menuitems.cpp24
-rw-r--r--plugins/UserInfoEx/src/psp_anniversary.cpp2
-rw-r--r--plugins/UserInfoEx/src/psp_general.cpp10
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp111
-rw-r--r--plugins/UserInfoEx/src/psp_origin.cpp2
-rw-r--r--plugins/UserInfoEx/src/psp_profile.cpp18
-rw-r--r--plugins/UserInfoEx/src/svc_avatar.cpp62
-rw-r--r--plugins/UserInfoEx/src/svc_contactinfo.cpp32
-rw-r--r--plugins/UserInfoEx/src/svc_email.cpp14
-rw-r--r--plugins/UserInfoEx/src/svc_gender.cpp12
-rw-r--r--plugins/UserInfoEx/src/svc_homepage.cpp10
-rw-r--r--plugins/UserInfoEx/src/svc_phone.cpp10
-rw-r--r--plugins/UserInfoEx/src/svc_refreshci.cpp22
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp74
-rw-r--r--plugins/UserInfoEx/src/svc_timezone_old.cpp14
41 files changed, 369 insertions, 811 deletions
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
index 55c56e2bdc..13f4a007de 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
@@ -195,16 +195,16 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam)
WORD countryNumber;
char *pszProto = GetContactProto((HANDLE)wParam);
/* UserinfoEx */
- if (countryNumber = (int)DB::Setting::GetWord((HANDLE)wParam,USERINFO,SET_CONTACT_ORIGIN_COUNTRY,0))
+ if (countryNumber = db_get_w((HANDLE)wParam, USERINFO, SET_CONTACT_ORIGIN_COUNTRY, 0))
return (INT_PTR)countryNumber;
- else if (countryNumber = (int)DB::Setting::GetWord((HANDLE)wParam,USERINFO,SET_CONTACT_COUNTRY,0))
+ else if (countryNumber = db_get_w((HANDLE)wParam, USERINFO, SET_CONTACT_COUNTRY, 0))
return (INT_PTR)countryNumber;
- else if (countryNumber = (int)DB::Setting::GetWord((HANDLE)wParam,USERINFO,SET_CONTACT_COMPANY_COUNTRY,0))
+ else if (countryNumber = db_get_w((HANDLE)wParam, USERINFO, SET_CONTACT_COMPANY_COUNTRY, 0))
return (INT_PTR)countryNumber;
/* fallback proto settings */
- else if (countryNumber = (int)DB::Setting::GetWord((HANDLE)wParam,pszProto,"Country",0))
+ else if (countryNumber = db_get_w((HANDLE)wParam, pszProto, "Country", 0))
return (INT_PTR)countryNumber;
- else if (countryNumber = (int)DB::Setting::GetWord((HANDLE)wParam,pszProto,"CompanyCountry",0))
+ else if (countryNumber = db_get_w((HANDLE)wParam, pszProto, "CompanyCountry", 0))
return (INT_PTR)countryNumber;
/* fallback ip detect
else if (countryNumber==0xFFFF && db_get_b(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT)) {
@@ -228,14 +228,14 @@ static void CALLBACK SetExtraImage(LPARAM lParam)
static void CALLBACK RemoveExtraImages(LPARAM lParam)
{
/* enum all contacts */
- for (HANDLE hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact))
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
ExtraIcon_Clear(hExtraIconSvc, hContact);
}
// always call in context of main thread
void EnsureExtraImages()
{
- for (HANDLE hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact))
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
CallFunctionBuffered(SetExtraImage,(LPARAM)hContact,TRUE,EXTRAIMAGE_REFRESHDELAY);
}
@@ -292,7 +292,7 @@ void SvcFlagsEnableExtraIcons(BYTE bColumn, BYTE bUpdateDB)
{
gFlagsOpts.bShowExtraImgFlag = (bColumn!=((BYTE)-1));
if (bUpdateDB)
- DB::Setting::WriteByte(MODNAMEFLAGS,"ShowExtraImgFlag", bColumn!=(BYTE)-1);
+ db_set_b(NULL, MODNAMEFLAGS, "ShowExtraImgFlag", bColumn!=(BYTE)-1);
// Flags is on
if (gFlagsOpts.bShowExtraImgFlag) {
@@ -532,9 +532,9 @@ void SvcFlagsLoadModule()
//InitIpToCountry(); /* not implementet */
CreateServiceFunction(MS_FLAGS_DETECTCONTACTORIGINCOUNTRY,ServiceDetectContactOriginCountry);
//init settings
- gFlagsOpts.bShowExtraImgFlag = DB::Setting::GetByte(MODNAMEFLAGS,"ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT);
- gFlagsOpts.bUseUnknownFlag = DB::Setting::GetByte(MODNAMEFLAGS,"UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT);
- gFlagsOpts.bShowStatusIconFlag = DB::Setting::GetByte(MODNAMEFLAGS,"ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT);
+ gFlagsOpts.bShowExtraImgFlag = db_get_b(NULL, MODNAMEFLAGS, "ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT);
+ gFlagsOpts.bUseUnknownFlag = db_get_b(NULL, MODNAMEFLAGS, "UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT);
+ gFlagsOpts.bShowStatusIconFlag = db_get_b(NULL, MODNAMEFLAGS, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT);
hOptInitHook = HookEvent(ME_OPT_INITIALISE,ExtraImgOptInit);
hIconsChangedHook = HookEvent(ME_SKIN2_ICONSCHANGED,OnStatusIconsChanged);
@@ -549,7 +549,7 @@ void SvcFlagsLoadModule()
**/
void SvcFlagsOnModulesLoaded()
{
- SvcFlagsEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_FLAGS2, 0), FALSE);
+ SvcFlagsEnableExtraIcons(db_get_b(NULL, MODNAME, SET_CLIST_EXTRAICON_FLAGS2, 0), FALSE);
/* Status Icon */
hMsgWndEventHook = HookEvent(ME_MSG_WINDOWEVENT, OnMsgWndEvent);
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp
index 1325b86958..2ba0fc335a 100644
--- a/plugins/UserInfoEx/src/classMAnnivDate.cpp
+++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp
@@ -258,18 +258,18 @@ int MAnnivDate::DBGetReminderOpts(HANDLE hContact)
if (!hContact || hContact == INVALID_HANDLE_VALUE)
return 1;
if (_wID == ANID_BIRTHDAY) {
- _bRemind = DB::Setting::GetByte(hContact, USERINFO, SET_REMIND_BIRTHDAY_ENABLED, BST_INDETERMINATE);
- _wDaysEarlier = DB::Setting::GetWord(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET, (WORD)-1);
+ _bRemind = db_get_b(hContact, USERINFO, SET_REMIND_BIRTHDAY_ENABLED, BST_INDETERMINATE);
+ _wDaysEarlier = db_get_w(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET, (WORD)-1);
}
else if (_wID <= ANID_LAST) {
CHAR pszSetting[MAXSETTING];
// read reminder option
mir_snprintf(pszSetting, MAXSETTING, "Anniv%dReminder", _wID);
- _bRemind = DB::Setting::GetByte(hContact, Module(), pszSetting, BST_INDETERMINATE);
+ _bRemind = db_get_b(hContact, Module(), pszSetting, BST_INDETERMINATE);
// read offset
mir_snprintf(pszSetting, MAXSETTING, "Anniv%dOffset", _wID);
- _wDaysEarlier = DB::Setting::GetWord(hContact, Module(), pszSetting, (WORD)-1);
+ _wDaysEarlier = db_get_w(hContact, Module(), pszSetting, (WORD)-1);
}
else {
_bRemind = BST_INDETERMINATE;
@@ -290,23 +290,31 @@ int MAnnivDate::DBWriteReminderOpts(HANDLE hContact)
if (!hContact || hContact == INVALID_HANDLE_VALUE)
return 1;
if (_wID == ANID_BIRTHDAY) {
- if (_bRemind == BST_INDETERMINATE) DB::Setting::Delete(hContact, USERINFO, SET_REMIND_BIRTHDAY_ENABLED);
- else DB::Setting::WriteByte(hContact, USERINFO, SET_REMIND_BIRTHDAY_ENABLED, _bRemind);
-
- if (_wDaysEarlier == (WORD)-1) DB::Setting::Delete(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET);
- else DB::Setting::WriteWord(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET, _wDaysEarlier);
+ if (_bRemind == BST_INDETERMINATE)
+ db_unset(hContact, USERINFO, SET_REMIND_BIRTHDAY_ENABLED);
+ else
+ db_set_b(hContact, USERINFO, SET_REMIND_BIRTHDAY_ENABLED, _bRemind);
+
+ if (_wDaysEarlier == (WORD)-1)
+ db_unset(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET);
+ else
+ db_set_w(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET, _wDaysEarlier);
}
else if (_wID <= ANID_LAST) {
CHAR pszSetting[MAXSETTING];
// read reminder option
mir_snprintf(pszSetting, MAXSETTING, "Anniv%dReminder", _wID);
- if (_bRemind == BST_INDETERMINATE) DB::Setting::Delete(hContact, USERINFO, pszSetting);
- else DB::Setting::WriteByte(hContact, USERINFO, pszSetting, _bRemind);
+ if (_bRemind == BST_INDETERMINATE)
+ db_unset(hContact, USERINFO, pszSetting);
+ else
+ db_set_b(hContact, USERINFO, pszSetting, _bRemind);
// read offset
mir_snprintf(pszSetting, MAXSETTING, "Anniv%dOffset", _wID);
- if (_wDaysEarlier == (WORD)-1) DB::Setting::Delete(hContact, USERINFO, pszSetting);
- else DB::Setting::WriteWord(hContact, USERINFO, pszSetting, _wDaysEarlier);
+ if (_wDaysEarlier == (WORD)-1)
+ db_unset(hContact, USERINFO, pszSetting);
+ else
+ db_set_w(hContact, USERINFO, pszSetting, _wDaysEarlier);
}
return 0;
}
@@ -328,19 +336,17 @@ int MAnnivDate::DBWriteReminderOpts(HANDLE hContact)
**/
int MAnnivDate::DBGetDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear)
{
- WORD wtmp;
-
ZeroDate();
- wtmp = DB::Setting::GetWord(hContact, pszModule, szYear, 0);
+ WORD wtmp = db_get_w(hContact, pszModule, szYear, 0);
if (wtmp < 1601) return 1;
Year(wtmp);
- wtmp = DB::Setting::GetWord(hContact, pszModule, szMonth, 0);
+ wtmp = db_get_w(hContact, pszModule, szMonth, 0);
if (wtmp > 0 && wtmp < 13) {
Month(wtmp);
- wtmp = DB::Setting::GetWord(hContact, pszModule, szDay, 0);
+ wtmp = db_get_w(hContact, pszModule, szDay, 0);
if (wtmp > 0 && wtmp <= DaysInMonth(Month())) {
Day(wtmp);
// date was correctly read from db
@@ -365,11 +371,10 @@ int MAnnivDate::DBGetDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPCST
**/
int MAnnivDate::DBWriteDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear)
{
- return (
- DB::Setting::WriteByte(hContact, pszModule, szDay, (BYTE)Day()) ||
- DB::Setting::WriteByte(hContact, pszModule, szMonth, (BYTE)Month()) ||
- DB::Setting::WriteWord(hContact, pszModule, szYear, Year())
-);
+ return
+ db_set_b(hContact, pszModule, szDay, (BYTE)Day()) ||
+ db_set_b(hContact, pszModule, szMonth, (BYTE)Month()) ||
+ db_set_b(hContact, pszModule, szYear, Year());
}
/**
@@ -387,9 +392,9 @@ int MAnnivDate::DBDeleteDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LP
{
int ret;
- ret = DB::Setting::Delete(hContact, pszModule, szDay);
- ret &= DB::Setting::Delete(hContact, pszModule, szMonth);
- ret &= DB::Setting::Delete(hContact, pszModule, szYear);
+ ret = db_unset(hContact, pszModule, szDay);
+ ret &= db_unset(hContact, pszModule, szMonth);
+ ret &= db_unset(hContact, pszModule, szYear);
return ret;
}
@@ -413,7 +418,7 @@ int MAnnivDate::DBGetDateStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSett
if (DB::Setting::GetAsIs(hContact, pszModule, pszSetting, &dbv))
return 1;
if (dbv.type != DBVT_DWORD) {
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
return 1;
}
DateStamp(dbv.dVal);
@@ -440,7 +445,7 @@ int MAnnivDate::DBWriteDateStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSe
{
return 1;
}
- return DB::Setting::WriteDWord(hContact, pszModule, pszSetting, dwStamp);
+ return db_set_dw(hContact, pszModule, pszSetting, dwStamp);
}
/***********************************************************************************************************
@@ -540,14 +545,14 @@ int MAnnivDate::DBMoveBirthDate(HANDLE hContact, BYTE bOld, BYTE bNew) {
if (DBWriteDate(hContact, USERINFO, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR))
return 1;
DBDeleteDate(hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR);
- DB::Setting::Delete(hContact, MOD_MBIRTHDAY, "BirthMode");
+ db_unset(hContact, MOD_MBIRTHDAY, "BirthMode");
}
break;
case 1: //USERINFO
if (!DBGetDate(hContact, USERINFO, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)) {
if (DBWriteDate(hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR))
return 1;
- DB::Setting::WriteByte(hContact, MOD_MBIRTHDAY, "BirthMode", 2);
+ db_set_b(hContact, MOD_MBIRTHDAY, "BirthMode", 2);
DBDeleteDate(hContact, USERINFO, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR);
}
break;
@@ -575,15 +580,13 @@ int MAnnivDate::DBWriteBirthDate(HANDLE hContact)
if (!rc)
{
if (!mir_strcmp(pszModule, MOD_MBIRTHDAY))
- {
- DB::Setting::WriteByte(hContact, MOD_MBIRTHDAY, "BirthMode", 2);
- }
+ db_set_b(hContact, MOD_MBIRTHDAY, "BirthMode", 2);
if (
// only delete values from current contact's custom modules
!(_wFlags & (MADF_HASPROTO|MADF_HASMETA)) &&
// check whether user wants this feature
- DB::Setting::GetByte(SET_REMIND_SECUREBIRTHDAY, TRUE) &&
+ db_get_b(NULL, MODNAME, SET_REMIND_SECUREBIRTHDAY, TRUE) &&
!myGlobals.UseDbxTree)
{
// keep the database clean
@@ -591,7 +594,7 @@ int MAnnivDate::DBWriteBirthDate(HANDLE hContact)
if (mir_strcmp(pszModule, MOD_MBIRTHDAY)!= 0)
{
DBDeleteDate(hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR);
- DB::Setting::Delete(hContact, MOD_MBIRTHDAY, "BirthMode");
+ db_unset(hContact, MOD_MBIRTHDAY, "BirthMode");
}
else if (mir_strcmp(pszModule, USERINFO) !=0)
{
@@ -601,7 +604,7 @@ int MAnnivDate::DBWriteBirthDate(HANDLE hContact)
DBDeleteDate(hContact, USERINFO, SET_CONTACT_DOBD, SET_CONTACT_DOBM, SET_CONTACT_DOBY);
}
- rc = DB::Setting::WriteWord(hContact, USERINFO, SET_CONTACT_AGE, Age());
+ rc = db_set_w(hContact, USERINFO, SET_CONTACT_AGE, Age());
}
return rc;
}
@@ -653,7 +656,7 @@ int MAnnivDate::DBGetAnniversaryDate(HANDLE hContact, WORD iIndex)
if (!DB::Setting::GetTString(hContact, USERINFO, szStamp, &dbv))
{
_strDesc = dbv.ptszVal;
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
}
return rc;
@@ -683,11 +686,11 @@ int MAnnivDate::DBWriteAnniversaryDate(HANDLE hContact, WORD wIndex)
{
// write description
mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dDesc", wIndex);
- DB::Setting::WriteTString(hContact, USERINFO, pszSetting, (LPTSTR)Description());
+ db_set_ts(hContact, USERINFO, pszSetting, (LPTSTR)Description());
return 0;
}
// delete date if written incompletely
- DB::Setting::Delete(hContact, USERINFO, pszSetting);
+ db_unset(hContact, USERINFO, pszSetting);
}
return 1;
}
@@ -760,7 +763,7 @@ int MAnnivDate::BackupBirthday(HANDLE hContact, LPSTR pszProto, const BYTE bDont
BYTE bWantBackup = !mdbNewProto.DBGetDate(hContact, pszProto, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)
&& !IsEqual(mdbNewProto.SystemTime())
- && (bDontIgnoreAnything || (DB::Setting::GetDWord(hContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED, 0) != mdbNewProto.DateStamp()))
+ && (bDontIgnoreAnything || (db_get_dw(hContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED, 0) != mdbNewProto.DateStamp()))
&& !bIsMetaSub;
// allow backup only, if the custom setting differs from all meta subcontacts' protocol based settings, too.
@@ -769,7 +772,7 @@ int MAnnivDate::BackupBirthday(HANDLE hContact, LPSTR pszProto, const BYTE bDont
if (hSubContact && !mdbIgnore.DBGetDate(hSubContact, pszProto, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR))
bWantBackup = bWantBackup
&& !IsEqual(mdbIgnore.SystemTime())
- && (bDontIgnoreAnything || (DB::Setting::GetDWord(hSubContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED, 0) != mdbIgnore.DateStamp()));
+ && (bDontIgnoreAnything || (db_get_dw(hSubContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED, 0) != mdbIgnore.DateStamp()));
}
if (bWantBackup) {
if (!lastAnswer || *lastAnswer != IDALL) {
diff --git a/plugins/UserInfoEx/src/classMTime.cpp b/plugins/UserInfoEx/src/classMTime.cpp
index cfd1bd7562..0d5a42f9d8 100644
--- a/plugins/UserInfoEx/src/classMTime.cpp
+++ b/plugins/UserInfoEx/src/classMTime.cpp
@@ -435,7 +435,7 @@ int MTime::DBGetStamp (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting)
return 1;
}
- dwTimeStamp = DB::Setting::GetDWord(hContact, pszModule, pszSetting, 0);
+ dwTimeStamp = db_get_dw(hContact, pszModule, pszSetting, 0);
if (dwTimeStamp == 0) {
ZeroDate();
@@ -446,7 +446,7 @@ int MTime::DBGetStamp (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting)
return 0;
}
-int MTime::DBWriteStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting)
+int MTime::DBWriteStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting)
{
if (hContact == INVALID_HANDLE_VALUE ||
pszModule == NULL || pszModule[0] == 0 ||
@@ -454,5 +454,5 @@ int MTime::DBWriteStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting)
{
return 1;
}
- return DB::Setting::WriteDWord(hContact, pszModule, pszSetting, TimeStamp());
+ return db_set_dw(hContact, pszModule, pszSetting, TimeStamp());
}
diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp
index 2a26926a35..0c2157bcd2 100644
--- a/plugins/UserInfoEx/src/classPsTree.cpp
+++ b/plugins/UserInfoEx/src/classPsTree.cpp
@@ -127,8 +127,7 @@ int CPsTree::AddDummyItem(LPCSTR pszGroup)
psh._pPages = _pItems;
psh._numPages = _numItems;
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = ghInst;
odp.flags = ODPF_TCHAR;
odp.ptszTitle = mir_utf8decodeT(pszGroup);
@@ -163,7 +162,7 @@ BYTE CPsTree::InitTreeItems(LPWORD needWidth)
if (!DB::Setting::GetUString(NULL, MODNAME, SET_LASTITEM, &dbv))
{
_curItem = FindItemIndexByName(dbv.pszVal);
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
// init the groups
@@ -184,9 +183,8 @@ BYTE CPsTree::InitTreeItems(LPWORD needWidth)
// need to add an empty parent item
if (iParent == -1)
- {
iParent = AddDummyItem(pszGroup);
- }
+
_pItems[i]->Parent(iParent);
mir_free(pszGroup);
}
@@ -555,8 +553,8 @@ void CPsTree::SaveState()
}
// save current selected item
- if (pti) DB::Setting::WriteUString(SET_LASTITEM, pti->Name());
- else DB::Setting::Delete(NULL, MODNAME, SET_LASTITEM);
+ if (pti) db_set_utf(NULL, MODNAME, SET_LASTITEM, pti->Name());
+ else db_unset(NULL, MODNAME, SET_LASTITEM);
}
/**
@@ -588,7 +586,7 @@ void CPsTree::DBResetState()
if (s && *s == '{' && !mir_strnicmp(s + 1, p, c))
{
- DB::Setting::Delete(NULL, MODNAME, s);
+ db_unset(NULL, MODNAME, s);
}
}
// keep only these flags
@@ -640,7 +638,7 @@ int CPsTree::BeginLabelEdit(HTREEITEM hItem)
CPsTreeItem* pti;
// tree is readonly
- if (DB::Setting::GetByte(SET_PROPSHEET_READONLYLABEL, 0))
+ if (db_get_b(NULL, MODNAME, SET_PROPSHEET_READONLYLABEL, 0))
return 0;
// get item text
@@ -744,7 +742,7 @@ void CPsTree::PopupMenu()
tvi.hItem = hti.hItem;
TreeView_GetItem(_hWndTree, &tvi);
- if (!DB::Setting::GetByte(SET_PROPSHEET_READONLYLABEL, FALSE)) {
+ if (!db_get_b(NULL, MODNAME, SET_PROPSHEET_READONLYLABEL, FALSE)) {
mii.dwTypeData = TranslateT("Rename Item");
mii.wID = 32001;
InsertMenuItem(hPopup, 0, FALSE, &mii);
diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp
index 513bfa3d7f..04057d1ca7 100644
--- a/plugins/UserInfoEx/src/classPsTreeItem.cpp
+++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp
@@ -481,12 +481,12 @@ int CPsTreeItem::Create(CPsHdr* pPsh, OPTIONSDIALOGPAGE *odp)
// load custom order
if (!(pPsh->_dwFlags & PSTVF_SORTTREE))
{
- _iPosition = (int)DB::Setting::GetByte(PropertyKey(SET_ITEM_POS), odp->position);
+ _iPosition = (int)db_get_b(NULL, MODNAME, PropertyKey(SET_ITEM_POS), odp->position);
if ((_iPosition < 0) && (_iPosition > 0x800000A))
_iPosition = 0;
}
// read visibility state
- _bState = DB::Setting::GetByte(PropertyKey(SET_ITEM_STATE), DBTVIS_EXPANDED);
+ _bState = db_get_b(NULL, MODNAME, PropertyKey(SET_ITEM_STATE), DBTVIS_EXPANDED);
// error for no longer supported dialog template type
if (((UINT_PTR)odp->pszTemplate & 0xFFFF0000))
@@ -534,20 +534,20 @@ WORD CPsTreeItem::DBSaveItemState(LPCSTR pszGroup, int iItemPosition, UINT iStat
WORD numErrors = 0;
// save group
- if ((dwFlags & PSTVF_GROUPS) && (dwFlags & PSTVF_POS_CHANGED)) {
- numErrors += DB::Setting::WriteUString(PropertyKey(SET_ITEM_GROUP), (LPSTR)pszGroup);
- }
+ if ((dwFlags & PSTVF_GROUPS) && (dwFlags & PSTVF_POS_CHANGED))
+ numErrors += db_set_utf(NULL, MODNAME, PropertyKey(SET_ITEM_GROUP), (LPSTR)pszGroup);
+
// save label
- if ((dwFlags & PSTVF_LABEL_CHANGED) && (_dwFlags & PSTVF_LABEL_CHANGED)) {
- numErrors += DB::Setting::WriteTString(GlobalPropertyKey(SET_ITEM_LABEL), Label());
- }
+ if ((dwFlags & PSTVF_LABEL_CHANGED) && (_dwFlags & PSTVF_LABEL_CHANGED))
+ numErrors += db_set_ts(NULL, MODNAME, GlobalPropertyKey(SET_ITEM_LABEL), Label());
+
// save position
- if ((dwFlags & PSTVF_POS_CHANGED) && !(dwFlags & PSTVF_SORTTREE)) {
- numErrors += DB::Setting::WriteByte(PropertyKey(SET_ITEM_POS), iItemPosition);
- }
+ if ((dwFlags & PSTVF_POS_CHANGED) && !(dwFlags & PSTVF_SORTTREE))
+ numErrors += db_set_b(NULL, MODNAME, PropertyKey(SET_ITEM_POS), iItemPosition);
+
// save state
if (dwFlags & PSTVF_STATE_CHANGED) {
- numErrors += DB::Setting::WriteByte(PropertyKey(SET_ITEM_STATE),
+ numErrors += db_set_b(NULL, MODNAME, PropertyKey(SET_ITEM_STATE),
_hItem ? ((iState & TVIS_EXPANDED) ? DBTVIS_EXPANDED : DBTVIS_NORMAL) : DBTVIS_INVISIBLE);
}
RemoveFlags(PSTVF_STATE_CHANGED|PSTVF_LABEL_CHANGED|PSTVF_POS_CHANGED);
diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.cpp b/plugins/UserInfoEx/src/ctrl_annivedit.cpp
index 9554d9f182..f0da0189d1 100644
--- a/plugins/UserInfoEx/src/ctrl_annivedit.cpp
+++ b/plugins/UserInfoEx/src/ctrl_annivedit.cpp
@@ -41,7 +41,7 @@ CAnnivEditCtrl::CAnnivEditCtrl(HWND hDlg, WORD idCtrl, LPCSTR pszSetting)
_hBtnEdit = GetDlgItem(hDlg, BTN_EDIT);
_hBtnMenu = GetDlgItem(hDlg, BTN_MENU);
_hwndDate = GetDlgItem(hDlg, EDIT_ANNIVERSARY_DATE);
- _ReminderEnabled = DB::Setting::GetByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
+ _ReminderEnabled = db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
_pDates = NULL;
_curDate = 0;
@@ -148,7 +148,7 @@ void CAnnivEditCtrl::EnableCurrentItem()
= !hContact ||
(pCurrent->Flags() & CTRLF_HASCUSTOM) ||
!(pCurrent->Flags() & (CTRLF_HASPROTO|CTRLF_HASMETA)) ||
- !DB::Setting::GetByte(SET_PROPSHEET_PCBIREADONLY, 0);
+ !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0);
EnableWindow(_hBtnEdit, bEnabled);
EnableWindow(_hBtnDel, bEnabled);
@@ -368,7 +368,7 @@ INT_PTR CAnnivEditCtrl::DBWriteAnniversaries(HANDLE hContact)
ret = 1;
for (i = 0; i < SIZEOF(szPrefix); i++) {
mir_strncpy(szSet0 + ofs, szPrefix[i], SIZEOF(szSet0) - ofs);
- ret &= DB::Setting::Delete(hContact, USERINFO, szSet0);
+ ret &= db_unset(hContact, USERINFO, szSet0);
}
}
while (wIndex++ <= ANID_LAST && !ret);
@@ -541,7 +541,7 @@ void CAnnivEditCtrl::OnReminderChecked()
{
if (IsDlgButtonChecked(_hwndDlg, RADIO_REMIND1))
{
- _itot(DB::Setting::GetByte(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), buf, 10);
+ _itot(db_get_b(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), buf, 10);
EnableWindow(GetDlgItem(_hwndDlg, EDIT_REMIND), FALSE);
EnableWindow(GetDlgItem(_hwndDlg, SPIN_REMIND), FALSE);
state = BST_INDETERMINATE;
@@ -550,7 +550,7 @@ void CAnnivEditCtrl::OnReminderChecked()
{
if (pCurrent->RemindOffset() == (BYTE)-1)
{
- _itot(DB::Setting::GetByte(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), buf, 10);
+ _itot(db_get_b(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), buf, 10);
}
else
{
diff --git a/plugins/UserInfoEx/src/ctrl_base.cpp b/plugins/UserInfoEx/src/ctrl_base.cpp
index d5d072a487..070ae8eb7f 100644
--- a/plugins/UserInfoEx/src/ctrl_base.cpp
+++ b/plugins/UserInfoEx/src/ctrl_base.cpp
@@ -33,11 +33,11 @@ COLORREF clrMeta = -1;
void Ctrl_InitTextColours()
{
- clrBoth = DB::Setting::GetDWord(NULL, MODNAME, SET_PROPSHEET_CLRBOTH, RGB(0, 160, 10));
- clrChanged = DB::Setting::GetDWord(NULL, MODNAME, SET_PROPSHEET_CLRCHANGED, RGB(190, 0, 0));
- clrCustom = DB::Setting::GetDWord(NULL, MODNAME, SET_PROPSHEET_CLRCUSTOM, RGB(0, 10, 130));
- clrNormal = DB::Setting::GetDWord(NULL, MODNAME, SET_PROPSHEET_CLRNORMAL, RGB(90, 90, 90));
- clrMeta = DB::Setting::GetDWord(NULL, MODNAME, SET_PROPSHEET_CLRMETA, RGB(120, 40, 130));
+ clrBoth = db_get_dw(NULL, MODNAME, SET_PROPSHEET_CLRBOTH, RGB(0, 160, 10));
+ clrChanged = db_get_dw(NULL, MODNAME, SET_PROPSHEET_CLRCHANGED, RGB(190, 0, 0));
+ clrCustom = db_get_dw(NULL, MODNAME, SET_PROPSHEET_CLRCUSTOM, RGB(0, 10, 130));
+ clrNormal = db_get_dw(NULL, MODNAME, SET_PROPSHEET_CLRNORMAL, RGB(90, 90, 90));
+ clrMeta = db_get_dw(NULL, MODNAME, SET_PROPSHEET_CLRMETA, RGB(120, 40, 130));
}
INT_PTR CALLBACK Ctrl_SetTextColour(HDC hdc, WORD wFlags)
@@ -55,7 +55,7 @@ INT_PTR CALLBACK Ctrl_SetTextColour(HDC hdc, WORD wFlags)
INT_PTR CALLBACK Ctrl_SetTextColour(HWND hCtrl, HDC hdc)
{
- if (hCtrl && DB::Setting::GetByte(SET_PROPSHEET_SHOWCOLOURS, 1))
+ if (hCtrl && db_get_b(NULL, MODNAME, SET_PROPSHEET_SHOWCOLOURS, 1))
{
LPCTRL pCtrl = (LPCTRL)GetUserData(hCtrl);
if (PtrIsValid(pCtrl))
diff --git a/plugins/UserInfoEx/src/ctrl_combo.cpp b/plugins/UserInfoEx/src/ctrl_combo.cpp
index e910d61b39..1eb3817f3e 100644
--- a/plugins/UserInfoEx/src/ctrl_combo.cpp
+++ b/plugins/UserInfoEx/src/ctrl_combo.cpp
@@ -158,7 +158,7 @@ BOOL CCombo::OnInfoChanged(HANDLE hContact, LPCSTR pszProto)
_Flags.B.hasCustom = _Flags.B.hasProto = _Flags.B.hasMeta = 0;
_Flags.W |= DB::Setting::GetTStringCtrl(hContact, USERINFO, USERINFO, pszProto, _pszSetting, &dbv);
- EnableWindow(_hwnd, !hContact || _Flags.B.hasCustom || !DB::Setting::GetByte(SET_PROPSHEET_PCBIREADONLY, 0));
+ EnableWindow(_hwnd, !hContact || _Flags.B.hasCustom || !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0));
if (_Flags.B.hasCustom || _Flags.B.hasProto || _Flags.B.hasMeta)
{
@@ -180,7 +180,7 @@ BOOL CCombo::OnInfoChanged(HANDLE hContact, LPCSTR pszProto)
// unspecified
iVal = Find(_pList[0].nID);
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
ComboBox_SetCurSel(_hwnd, iVal);
_curSel = ComboBox_GetCurSel(_hwnd);
SendMessage(GetParent(_hwnd), WM_COMMAND, MAKEWPARAM( (WORD)this->_idCtrl, (WORD)CBN_SELCHANGE), (LPARAM)_hwnd);
@@ -212,17 +212,17 @@ void CCombo::OnApply(HANDLE hContact, LPCSTR pszProto)
switch (_bDataType)
{
case DBVT_BYTE:
- DB::Setting::WriteByte(hContact, pszModule, _pszSetting, pd->nID);
+ db_set_b(hContact, pszModule, _pszSetting, pd->nID);
break;
case DBVT_WORD:
- DB::Setting::WriteWord(hContact, pszModule, _pszSetting, pd->nID);
+ db_set_w(hContact, pszModule, _pszSetting, pd->nID);
break;
case DBVT_DWORD:
- DB::Setting::WriteDWord(hContact, pszModule, _pszSetting, pd->nID);
+ db_set_dw(hContact, pszModule, _pszSetting, pd->nID);
break;
case DBVT_ASCIIZ:
case DBVT_WCHAR:
- DB::Setting::WriteAString(hContact, pszModule, _pszSetting, (LPSTR)pd->pszText);
+ db_set_s(hContact, pszModule, _pszSetting, (LPSTR)pd->pszText);
}
if (!hContact)
{
@@ -234,7 +234,7 @@ void CCombo::OnApply(HANDLE hContact, LPCSTR pszProto)
}
if (_Flags.B.hasChanged)
{
- DB::Setting::Delete(hContact, pszModule, _pszSetting);
+ db_unset(hContact, pszModule, _pszSetting);
_Flags.B.hasChanged = 0;
OnInfoChanged(hContact, pszProto);
}
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp
index 33ee274585..10c0ab10c2 100644
--- a/plugins/UserInfoEx/src/ctrl_contact.cpp
+++ b/plugins/UserInfoEx/src/ctrl_contact.cpp
@@ -152,7 +152,7 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
SetUserData(hDlg, lParam);
SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_EMAIL));
- if (DB::Setting::GetByte(SET_ICONS_BUTTONS, 1))
+ if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1))
{
SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
@@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
SetUserData(hDlg, lParam);
SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_PHONE));
- if (DB::Setting::GetByte(SET_ICONS_BUTTONS, 1))
+ if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1))
{
SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
@@ -581,7 +581,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
* return: a brush
**/
case WM_CTLCOLOREDIT:
- if (!DB::Setting::GetByte(SET_PROPSHEET_SHOWCOLOURS, 1) || (HWND)lParam != cbex->hEdit || !cbex->pItems || cbex->iSelectedItem < 0)
+ if (!db_get_b(NULL, MODNAME, SET_PROPSHEET_SHOWCOLOURS, 1) || (HWND)lParam != cbex->hEdit || !cbex->pItems || cbex->iSelectedItem < 0)
break;
return Ctrl_SetTextColour((HDC)wParam, cbex->pItems[cbex->iSelectedItem].wFlags);
@@ -1157,7 +1157,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
bEnabled = !hContact ||
(cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_HASCUSTOM) ||
!(cbex->pItems[cbex->iSelectedItem].wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA)) ||
- !DB::Setting::GetByte(SET_PROPSHEET_PCBIREADONLY, 0);
+ !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0);
EnableWindow(cbex->hBtnEdit, bEnabled);
EnableWindow(cbex->hBtnDel, bEnabled && GetWindowTextLength(cbex->hEdit) > 0);
@@ -1333,7 +1333,7 @@ int CtrlContactAddItemFromDB(
cbi.wMask = CBEXIM_ALL;
cbi.pszIcon = szIcon;
SendMessage(hCtrl, CBEXM_ADDITEM, NULL, (LPARAM)&cbi);
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
return (cbi.wFlags & CTRLF_CHANGED) == CTRLF_CHANGED;
}
@@ -1450,12 +1450,12 @@ int CtrlContactWriteItemToDB(
if (!(cbi.wFlags & CTRLF_CHANGED)) return 0;
if (!hContact && !(pszModule = pszProto)) return 1;
if (!*szVal)
- DB::Setting::Delete(hContact, pszModule, pszSetting);
+ db_unset(hContact, pszModule, pszSetting);
else {
- if (cbi.wFlags & CBEXIF_SMS) {
+ if (cbi.wFlags & CBEXIF_SMS)
mir_tcsncat(szVal, _T(" SMS"), SIZEOF(szVal));
- }
- if (DB::Setting::WriteTString(hContact, pszModule, pszSetting, szVal)) return 1;
+
+ if (db_set_ts(hContact, pszModule, pszSetting, szVal)) return 1;
}
cbi.wFlags &= ~CTRLF_CHANGED;
cbi.wMask = CBEXIM_FLAGS;
@@ -1507,12 +1507,12 @@ int CtrlContactWriteMyItemsToDB(
}
mir_snprintf(pszSetting, MAXSETTING, szFormatCat, i);
if (*szCat && _tcsncmp(szCat, pszOther, ccOther)) {
- if (DB::Setting::WriteTString(hContact, pszModule, pszSetting, szCat)) return 1;
+ if (db_set_ts(hContact, pszModule, pszSetting, szCat)) return 1;
}
else
- DB::Setting::Delete(hContact, pszModule, pszSetting);
+ db_unset(hContact, pszModule, pszSetting);
mir_snprintf(pszSetting, MAXSETTING, szFormatVal, i);
- if (DB::Setting::WriteTString(hContact, pszModule, pszSetting, szVal)) return 1;
+ if (db_set_ts(hContact, pszModule, pszSetting, szVal)) return 1;
cbi.wFlags &= ~CTRLF_CHANGED;
cbi.wMask = CBEXIM_FLAGS;
CtrlContactWndProc(hCtrl, CBEXM_SETITEM, NULL, (LPARAM)&cbi);
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp
index bbe614247d..947bb68c19 100644
--- a/plugins/UserInfoEx/src/ctrl_edit.cpp
+++ b/plugins/UserInfoEx/src/ctrl_edit.cpp
@@ -116,7 +116,7 @@ BOOL CEditCtrl::OnInfoChanged(HANDLE hContact, LPCSTR pszProto)
_Flags.W |= DB::Setting::GetTStringCtrl(hContact, _pszModule, _pszModule, pszProto, _pszSetting, &dbv);
EnableWindow(_hwnd,
- !hContact || _Flags.B.hasCustom || !DB::Setting::GetByte(SET_PROPSHEET_PCBIREADONLY, 0));
+ !hContact || _Flags.B.hasCustom || !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0));
MIR_FREE(_pszValue);
switch (dbv.type)
@@ -149,7 +149,7 @@ BOOL CEditCtrl::OnInfoChanged(HANDLE hContact, LPCSTR pszProto)
default:
SetWindowText(_hwnd, _T(""));
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
break;
}
_Flags.B.hasChanged = 0;
@@ -229,7 +229,7 @@ void CEditCtrl::OnApply(HANDLE hContact, LPCSTR pszProto)
}
if (_Flags.B.hasChanged)
{
- DB::Setting::Delete(hContact, pszModule, _pszSetting);
+ db_unset(hContact, pszModule, _pszSetting);
_Flags.B.hasChanged = 0;
diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp
index ee20dd2bbd..76152e13c4 100644
--- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp
+++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp
@@ -217,8 +217,8 @@ void CTzCombo::OnApply(HANDLE hContact, LPCSTR pszProto)
else {
const CTimeZone* pTimeZone = (CTimeZone*)ComboBox_GetItemData(_hwnd, _curSel);
if (PtrIsValid(pTimeZone)) {
- DB::Setting::WriteTString(hContact, USERINFO, SET_CONTACT_TIMEZONENAME, pTimeZone->ptszName);
- DB::Setting::WriteByte(hContact, pszModule, SET_CONTACT_TIMEZONE, pTimeZone->ToMirandaTimezone());
+ db_set_ts(hContact, USERINFO, SET_CONTACT_TIMEZONENAME, pTimeZone->ptszName);
+ db_set_b(hContact, pszModule, SET_CONTACT_TIMEZONE, pTimeZone->ToMirandaTimezone());
if (!hContact) {
_Flags.B.hasCustom = 0;
@@ -231,9 +231,9 @@ void CTzCombo::OnApply(HANDLE hContact, LPCSTR pszProto)
if (_Flags.B.hasChanged)
{
- DB::Setting::Delete(hContact, USERINFO, SET_CONTACT_TIMEZONENAME);
- DB::Setting::Delete(hContact, USERINFO, SET_CONTACT_TIMEZONEINDEX);
- DB::Setting::Delete(hContact, pszModule, SET_CONTACT_TIMEZONE);
+ db_unset(hContact, USERINFO, SET_CONTACT_TIMEZONENAME);
+ db_unset(hContact, USERINFO, SET_CONTACT_TIMEZONEINDEX);
+ db_unset(hContact, pszModule, SET_CONTACT_TIMEZONE);
_Flags.B.hasChanged = 0;
OnInfoChanged(hContact, pszProto);
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
index d8637304fc..cc31b1c4c6 100644
--- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
@@ -373,17 +373,17 @@ class CAnnivList
}
// init reminder groups
- pDlg->_bRemindEnable = DB::Setting::GetByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF;
+ pDlg->_bRemindEnable = db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF;
if (hCtrl = GetDlgItem(hDlg, CHECK_REMIND)) {
Button_SetCheck(hCtrl, pDlg->_bRemindEnable ? BST_INDETERMINATE : BST_UNCHECKED);
EnableWindow(hCtrl, pDlg->_bRemindEnable);
}
- CheckDlgButton(hDlg, CHECK_POPUP, DB::Setting::GetByte(SET_ANNIVLIST_POPUP, FALSE));
+ CheckDlgButton(hDlg, CHECK_POPUP, db_get_b(NULL, MODNAME, SET_ANNIVLIST_POPUP, FALSE));
// set number of days to show contact in advance
SetDlgItemInt(hDlg, EDIT_DAYS, pDlg->_filter.wDaysBefore , FALSE);
if (hCtrl = GetDlgItem(hDlg, CHECK_DAYS)) {
- Button_SetCheck(hCtrl, DB::Setting::GetByte(SET_ANNIVLIST_FILTER_DAYSENABLED, FALSE));
+ Button_SetCheck(hCtrl, db_get_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYSENABLED, FALSE));
DlgProc(hDlg, WM_COMMAND, MAKEWPARAM(CHECK_DAYS, BN_CLICKED), (LPARAM)hCtrl);
}
@@ -673,7 +673,7 @@ class CAnnivList
CHAR pszSetting[MAXSETTING];
mir_snprintf(pszSetting, SIZEOF(pszSetting), "AnnivDlg_Col%d", iSubItem);
- lvc.cx = DB::Setting::GetWord(pszSetting, defaultWidth);
+ lvc.cx = db_get_w(NULL, MODNAME, pszSetting, defaultWidth);
lvc.mask = LVCF_WIDTH|LVCF_TEXT;
lvc.iSubItem = iSubItem;
lvc.pszText = TranslateTS(pszText);
@@ -816,7 +816,7 @@ class CAnnivList
MAnnivDate ad;
int i = 0;
DWORD age = 0;
- WORD wDaysBefore = DB::Setting::GetWord(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
+ WORD wDaysBefore = db_get_w(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
WORD numMale = 0;
WORD numFemale = 0;
WORD numContacts = 0;
@@ -827,9 +827,7 @@ class CAnnivList
mtNow.GetLocalTime();
// insert the items into the list
- for (hContact = DB::Contact::FindFirst();
- hContact;
- hContact = DB::Contact::FindNext(hContact))
+ for (hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
{
// ignore meta subcontacts here, as they are not interesting.
if (!DB::MetaContact::IsSub(hContact)) {
@@ -924,8 +922,8 @@ class CAnnivList
**/
void LoadFilter()
{
- _filter.wDaysBefore = DB::Setting::GetWord(SET_ANNIVLIST_FILTER_DAYS, 9);
- _filter.bFilterIndex = DB::Setting::GetByte(SET_ANNIVLIST_FILTER_INDEX, 0);
+ _filter.wDaysBefore = db_get_w(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYS, 9);
+ _filter.bFilterIndex = db_get_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_INDEX, 0);
}
/**
@@ -934,9 +932,9 @@ class CAnnivList
void SaveFilter()
{
if (_hDlg) {
- DB::Setting::WriteWord(SET_ANNIVLIST_FILTER_DAYS, (WORD)GetDlgItemInt(_hDlg, EDIT_DAYS, NULL, FALSE));
- DB::Setting::WriteByte(SET_ANNIVLIST_FILTER_DAYSENABLED, (BYTE)Button_GetCheck(GetDlgItem(_hDlg, CHECK_DAYS)));
- DB::Setting::WriteByte(SET_ANNIVLIST_FILTER_INDEX, (BYTE)ComboBox_GetCurSel(GetDlgItem(_hDlg, EDIT_DAYS)));
+ db_set_w(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYS, (WORD)GetDlgItemInt(_hDlg, EDIT_DAYS, NULL, FALSE));
+ db_set_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYSENABLED, (BYTE)Button_GetCheck(GetDlgItem(_hDlg, CHECK_DAYS)));
+ db_set_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_INDEX, (BYTE)ComboBox_GetCurSel(GetDlgItem(_hDlg, EDIT_DAYS)));
}
}
@@ -985,12 +983,12 @@ public:
for (c = 0; c < cc; c++) {
mir_snprintf(pszSetting, MAXSETTING, "AnnivDlg_Col%d", c);
- DB::Setting::WriteWord(pszSetting, (WORD)ListView_GetColumnWidth(_hList, c));
+ db_set_w(NULL, MODNAME, pszSetting, (WORD)ListView_GetColumnWidth(_hList, c));
}
DeleteAllItems();
}
// remember popup setting
- DB::Setting::WriteByte(SET_ANNIVLIST_POPUP, (BYTE)IsDlgButtonChecked(_hDlg, CHECK_POPUP));
+ db_set_b(NULL, MODNAME, SET_ANNIVLIST_POPUP, (BYTE)IsDlgButtonChecked(_hDlg, CHECK_POPUP));
// save window position, size and column widths
Utils_SaveWindowPosition(_hDlg, NULL, MODNAME, "AnnivDlg_");
SaveFilter();
@@ -1037,7 +1035,7 @@ INT_PTR DlgAnniversaryListShow(WPARAM wParam, LPARAM lParam)
if (!gpDlg) {
try
{
- myGlobals.WantAeroAdaption = DB::Setting::GetByte(SET_PROPSHEET_AEROADAPTION, TRUE);
+ myGlobals.WantAeroAdaption = db_get_b(NULL, MODNAME, SET_PROPSHEET_AEROADAPTION, TRUE);
gpDlg = new CAnnivList();
}
catch(...)
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp
index 7ddcab2ac9..bb81ba8eff 100644
--- a/plugins/UserInfoEx/src/dlg_msgbox.cpp
+++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp
@@ -722,8 +722,8 @@ INT_PTR MsgBoxService(WPARAM wParam, LPARAM lParam)
if (!(pMsgBox->uType & (MB_INFOBAR|MB_NOPOPUP)) && // message box can be a popup?
ServiceExists(MS_POPUP_ADDPOPUPT) && // popups exist?
myGlobals.PopupActionsExist == 1 && // popup support ext stuct?
- (DB::Setting::GetDWord(NULL, "Popup","Actions", 0) & 1) && // popup++ actions on?
- DB::Setting::GetByte(SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups?
+ (db_get_dw(NULL, "Popup","Actions", 0) & 1) && // popup++ actions on?
+ db_get_b(NULL, MODNAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups?
return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam);
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp
index 7abac1cf6a..9a4ff2112d 100644
--- a/plugins/UserInfoEx/src/dlg_propsheet.cpp
+++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp
@@ -262,8 +262,8 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam)
HWND hWnd;
// update some cached settings
- myGlobals.ShowPropsheetColours = DB::Setting::GetByte(SET_PROPSHEET_SHOWCOLOURS, TRUE);
- myGlobals.WantAeroAdaption = DB::Setting::GetByte(SET_PROPSHEET_AEROADAPTION, TRUE);
+ myGlobals.ShowPropsheetColours = db_get_b(NULL, MODNAME, SET_PROPSHEET_SHOWCOLOURS, TRUE);
+ myGlobals.WantAeroAdaption = db_get_b(NULL, MODNAME, SET_PROPSHEET_AEROADAPTION, TRUE);
// allow only one dialog per user
if (hWnd = WindowList_Find(ghWindowList, (HANDLE)wParam)) {
@@ -277,9 +277,9 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam)
HICON hDefIcon;
// init the treeview options
- if (DB::Setting::GetByte(SET_PROPSHEET_SORTITEMS, FALSE))
+ if (db_get_b(NULL, MODNAME, SET_PROPSHEET_SORTITEMS, FALSE))
psh._dwFlags |= PSTVF_SORTTREE;
- if (DB::Setting::GetByte(SET_PROPSHEET_GROUPS, TRUE))
+ if (db_get_b(NULL, MODNAME, SET_PROPSHEET_GROUPS, TRUE))
psh._dwFlags |= PSTVF_GROUPS;
// create imagelist
metrics.x = GetSystemMetrics(SM_CXSMICON);
@@ -533,7 +533,7 @@ static int InitDetails(WPARAM wParam, LPARAM lParam)
if (!(pPsh->_dwFlags & PSF_PROTOPAGESONLY)) {
OPTIONSDIALOGPAGE odp;
- BYTE bChangeDetailsEnabled = myGlobals.CanChangeDetails && DB::Setting::GetByte(SET_PROPSHEET_CHANGEMYDETAILS, FALSE);
+ BYTE bChangeDetailsEnabled = myGlobals.CanChangeDetails && db_get_b(NULL, MODNAME, SET_PROPSHEET_CHANGEMYDETAILS, FALSE);
// important to avoid craches!!
ZeroMemory(&odp, sizeof(odp));
@@ -607,9 +607,7 @@ void DlgContactInfoInitTreeIcons()
if ( !ProtoEnumAccounts(&ProtoCount, &pd)) {
for (i = 0; i < ProtoCount; i++) {
// enumerate all contacts
- for (psh._hContact = DB::Contact::FindFirst();
- psh._hContact != NULL;
- psh._hContact = DB::Contact::FindNext(psh._hContact))
+ for (psh._hContact = db_find_first(); psh._hContact != NULL; psh._hContact = db_find_next(psh._hContact))
{
// compare contact's protocol to the current one, to add
pszContactProto = DB::Contact::Proto(psh._hContact);
@@ -1244,7 +1242,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
{ ICO_BTN_APPLY, BM_SETIMAGE, IDAPPLY }
};
- const int numIconsToSet = DB::Setting::GetByte(SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 1;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 1;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
@@ -1370,7 +1368,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
if (!myGlobals.szMetaProto)
break;
- if (!DB::Setting::GetByte(SET_META_SCAN, TRUE))
+ if (!db_get_b(NULL, MODNAME, SET_META_SCAN, TRUE))
break;
for (i = 0; i < pPs->nSubContacts; i++) {
@@ -1447,7 +1445,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
break;
if (pPs->hContact != (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, NULL))
break;
- if (!DB::Setting::GetByte(SET_META_SCAN, TRUE))
+ if (!db_get_b(NULL, MODNAME, SET_META_SCAN, TRUE))
break;
}
@@ -1671,7 +1669,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)pPs->hContact, NULL);
// need to upload owners settings
- if (!pPs->hContact && myGlobals.CanChangeDetails && DB::Setting::GetByte(SET_PROPSHEET_CHANGEMYDETAILS, FALSE)) {
+ if (!pPs->hContact && myGlobals.CanChangeDetails && db_get_b(NULL, MODNAME, SET_PROPSHEET_CHANGEMYDETAILS, FALSE)) {
if (pPs->pUpload = new CPsUpload(pPs, LOWORD(wParam) == IDOK)) {
if (pPs->pUpload->UploadFirst() == CPsUpload::UPLOAD_CONTINUE)
break;
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
index aea0d35064..77ae97f992 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
@@ -32,10 +32,10 @@ HANDLE CListFindGroup(LPCSTR pszGroup)
if (DB::Setting::GetUString(NULL, "CListGroups", buf, &dbv))
break;
if (dbv.pszVal && pszGroup && !_stricmp(dbv.pszVal + 1, pszGroup)) {
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
return (HANDLE)(INT_PTR)(i+1);
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
return INVALID_HANDLE_VALUE;
}
@@ -78,7 +78,7 @@ CExImContactBase::~CExImContactBase()
MIR_FREE(_pszProto);
MIR_FREE(_pszAMPro);
MIR_FREE(_pszUIDKey);
- DB::Variant::Free(&_dbvUID);
+ db_free(&_dbvUID);
}
/**
@@ -105,7 +105,7 @@ BYTE CExImContactBase::fromDB(HANDLE hContact)
MIR_FREE(_pszDisp);
MIR_FREE(_pszGroup);
MIR_FREE(_pszUIDKey);
- DB::Variant::Free(&_dbvUID);
+ db_free(&_dbvUID);
ZeroMemory(&_dbvUID, sizeof(DBVARIANT));
// OWNER
@@ -118,11 +118,11 @@ BYTE CExImContactBase::fromDB(HANDLE hContact)
// AM_BaseProto
if (!DB::Setting::GetUString(NULL, pszProto, "AM_BaseProto", &dbv )) {
_pszAMPro = mir_strdup(dbv.pszVal);
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
// unique id (for ChatRoom)
- if (isChatRoom = DB::Setting::GetByte(_hContact, pszProto, "ChatRoom", 0)) {
+ if (isChatRoom = db_get_b(_hContact, pszProto, "ChatRoom", 0)) {
uidSetting = "ChatRoomID";
_pszUIDKey = mir_strdup(uidSetting);
if (!DB::Setting::GetAsIs(_hContact, pszProto, uidSetting, &_dbvUID)) {
@@ -149,19 +149,19 @@ BYTE CExImContactBase::fromDB(HANDLE hContact)
// nickname
if (!DB::Setting::GetUString(_hContact, pszProto, SET_CONTACT_NICK, &dbv)) {
_pszNick = mir_strdup(dbv.pszVal);
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
if (_hContact && ret) {
// Clist Group
if (!DB::Setting::GetUString(_hContact, MOD_CLIST, "Group", &dbv)) {
_pszGroup = mir_strdup(dbv.pszVal);
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
// Clist DisplayName
if (!DB::Setting::GetUString(_hContact, MOD_CLIST, SET_CONTACT_MYHANDLE, &dbv)) {
_pszDisp = mir_strdup(dbv.pszVal);
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
}
return ret;
@@ -188,7 +188,7 @@ BYTE CExImContactBase::fromIni(LPSTR& row)
MIR_FREE(_pszDisp);
MIR_FREE(_pszGroup);
MIR_FREE(_pszUIDKey);
- DB::Variant::Free(&_dbvUID);
+ db_free(&_dbvUID);
ZeroMemory(&_dbvUID, sizeof(DBVARIANT));
_dbvUIDHash = 0;
@@ -280,12 +280,12 @@ HANDLE CExImContactBase::toDB()
return INVALID_HANDLE_VALUE;
}
// write nick and display name
- if (_pszNick) DB::Setting::WriteUString(_hContact, _pszProto, SET_CONTACT_NICK, _pszNick);
- if (_pszDisp) DB::Setting::WriteUString(_hContact, MOD_CLIST, SET_CONTACT_MYHANDLE, _pszDisp);
+ if (_pszNick) db_set_utf(_hContact, _pszProto, SET_CONTACT_NICK, _pszNick);
+ if (_pszDisp) db_set_utf(_hContact, MOD_CLIST, SET_CONTACT_MYHANDLE, _pszDisp);
// add group
if (_pszGroup) {
- DB::Setting::WriteUString(_hContact, MOD_CLIST, "Group", _pszGroup);
+ db_set_utf(_hContact, MOD_CLIST, "Group", _pszGroup);
if (CListFindGroup(_pszGroup) == INVALID_HANDLE_VALUE) {
WPARAM hGroup = (WPARAM)CallService(MS_CLIST_GROUPCREATE, 0, 0);
if (hGroup) {
@@ -523,7 +523,7 @@ BYTE CExImContactBase::isHandle(HANDLE hContact)
return FALSE;
isEqual = compareUID (&dbv);
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
// compare nicknames if no UID
else if (!DB::Setting::GetUString(hContact, _pszProto, SET_CONTACT_NICK, &dbv)) {
@@ -537,7 +537,7 @@ BYTE CExImContactBase::isHandle(HANDLE hContact)
MIR_FREE(ptszProto);
isEqual = ans == IDYES;
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
return isEqual;
}
@@ -554,9 +554,7 @@ HANDLE CExImContactBase::findHandle()
{
HANDLE hContact;
- for (hContact = DB::Contact::FindFirst();
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
if (isHandle(hContact)) {
_hContact = hContact;
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
index 04ac62cb3b..e17d64f7c7 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
@@ -437,7 +437,7 @@ int CExImContactXML::ExportSetting(TiXmlElement *xmlModule, LPCSTR pszModule, LP
#endif
; // nothing
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
if (xmlValue) {
xmlEntry = new TiXmlElement(XKEY_SET);
if (xmlEntry) {
@@ -577,7 +577,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact)
LPSTR pszMetaProto = myGlobals.szMetaProto ? myGlobals.szMetaProto : "MetaContacts";
// delete last contact
- DB::Variant::Free(&_dbvUID);
+ db_free(&_dbvUID);
_hContact = INVALID_HANDLE_VALUE;
_xmlNode = xContact;
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
index 1512c7dfb9..1d9bb93b60 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
@@ -171,7 +171,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
{ ICO_BTN_EXPORT, BM_SETIMAGE, IDOK },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = DB::Setting::GetByte(SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
// create imagelist for treeview
@@ -294,9 +294,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
{
HANDLE hContact;
- for (hContact = DB::Contact::FindFirst();
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
// ignore empty modules
if (!DB::Module::IsEmpty(hContact, p)) {
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
index 9a84faf5c5..046305e064 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
@@ -243,9 +243,9 @@ static void SaveInitialDir(LPSTR pszInitialDir)
if (p = mir_strrchr(pszInitialDir, '\\')) {
*p = 0;
if ( PathToRelative(pszInitialDir, szRelative))
- DB::Setting::WriteAString(0, MODNAME, "vCardPath", szRelative);
+ db_set_s(0, MODNAME, "vCardPath", szRelative);
else
- DB::Setting::WriteAString(0, MODNAME, "vCardPath", pszInitialDir);
+ db_set_s(0, MODNAME, "vCardPath", pszInitialDir);
*p = '\\';
}
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
index 6899903e3e..9c0787ff8b 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
@@ -42,7 +42,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar
{ ICO_DLG_IMPORT, STM_SETIMAGE, ICO_DLGLOGO },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = DB::Setting::GetByte(SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
TranslateDialogDefault(hDlg);
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
index 77a638e44a..f8b5fbc3ae 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
@@ -113,7 +113,7 @@ static void ExportModule(HANDLE hContact, LPCSTR pszModule, FILE* file)
}
break;
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
}
}
@@ -200,9 +200,7 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName)
ExportContact(NULL, &Modules, file);
fprintf(file, "\n\n");
// Contacts
- for (hContact = DB::Contact::FindFirst();
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
ExportContact(hContact, &Modules, file);
fprintf(file, "\n\n");
@@ -353,7 +351,7 @@ int ImportSetting(HANDLE hContact, LPCSTR pszModule, LPSTR &strLine)
value++;
// if the value is empty, delete it from db
if (*value == '\0')
- return DB::Setting::Delete(hContact, pszModule, pszLine);
+ return db_unset(hContact, pszModule, pszLine);
} while (*value == '\t' || *value == ' ');
// decode database type and value
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
index 7a5ca3ae94..b57f2835ce 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
@@ -571,7 +571,7 @@ int CLineBuffer::DBWriteTokenFirst(HANDLE hContact, const CHAR* pszModule, const
CHAR c = *here;
*here = 0;
- iRet = DB::Setting::WriteAString(hContact, pszModule, pszSetting, (LPSTR)_pTok);
+ iRet = db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pTok);
*here = c;
}
_pTok = (*here == 0 || *here == '\n') ? NULL : ++here;
@@ -579,7 +579,7 @@ int CLineBuffer::DBWriteTokenFirst(HANDLE hContact, const CHAR* pszModule, const
}
}
}
- if (iRet) iRet = DB::Setting::Delete(hContact, pszModule, pszSetting);
+ if (iRet) iRet = db_unset(hContact, pszModule, pszSetting);
return iRet;
}
@@ -607,7 +607,7 @@ int CLineBuffer::DBWriteTokenNext(HANDLE hContact, const CHAR* pszModule, const
CHAR c = *here;
*here = 0;
- iRet = DB::Setting::WriteAString(hContact, pszModule, pszSetting, (LPSTR)_pTok);
+ iRet = db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pTok);
*here = c;
}
_pTok = (*here == 0 || *here == '\n') ? NULL : ++here;
@@ -615,7 +615,7 @@ int CLineBuffer::DBWriteTokenNext(HANDLE hContact, const CHAR* pszModule, const
}
}
}
- if (iRet) iRet = DB::Setting::Delete(hContact, pszModule, pszSetting);
+ if (iRet) iRet = db_unset(hContact, pszModule, pszSetting);
return iRet;
}
@@ -631,7 +631,7 @@ int CLineBuffer::DBWriteTokenNext(HANDLE hContact, const CHAR* pszModule, const
int CLineBuffer::DBWriteSettingString(HANDLE hContact, const CHAR* pszModule, const CHAR* pszSetting)
{
if (_pVal && _cbUsed > 0)
- return DB::Setting::WriteAString(hContact, pszModule, pszSetting, (LPSTR)_pVal);
+ return db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pVal);
return 1;
}
@@ -740,12 +740,12 @@ size_t CVCardFileVCF::packDB(const CHAR *pszModule, const CHAR *pszSetting, size
case DBVT_ASCIIZ:
{
size_t wAdd = _clVal + dbv.pszVal;
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
return wAdd;
}
default:
if (cbRew) (*cbRew)++;
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
break;
}
return 0;
@@ -783,14 +783,14 @@ size_t CVCardFileVCF::packDBList(const CHAR *pszModule, const CHAR *pszSetting,
case DBVT_UTF8:
case DBVT_ASCIIZ:
wAdd = _clVal + Translate(dbv.pszVal);
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
break;
case DBVT_DELETED:
wAdd = 0;
break;
default:
wAdd = 0;
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
break;
}
if (cbRew) *cbRew = wAdd ? 0 : *cbRew + 1;
@@ -1051,8 +1051,8 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf)
// gender
//
{
- BYTE gender = DB::Setting::GetByte(_hContact, USERINFO, SET_CONTACT_GENDER, 0);
- if (!gender) gender = DB::Setting::GetByte(_hContact, _pszBaseProto, SET_CONTACT_GENDER, 0);
+ BYTE gender = db_get_b(_hContact, USERINFO, SET_CONTACT_GENDER, 0);
+ if (!gender) gender = db_get_b(_hContact, _pszBaseProto, SET_CONTACT_GENDER, 0);
switch (gender) {
case 'F':
fputs("X-WAB-GENDER:1\n", _pFile);
@@ -1215,13 +1215,13 @@ BYTE CVCardFileVCF::Import()
memcpy(buf, _clVal.GetBuffer(), 4);
buf[4] = 0;
- DB::Setting::WriteWord(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHYEAR, (WORD)strtol(buf, NULL, 10));
+ db_set_w(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHYEAR, (WORD)strtol(buf, NULL, 10));
memcpy(buf, _clVal.GetBuffer() + 4, 2);
buf[2] = 0;
- DB::Setting::WriteByte(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHMONTH, (BYTE)strtol(buf, NULL, 10));
+ db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHMONTH, (BYTE)strtol(buf, NULL, 10));
memcpy(buf, _clVal.GetBuffer() + 6, 2);
buf[2] = 0;
- DB::Setting::WriteByte(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, (BYTE)strtol(buf, NULL, 10));
+ db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, (BYTE)strtol(buf, NULL, 10));
}
}
continue;
@@ -1339,10 +1339,9 @@ BYTE CVCardFileVCF::Import()
case 'X':
if (!strcmp(szEnt, "X-WAB-GENDER")) {
if (!strcmp(_clVal.GetBuffer(), "1"))
- DB::Setting::WriteByte(_hContact, USERINFO, SET_CONTACT_GENDER, 'F');
- else
- if (!strcmp(_clVal.GetBuffer(), "2"))
- DB::Setting::WriteByte(_hContact, USERINFO, SET_CONTACT_GENDER, 'M');
+ db_set_b(_hContact, USERINFO, SET_CONTACT_GENDER, 'F');
+ else if (!strcmp(_clVal.GetBuffer(), "2"))
+ db_set_b(_hContact, USERINFO, SET_CONTACT_GENDER, 'M');
}
continue;
}
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
index 9b211ce7ad..346723807b 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
@@ -35,7 +35,7 @@ INT_PTR CALLBACK DlgProc_DataHistory(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
{ ICO_BTN_EXPORT, BM_SETIMAGE, IDOK },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = DB::Setting::GetByte(SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
TranslateDialogDefault(hDlg);
@@ -151,9 +151,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName)
vContact.Export(xmlfile, &Modules);
}
// loop for all other contact
- for (hContact = DB::Contact::FindFirst();
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
switch (ExImContact->Typ)
{
diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp
index 1d8966691f..cd97189e16 100644
--- a/plugins/UserInfoEx/src/init.cpp
+++ b/plugins/UserInfoEx/src/init.cpp
@@ -97,7 +97,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
HookEvent( ME_CLIST_PREBUILDSTATUSMENU, (MIRANDAHOOK)RebuildAccount);
// install known modules strings to database
- DB::Setting::WriteAString(NULL, "KnownModules", MODULELONGNAME, USERINFO","MODNAME","MOD_MBIRTHDAY","MODNAMEFLAGS);
+ db_set_s(NULL, "KnownModules", MODULELONGNAME, USERINFO","MODNAME","MOD_MBIRTHDAY","MODNAMEFLAGS);
return 0;
}
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp
index 4dd9298a0b..dc31be814a 100644
--- a/plugins/UserInfoEx/src/mir_db.cpp
+++ b/plugins/UserInfoEx/src/mir_db.cpp
@@ -64,9 +64,9 @@ HANDLE Sub(HANDLE hMetaContact, int idx)
**/
BYTE IsSub(HANDLE hContact)
{
- return myGlobals.szMetaProto &&
- DB::Setting::GetByte(myGlobals.szMetaProto, "Enabled", TRUE) &&
- DB::Setting::GetByte(hContact, myGlobals.szMetaProto, "IsSubcontact", FALSE);
+ return myGlobals.szMetaProto &&
+ db_get_b(NULL, myGlobals.szMetaProto, "Enabled", TRUE) &&
+ db_get_b(hContact, myGlobals.szMetaProto, "IsSubcontact", FALSE);
}
/**
@@ -132,27 +132,6 @@ INT_PTR GetCount()
}
/**
- * This function searches the first contact in the database and returns its handle.
- * @retval HANDLE - handle of the next contact in the database
- * @retval NULL - no more contacts in the database
- **/
-HANDLE FindFirst()
-{
- return db_find_first();
-}
-
-/**
- * This function searches the next contact in the database and returns its handle.
- * @param hContact - handle to the contact
- * @retval HANDLE - handle of the next contact in the database
- * @retval NULL - no more contacts in the database
- **/
-HANDLE FindNext(HANDLE hContact)
-{
- return db_find_next(hContact);
-}
-
-/**
* Simply adds a new contact without setting up any protocol or something else
* @return HANDLE The function returns the HANDLE of the new contact
**/
@@ -210,12 +189,9 @@ namespace Module {
void Delete(HANDLE hContact, LPCSTR pszModule)
{
CEnumList Settings;
- if (!Settings.EnumSettings(hContact, pszModule)) {
- int i;
- for (i = 0; i < Settings.getCount(); i++) {
- DB::Setting::Delete(hContact, pszModule, Settings[i]);
- }
- }
+ if (!Settings.EnumSettings(hContact, pszModule))
+ for (int i = 0; i < Settings.getCount(); i++)
+ db_unset(hContact, pszModule, Settings[i]);
}
/**
@@ -265,9 +241,9 @@ BYTE IsMeta(LPCSTR pszModule)
* @retval TRUE - the module is empty
* @retval FALSE - the module contains settings
**/
-BYTE IsMetaAndScan (LPCSTR pszModule)
+BYTE IsMetaAndScan(LPCSTR pszModule)
{
- return DB::Setting::GetByte(SET_META_SCAN, TRUE) && IsMeta(pszModule);
+ return db_get_b(NULL, MODNAME, SET_META_SCAN, TRUE) && IsMeta(pszModule);
}
} /* namespace Module */
@@ -319,7 +295,7 @@ LPSTR GetAString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting)
if (DB::Variant::dbv2String(&dbv, DBVT_WCHAR) == 0) {
return dbv.pszVal;
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
return NULL;
}
@@ -339,7 +315,7 @@ LPWSTR GetWString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting)
if (DB::Variant::dbv2String(&dbv, DBVT_WCHAR) == 0) {
return dbv.pwszVal;
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
return NULL;
}
@@ -498,111 +474,6 @@ BYTE GetStatic(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPSTR pszVa
}
/**
- * This function reads a byte from the database. If required it converts it to a byte value
- * @param hContact - handle to the contact
- * @param pszModule - the module to read the setting from (e.g. USERINFO)
- * @param pszSetting - the setting to read
- * @param errorValue - value to return if something goes wrong
- *
- * @return byte value
- **/
-BYTE GetByte(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, BYTE errorValue)
-{
- DBVARIANT dbv;
- BYTE result;
- if (GetAsIs(hContact, pszModule, pszSetting, &dbv)) {
- result = errorValue;
- }
- else {
- switch (dbv.type) {
- case DBVT_BYTE:
- result = dbv.bVal;
- break;
- case DBVT_WORD:
- result = (dbv.wVal < 0x0100) ? (BYTE) dbv.wVal : errorValue;
- break;
- case DBVT_DWORD:
- result = (dbv.wVal < 0x00000100) ? (BYTE) dbv.dVal : errorValue;
- break;
- default:
- DB::Variant::Free(&dbv);
- result = errorValue;
- }
- }
- return result;
-}
-
-/**
- * This function reads a word from the database. If required it converts it to a word value
- * @param hContact - handle to the contact
- * @param pszModule - the module to read the setting from (e.g. USERINFO)
- * @param pszSetting - the setting to read
- * @param errorValue - value to return if something goes wrong
- *
- * @return word value
- **/
-WORD GetWord(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, WORD errorValue)
-{
- DBVARIANT dbv;
- WORD result;
- if (GetAsIs(hContact, pszModule, pszSetting, &dbv)) {
- result = errorValue;
- }
- else {
- switch (dbv.type) {
- case DBVT_BYTE:
- result = 0x00ff & dbv.bVal;
- break;
- case DBVT_WORD:
- result = dbv.wVal;
- break;
- case DBVT_DWORD:
- result = (dbv.wVal < 0x00010000) ? (WORD) dbv.dVal : errorValue;
- break;
- default:
- DB::Variant::Free(&dbv);
- result = errorValue;
- }
- }
- return result;
-}
-
-/**
- * This function reads a double word from the database. If required it converts it to a double word value
- * @param hContact - handle to the contact
- * @param pszModule - the module to read the setting from (e.g. USERINFO)
- * @param pszSetting - the setting to read
- * @param errorValue - value to return if something goes wrong
- *
- * @return double word value
- **/
-DWORD GetDWord(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DWORD errorValue)
-{
- DBVARIANT dbv;
- DWORD result;
- if (GetAsIs(hContact, pszModule, pszSetting, &dbv)) {
- result = errorValue;
- }
- else {
- switch (dbv.type) {
- case DBVT_BYTE:
- result = 0x000000ff & dbv.bVal;
- break;
- case DBVT_WORD:
- result = 0x0000ffff & dbv.wVal;
- break;
- case DBVT_DWORD:
- result = dbv.dVal;
- break;
- default:
- DB::Variant::Free(&dbv);
- result = errorValue;
- }
- }
- return result;
-}
-
-/**
* This function calls MS_DB_CONTACT_WRITESETTING to write a DBVARIANT structure to the database.
* @param hContact - handle to the contact
* @param pszModule - the module to read the setting from (e.g. USERINFO)
@@ -623,129 +494,6 @@ BYTE WriteVariant(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, const DB
}
/**
- * This function calls MS_DB_CONTACT_WRITESETTING to write a BYTE to the database.
- * @param hContact - handle to the contact
- * @param pszModule - the module to read the setting from (e.g. USERINFO)
- * @param pszSetting - the setting to write
- * @param value - the byte to store
- *
- * @retval 0 - success
- * @retval 1 - error
- **/
-BYTE WriteByte(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, BYTE value)
-{
- DBCONTACTWRITESETTING cws;
-
- cws.szModule = pszModule;
- cws.szSetting = pszSetting;
- cws.value.type = DBVT_BYTE;
- cws.value.bVal = value;
- return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM) hContact, (LPARAM) &cws) != 0;
-}
-
-/**
- * This function calls MS_DB_CONTACT_WRITESETTING to write a WORD to the database.
- * @param hContact - handle to the contact
- * @param pszModule - the module to read the setting from (e.g. USERINFO)
- * @param pszSetting - the setting to write
- * @param value - the word to store
- *
- * @retval 0 - success
- * @retval 1 - error
- **/
-BYTE WriteWord(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, WORD value)
-{
- DBCONTACTWRITESETTING cws;
-
- cws.szModule = pszModule;
- cws.szSetting = pszSetting;
- cws.value.type = DBVT_WORD;
- cws.value.wVal = value;
- return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM) hContact, (LPARAM) &cws) != 0;
-}
-
-/**
- * This function calls MS_DB_CONTACT_WRITESETTING to write a DWORD to the database.
- * @param hContact - handle to the contact
- * @param pszModule - the module to read the setting from (e.g. USERINFO)
- * @param pszSetting - the setting to write
- * @param value - the double word to store
- *
- * @retval 0 - success
- * @retval 1 - error
- **/
-BYTE WriteDWord(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DWORD value)
-{
- DBCONTACTWRITESETTING cws;
-
- cws.szModule = pszModule;
- cws.szSetting = pszSetting;
- cws.value.type = DBVT_DWORD;
- cws.value.dVal = value;
- return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM) hContact, (LPARAM) &cws) != 0;
-}
-
-/**
- * This function calls MS_DB_CONTACT_WRITESETTING to write an ansi string to the database.
- * @param hContact - handle to the contact
- * @param pszModule - the module to read the setting from (e.g. USERINFO)
- * @param pszSetting - the setting to write
- * @param value - the string to store
- *
- * @retval 0 - success
- * @retval 1 - error
- **/
-BYTE WriteAString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPSTR value)
-{
- DBCONTACTWRITESETTING cws;
- cws.szModule = pszModule;
- cws.szSetting = pszSetting;
- cws.value.type = DBVT_ASCIIZ;
- cws.value.pszVal = value;
- return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM) hContact, (LPARAM) &cws) != 0;
-}
-
-/**
- * This function calls MS_DB_CONTACT_WRITESETTING to write an unicode string to the database.
- * @param hContact - handle to the contact
- * @param pszModule - the module to read the setting from (e.g. USERINFO)
- * @param pszSetting - the setting to write
- * @param value - the string to store
- *
- * @retval 0 - success
- * @retval 1 - error
- **/
-BYTE WriteWString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPWSTR value)
-{
- DBCONTACTWRITESETTING cws;
- cws.szModule = pszModule;
- cws.szSetting = pszSetting;
- cws.value.type = DBVT_WCHAR;
- cws.value.pwszVal = value;
- return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM) hContact, (LPARAM) &cws) != 0;
-}
-
-/**
- * This function calls MS_DB_CONTACT_WRITESETTING to write an utf8 string to the database.
- * @param hContact - handle to the contact
- * @param pszModule - the module to read the setting from (e.g. USERINFO)
- * @param pszSetting - the setting to write
- * @param value - the string to store
- *
- * @retval 0 - success
- * @retval 1 - error
- **/
-BYTE WriteUString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPSTR value)
-{
- DBCONTACTWRITESETTING cws;
- cws.szModule = pszModule;
- cws.szSetting = pszSetting;
- cws.value.type = DBVT_UTF8;
- cws.value.pszVal = value;
- return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM) hContact, (LPARAM) &cws) != 0;
-}
-
-/**
* This function checks for the existence of the given setting in the database
* @param hContact - handle to the contact
* @param pszModule - the module to read the setting from (e.g. USERINFO)
@@ -775,23 +523,6 @@ BYTE Exists(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting)
}
/**
- * This function deletes the given setting from database
- * @param hContact - handle to the contact
- * @param pszModule - the module to read the setting from (e.g. USERINFO)
- * @param pszSetting - the setting to read
- *
- * @retval 0 - success
- * @retval 1 - failure
- **/
-BYTE Delete(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting)
-{
- DBCONTACTGETSETTING cgs;
- cgs.szModule = pszModule;
- cgs.szSetting = pszSetting;
- return CallService(MS_DB_CONTACT_DELETESETTING, (WPARAM) hContact, (LPARAM) &cgs) != 0;
-}
-
-/**
* This function deletes all reluctant settings of an setting array such as My-phoneXX.
* @param hContact - handle to the contact
* @param pszModule - the module to read the setting from (e.g. USERINFO)
@@ -806,18 +537,13 @@ void DeleteArray(HANDLE hContact, LPCSTR pszModule, LPCSTR pszFormat, int iStart
do {
mir_snprintf(pszSetting, MAXSETTING, pszFormat, iStart++);
}
- while (!DB::Setting::Delete(hContact, pszModule, pszSetting));
+ while (!db_unset(hContact, pszModule, pszSetting));
}
} /* namespace Setting */
namespace Variant {
-BYTE Free(DBVARIANT *dbv)
-{
- return CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM) dbv) != 0;
-}
-
/**
* This function converts a string value of the DBVARIANT to the destination type
* but keeps all other values as is.
@@ -1026,7 +752,7 @@ BYTE GetInfoWithData(HANDLE hEvent, DBEVENTINFO *dbei)
{
dbei->cbSize = sizeof(DBEVENTINFO);
if (!dbei->cbBlob) {
- INT_PTR size = BlobSizeOf(hEvent);
+ INT_PTR size = db_event_getBlobSize(hEvent);
dbei->cbBlob = (size != -1) ? (DWORD)size : 0;
}
if (dbei->cbBlob) {
@@ -1062,19 +788,6 @@ DWORD TimeOf(HANDLE hEvent)
}
/**
- * This function returns the number of bytes required to retrieve
- * binary data associated with the event.
- * @param hEvent - the handle of the event to get the number of bytes for
- *
- * @retval size of event data
- * @retval -1 if hEvent is invalid
- **/
-INT_PTR BlobSizeOf(HANDLE hEvent)
-{
- return db_event_getBlobSize(hEvent);
-}
-
-/**
* This function compares two DBEVENTINFO structures against each other.
* It compares the timestamp, eventType and module names.
* @param d1 - pointer to the first DBEVENTINFO structure
diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h
index 0eaa774687..be4248bebf 100644
--- a/plugins/UserInfoEx/src/mir_db.h
+++ b/plugins/UserInfoEx/src/mir_db.h
@@ -42,8 +42,6 @@ namespace Contact {
LPSTR Proto (HANDLE hContact);
INT_PTR GetCount ();
- HANDLE FindFirst ();
- HANDLE FindNext (HANDLE hContact);
HANDLE Add();
BYTE Delete (HANDLE hContact);
@@ -99,66 +97,11 @@ namespace Setting {
BYTE GetStatic (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPSTR szValue, int cchValue);
- BYTE GetByte (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, BYTE errorValue);
- static FORCEINLINE
- BYTE GetByte (LPCSTR pszModule, LPCSTR pszSetting, BYTE errorValue) { return GetByte(NULL, pszModule, pszSetting, errorValue); }
- static FORCEINLINE
- BYTE GetByte (LPCSTR pszSetting, BYTE errorValue) { return GetByte(MODNAME, pszSetting, errorValue); }
-
- WORD GetWord (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, WORD errorValue);
- static FORCEINLINE
- WORD GetWord (LPCSTR pszModule, LPCSTR pszSetting, WORD errorValue) { return GetWord(NULL, pszModule, pszSetting, errorValue); }
- static FORCEINLINE
- WORD GetWord (LPCSTR pszSetting, WORD errorValue) { return GetWord(MODNAME, pszSetting, errorValue); }
-
- DWORD GetDWord (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DWORD errorValue);
- static FORCEINLINE
- DWORD GetDWord (LPCSTR pszModule, LPCSTR pszSetting, DWORD errorValue) { return GetDWord(NULL, pszModule, pszSetting, errorValue); }
- static FORCEINLINE
- DWORD GetDWord (LPCSTR pszSetting, DWORD errorValue) { return GetDWord(MODNAME, pszSetting, errorValue); }
-
/**
* write values to the database.
**/
BYTE WriteVariant (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, const DBVARIANT *dbv);
- BYTE WriteByte (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, BYTE value);
- static FORCEINLINE
- BYTE WriteByte (LPCSTR pszModule, LPCSTR pszSetting, BYTE value) { return WriteByte(NULL, pszModule, pszSetting, value); }
- static FORCEINLINE
- BYTE WriteByte (LPCSTR pszSetting, BYTE value) { return WriteByte(MODNAME, pszSetting, value); }
-
- BYTE WriteWord (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, WORD value);
- static FORCEINLINE
- BYTE WriteWord (LPCSTR pszModule, LPCSTR pszSetting, WORD value) { return WriteWord(NULL, pszModule, pszSetting, value); }
- static FORCEINLINE
- BYTE WriteWord (LPCSTR pszSetting, WORD value) { return WriteWord(MODNAME, pszSetting, value); }
-
- BYTE WriteDWord (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DWORD value);
- static FORCEINLINE
- BYTE WriteDWord (LPCSTR pszModule, LPCSTR pszSetting, DWORD value) { return WriteDWord(NULL, pszModule, pszSetting, value); }
- static FORCEINLINE
- BYTE WriteDWord (LPCSTR pszSetting, DWORD value) { return WriteDWord(MODNAME, pszSetting, value); }
-
- BYTE WriteAString (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPSTR value);
- static FORCEINLINE
- BYTE WriteAString (LPCSTR pszModule, LPCSTR pszSetting, LPSTR value) { return WriteAString(NULL, pszModule, pszSetting, value); }
- static FORCEINLINE
- BYTE WriteAString (LPCSTR pszSetting, LPSTR value) { return WriteAString(MODNAME, pszSetting, value); }
-
- BYTE WriteWString (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPWSTR value);
- static FORCEINLINE
- BYTE WriteWString (LPCSTR pszModule, LPCSTR pszSetting, LPWSTR value) { return WriteWString(NULL, pszModule, pszSetting, value); }
- static FORCEINLINE
- BYTE WriteWString (LPCSTR pszSetting, LPWSTR value) { return WriteWString(MODNAME, pszSetting, value); }
-
- BYTE WriteUString (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPSTR value);
- static FORCEINLINE
- BYTE WriteUString (LPCSTR pszModule, LPCSTR pszSetting, LPSTR value) { return WriteUString(NULL, pszModule, pszSetting, value); }
- static FORCEINLINE
- BYTE WriteUString (LPCSTR pszSetting, LPSTR value) { return WriteUString(MODNAME, pszSetting, value); }
-
-
#define GetTString GetWString
#define GetTStringEx GetWStringEx
#define GetTStringCtrl GetWStringCtrl
@@ -169,7 +112,6 @@ namespace Setting {
* misc operations
**/
BYTE Exists (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting);
- BYTE Delete (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting);
void DeleteArray (HANDLE hContact, LPCSTR pszModule, LPCSTR pszFormat, int iStart);
} /* namespace Setting */
@@ -177,7 +119,6 @@ namespace Setting {
namespace Variant {
BYTE ConvertString (DBVARIANT* dbv, const BYTE destType);
BYTE dbv2String (DBVARIANT* dbv, const BYTE destType);
- BYTE Free (DBVARIANT* dbv);
} /* namespace Variant */
namespace Event {
@@ -185,7 +126,6 @@ namespace Event {
BYTE GetInfo (HANDLE hEvent, DBEVENTINFO *dbei);
BYTE GetInfoWithData(HANDLE hEvent, DBEVENTINFO *dbei);
DWORD GetTime (HANDLE hEvent);
- INT_PTR BlobSizeOf (HANDLE hEvent);
BYTE Exists (HANDLE hContact, HANDLE& hDbExistingEvent, DBEVENTINFO *dbei);
} /* namespace Events */
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp
index 4262ab7609..5b81b5071e 100644
--- a/plugins/UserInfoEx/src/mir_icolib.cpp
+++ b/plugins/UserInfoEx/src/mir_icolib.cpp
@@ -160,7 +160,7 @@ LPTSTR IcoLib_GetDefaultIconFileName()
**/
static void IcoLib_CheckIconPackVersion(LPTSTR szIconPack)
{
- if (DB::Setting::GetByte(SET_ICONS_CHECKFILEVERSION, TRUE))
+ if (db_get_b(NULL, MODNAME, SET_ICONS_CHECKFILEVERSION, TRUE))
{
if (szIconPack)
{
diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp
index 3777556d28..490eb8faab 100644
--- a/plugins/UserInfoEx/src/mir_menuitems.cpp
+++ b/plugins/UserInfoEx/src/mir_menuitems.cpp
@@ -76,10 +76,10 @@ void RebuildContact()
SvcHomepageRebuildMenu();
// load options
- flag = DB::Setting::GetByte(SET_MI_CONTACT, MCAS_NOTINITIATED);
+ flag = db_get_b(NULL, MODNAME, SET_MI_CONTACT, MCAS_NOTINITIATED);
if (flag == MCAS_NOTINITIATED){
flag = MCAS_EXIMPORT|TRUE;
- DB::Setting::WriteByte(SET_MI_CONTACT, flag);
+ db_set_b(NULL, MODNAME, SET_MI_CONTACT, flag);
}
// delete all MenuItems and set all bytes 0 to avoid problems
@@ -173,10 +173,10 @@ void RebuildMain()
static HGENMENU hMenuItem[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
// load options
- flag = DB::Setting::GetByte(SET_MI_MAIN, MCAS_NOTINITIATED);
+ flag = db_get_b(NULL, MODNAME, SET_MI_MAIN, MCAS_NOTINITIATED);
if (flag == MCAS_NOTINITIATED){
flag = MCAS_ALL|TRUE;
- DB::Setting::WriteByte(SET_MI_MAIN, flag);
+ db_set_b(NULL, MODNAME, SET_MI_MAIN, flag);
}
// delete all MenuItems and set all bytes 0 to avoid problems
@@ -253,8 +253,8 @@ void RebuildMain()
// reminder
{
const BYTE bRemindMenus =
- DB::Setting::GetByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) &&
- DB::Setting::GetByte(SET_REMIND_MENUENABLED, DEFVAL_REMIND_MENUENABLED);
+ db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) &&
+ db_get_b(NULL, MODNAME, SET_REMIND_MENUENABLED, DEFVAL_REMIND_MENUENABLED);
if (bRemindMenus) {
// make backup of each protocol based birthday
mi.pszService = MS_USERINFO_REMINDER_AGGRASIVEBACKUP;
@@ -311,10 +311,10 @@ void RebuildGroup()
static HGENMENU hMenuItem[3] = {NULL, NULL, NULL };
// load options
- flag = DB::Setting::GetByte(SET_MI_GROUP, MCAS_NOTINITIATED);
+ flag = db_get_b(NULL, MODNAME, SET_MI_GROUP, MCAS_NOTINITIATED);
if (flag == MCAS_NOTINITIATED){
flag = MCAS_EXIMPORT|TRUE;
- DB::Setting::WriteByte(SET_MI_GROUP, flag);
+ db_set_b(NULL, MODNAME, SET_MI_GROUP, flag);
}
// delete all MenuItems and set all bytes 0 to avoid problems
@@ -408,10 +408,10 @@ void RebuildSubGroup()
static HGENMENU hMenuItem[3] = {NULL, NULL, NULL };
// load options
- flag = DB::Setting::GetByte(SET_MI_SUBGROUP, MCAS_NOTINITIATED);
+ flag = db_get_b(NULL, MODNAME, SET_MI_SUBGROUP, MCAS_NOTINITIATED);
if (flag == MCAS_NOTINITIATED){
flag = MCAS_DISABLED|TRUE;
- DB::Setting::WriteByte(SET_MI_SUBGROUP, flag);
+ db_set_b(NULL, MODNAME, SET_MI_SUBGROUP, flag);
}
// delete all MenuItems and set all bytes 0 to avoid problems
@@ -530,10 +530,10 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam)
}
// load options
- flag = DB::Setting::GetByte(SET_MI_ACCOUNT, MCAS_NOTINITIATED);
+ flag = db_get_b(NULL, MODNAME, SET_MI_ACCOUNT, MCAS_NOTINITIATED);
if (flag == MCAS_NOTINITIATED){
flag = MCAS_EXIMPORT|TRUE;
- DB::Setting::WriteByte(SET_MI_ACCOUNT, flag);
+ db_set_b(NULL, MODNAME, SET_MI_ACCOUNT, flag);
}
// loop for all account names
diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp
index 1b58459737..8fea511a2a 100644
--- a/plugins/UserInfoEx/src/psp_anniversary.cpp
+++ b/plugins/UserInfoEx/src/psp_anniversary.cpp
@@ -44,7 +44,7 @@ static INT_PTR CALLBACK DlgProc_AnniversaryEditor(HWND hDlg, UINT uMsg, WPARAM w
SetUserData(hDlg, lParam);
// set icons
- if (DB::Setting::GetByte(SET_ICONS_BUTTONS, 1))
+ if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1))
{
SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
diff --git a/plugins/UserInfoEx/src/psp_general.cpp b/plugins/UserInfoEx/src/psp_general.cpp
index 4b82defd70..896b016c1c 100644
--- a/plugins/UserInfoEx/src/psp_general.cpp
+++ b/plugins/UserInfoEx/src/psp_general.cpp
@@ -98,13 +98,13 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
CheckDlgButton(hDlg, RADIO_FEMALE, (dbv.bVal == 'F'));
CheckDlgButton(hDlg, RADIO_MALE, (dbv.bVal == 'M'));
- bEnable = !hContact || Flags.B.hasCustom || !DB::Setting::GetByte(SET_PROPSHEET_PCBIREADONLY, 0);
+ bEnable = !hContact || Flags.B.hasCustom || !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0);
EnableWindow(GetDlgItem(hDlg, RADIO_FEMALE), bEnable);
EnableWindow(GetDlgItem(hDlg, RADIO_MALE), bEnable);
}
else
{
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
}
}
@@ -124,8 +124,10 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
? 'M'
: 0;
- if (gender) DB::Setting::WriteByte(hContact, hContact ? USERINFO : pszProto, SET_CONTACT_GENDER, gender);
- else DB::Setting::Delete(hContact, hContact ? USERINFO : pszProto, SET_CONTACT_GENDER);
+ if (gender)
+ db_set_b(hContact, hContact ? USERINFO : pszProto, SET_CONTACT_GENDER, gender);
+ else
+ db_unset(hContact, hContact ? USERINFO : pszProto, SET_CONTACT_GENDER);
}
}
break;
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index e47d87f5b6..76356d6316 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -158,7 +158,7 @@ static BYTE EnableControls(HWND hDlg, const int *idCtrl, int countCtrl, BYTE bEn
**/
static BYTE DBGetCheckBtn(HWND hDlg, const int idCtrl, LPCSTR pszSetting, BYTE bDefault)
{
- BYTE val = (DB::Setting::GetByte(pszSetting, bDefault) & 1) == 1;
+ BYTE val = (db_get_b(NULL, MODNAME, pszSetting, bDefault) & 1) == 1;
CheckDlgButton(hDlg, idCtrl, val);
return val;
}
@@ -176,9 +176,9 @@ static BYTE DBGetCheckBtn(HWND hDlg, const int idCtrl, LPCSTR pszSetting, BYTE b
static BYTE DBWriteCheckBtn(HWND hDlg, const int idCtrl, LPCSTR pszSetting)
{
BYTE val = IsDlgButtonChecked(hDlg, idCtrl);
- int Temp = DB::Setting::GetByte(pszSetting, 0);
+ int Temp = db_get_b(NULL, MODNAME, pszSetting, 0);
Temp &= ~1;
- DB::Setting::WriteByte(pszSetting, Temp |= val );
+ db_set_b(NULL, MODNAME, pszSetting, Temp |= val );
return val;
}
@@ -195,7 +195,7 @@ static BYTE DBWriteCheckBtn(HWND hDlg, const int idCtrl, LPCSTR pszSetting)
**/
static void DBGetColor(HWND hDlg, const int idCtrl, LPCSTR pszSetting, DWORD bDefault)
{
- SendDlgItemMessage(hDlg, idCtrl, CPM_SETCOLOUR, 0, DB::Setting::GetDWord(pszSetting, bDefault));
+ SendDlgItemMessage(hDlg, idCtrl, CPM_SETCOLOUR, 0, db_get_dw(NULL, MODNAME, pszSetting, bDefault));
}
/**
@@ -210,7 +210,7 @@ static void DBGetColor(HWND hDlg, const int idCtrl, LPCSTR pszSetting, DWORD bDe
**/
static void DBWriteColor(HWND hDlg, const int idCtrl, LPCSTR pszSetting)
{
- DB::Setting::WriteDWord(pszSetting, SendDlgItemMessage(hDlg, idCtrl, CPM_GETCOLOUR, 0, 0));
+ db_set_w(NULL, MODNAME, pszSetting, SendDlgItemMessage(hDlg, idCtrl, CPM_GETCOLOUR, 0, 0));
}
/**
@@ -232,9 +232,9 @@ static BYTE DBWriteEditByte(HWND hDlg, const int idCtrl, LPCSTR pszSetting, BYTE
BOOL t;
v = (BYTE)GetDlgItemInt(hDlg, idCtrl, &t, FALSE);
- if (t && (v != DB::Setting::GetByte(pszSetting, defVal)))
+ if (t && (v != db_get_b(NULL, MODNAME, pszSetting, defVal)))
{
- return DB::Setting::WriteByte(pszSetting, v) == 0;
+ return db_set_b(NULL, MODNAME, pszSetting, v) == 0;
}
return FALSE;
}
@@ -258,10 +258,9 @@ static BYTE DBWriteEditWord(HWND hDlg, const int idCtrl, LPCSTR pszSetting, WORD
BOOL t;
v = (WORD)GetDlgItemInt(hDlg, idCtrl, &t, FALSE);
- if (t && (v != DB::Setting::GetWord(pszSetting, defVal)))
- {
- return DB::Setting::WriteWord(pszSetting, v) == 0;
- }
+ if (t && (v != db_get_w(NULL, MODNAME, pszSetting, defVal)))
+ return db_set_w(NULL, MODNAME, pszSetting, v) == 0;
+
return FALSE;
}
@@ -283,9 +282,9 @@ static BYTE DBWriteComboByte(HWND hDlg, const int idCtrl, LPCSTR pszSetting, BYT
BYTE v;
v = (BYTE)SendDlgItemMessage(hDlg, idCtrl, CB_GETCURSEL, NULL, NULL);
- if (v != DB::Setting::GetByte(pszSetting, defVal))
+ if (v != db_get_b(NULL, MODNAME, pszSetting, defVal))
{
- return DB::Setting::WriteByte(pszSetting, v) == 0;
+ return db_set_b(NULL, MODNAME, pszSetting, v) == 0;
}
return FALSE;
}
@@ -328,7 +327,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam,
// menu item settings
for (int i = 0; i < SIZEOF(ctrl_Menu); i++) {
- int flag = DB::Setting::GetByte(ctrl_Menu[i].pszKey, 2);
+ int flag = db_get_b(NULL, MODNAME, ctrl_Menu[i].pszKey, 2);
// check button and enable / disable control
int idEnable[] = { ctrl_Menu[i].idCheckbox + 1, ctrl_Menu[i].idNONE, ctrl_Menu[i].idALL, ctrl_Menu[i].idEXIMPORT };
EnableControls(hDlg, idEnable, SIZEOF(idEnable), DBGetCheckBtn(hDlg, ctrl_Menu[i].idCheckbox, ctrl_Menu[i].pszKey,0));
@@ -362,7 +361,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam,
flag |= IsDlgButtonChecked(hDlg, ctrl_Menu[i].idNONE)? 2:0;
flag |= IsDlgButtonChecked(hDlg, ctrl_Menu[i].idALL)? 4:0;
flag |= IsDlgButtonChecked(hDlg, ctrl_Menu[i].idEXIMPORT)? 8:0;
- DB::Setting::WriteByte(ctrl_Menu[i].pszKey, (BYTE) flag);
+ db_set_b(NULL, MODNAME, ctrl_Menu[i].pszKey, (BYTE) flag);
}
RebuildMenu();
@@ -376,14 +375,14 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam,
valNew = IsDlgButtonChecked(hDlg, CHECK_OPT_FLAGSUNKNOWN);
if (gFlagsOpts.bUseUnknownFlag != valNew) {
gFlagsOpts.bUseUnknownFlag = valNew;
- DB::Setting::WriteByte(MODNAMEFLAGS,"UseUnknownFlag",valNew);
+ db_set_b(NULL, MODNAMEFLAGS, "UseUnknownFlag",valNew);
FlagsClistChange++;
FlagsMsgWndChange++;
}
valNew = IsDlgButtonChecked(hDlg, CHECK_OPT_FLAGSMSGSTATUS);
if (gFlagsOpts.bShowStatusIconFlag != valNew) {
gFlagsOpts.bShowStatusIconFlag = valNew;
- DB::Setting::WriteByte(MODNAMEFLAGS,"ShowStatusIconFlag",valNew);
+ db_set_b(NULL, MODNAMEFLAGS, "ShowStatusIconFlag",valNew);
FlagsMsgWndChange++;
}
@@ -400,7 +399,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam,
// misc
BYTE bEnabled = IsDlgButtonChecked(hDlg, CHECK_OPT_ZODIACAVATAR);
- DB::Setting::WriteByte(SET_ZODIAC_AVATARS, bEnabled);
+ db_set_b(NULL, MODNAME, SET_ZODIAC_AVATARS, bEnabled);
NServices::NAvatar::Enable(bEnabled);
}
break;
@@ -554,7 +553,7 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam
for (i = 0; i < Settings.getCount(); i++) {
s = Settings[i];
if (!mir_strnicmp(s, "UserInfoEx", 10)) {
- DB::Setting::Delete(NULL, "SkinIcons", s);
+ db_unset(NULL, "SkinIcons", s);
}
}
}
@@ -563,16 +562,16 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam
DB::Module::Delete(NULL, USERINFO"ExW");
// delete old contactsettings
- for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) {
- DB::Setting::Delete(hContact, USERINFO, "PListColWidth0");
- DB::Setting::Delete(hContact, USERINFO, "PListColWidth1");
- DB::Setting::Delete(hContact, USERINFO, "PListColWidth2");
- DB::Setting::Delete(hContact, USERINFO, "EMListColWidth0");
- DB::Setting::Delete(hContact, USERINFO, "EMListColWidth1");
- DB::Setting::Delete(hContact, USERINFO, "BirthRemind");
- DB::Setting::Delete(hContact, USERINFO, "RemindBirthday");
- DB::Setting::Delete(hContact, USERINFO, "RemindDaysErlier");
- DB::Setting::Delete(hContact, USERINFO, "vCardPath");
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ db_unset(hContact, USERINFO, "PListColWidth0");
+ db_unset(hContact, USERINFO, "PListColWidth1");
+ db_unset(hContact, USERINFO, "PListColWidth2");
+ db_unset(hContact, USERINFO, "EMListColWidth0");
+ db_unset(hContact, USERINFO, "EMListColWidth1");
+ db_unset(hContact, USERINFO, "BirthRemind");
+ db_unset(hContact, USERINFO, "RemindBirthday");
+ db_unset(hContact, USERINFO, "RemindDaysErlier");
+ db_unset(hContact, USERINFO, "vCardPath");
DB::Module::Delete(hContact, USERINFO"Ex");
DB::Module::Delete(hContact, USERINFO"ExW");
@@ -744,7 +743,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
BYTE bEnabled;
// set reminder options
- bEnabled = DB::Setting::GetByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
+ bEnabled = db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
SendDlgItemMessage(hDlg, EDIT_REMIND_ENABLED, CB_SETCURSEL, bEnabled, NULL);
DlgProc_ReminderOpts(hDlg, WM_COMMAND, MAKEWPARAM(EDIT_REMIND_ENABLED, CBN_SELCHANGE),
(LPARAM)GetDlgItem(hDlg, EDIT_REMIND_ENABLED));
@@ -755,11 +754,11 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
DBGetCheckBtn(hDlg, CHECK_REMIND_STARTUP, SET_REMIND_CHECKON_STARTUP, FALSE);
DBGetCheckBtn(hDlg, CHECK_REMIND_SECURED, SET_REMIND_SECUREBIRTHDAY, FALSE);
- SetDlgItemInt(hDlg, EDIT_REMIND, DB::Setting::GetWord(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), FALSE);
- SetDlgItemInt(hDlg, EDIT_REMIND_SOUNDOFFSET, DB::Setting::GetByte(SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), FALSE);
- SetDlgItemInt(hDlg, EDIT_REMIND2, DB::Setting::GetWord(NULL, MODNAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL), FALSE);
+ SetDlgItemInt(hDlg, EDIT_REMIND, db_get_w(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), FALSE);
+ SetDlgItemInt(hDlg, EDIT_REMIND_SOUNDOFFSET, db_get_b(NULL, MODNAME, SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), FALSE);
+ SetDlgItemInt(hDlg, EDIT_REMIND2, db_get_w(NULL, MODNAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL), FALSE);
- SendDlgItemMessage(hDlg, EDIT_BIRTHMODULE, CB_SETCURSEL, DB::Setting::GetByte(SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE), NULL);
+ SendDlgItemMessage(hDlg, EDIT_BIRTHMODULE, CB_SETCURSEL, db_get_b(NULL, MODNAME, SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE), NULL);
{
MTime mtLast;
TCHAR szTime[MAX_PATH];
@@ -792,7 +791,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
bReminderCheck = DBWriteEditWord(hDlg, EDIT_REMIND, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
// save primary birthday module
- BYTE bOld = DB::Setting::GetByte(SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE); // = 1
+ BYTE bOld = db_get_b(NULL, MODNAME, SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE); // = 1
BYTE bNew = (BYTE)ComboBox_GetCurSel(GetDlgItem(hDlg,EDIT_BIRTHMODULE));
if (bOld != bNew) {
//keep the database clean
@@ -800,19 +799,15 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
HANDLE hContact = NULL;
DBWriteComboByte(hDlg, EDIT_BIRTHMODULE, SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE);
//walk through all the contacts stored in the DB
- for (hContact = DB::Contact::FindFirst();
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
- {
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
mdb.DBMoveBirthDate(hContact,bOld,bNew);
- }
}
// update current reminder state
bNewVal = (BYTE)SendDlgItemMessage(hDlg, EDIT_REMIND_ENABLED, CB_GETCURSEL, NULL, NULL);
- if (DB::Setting::GetByte(SET_REMIND_ENABLED, 1) != bNewVal)
+ if (db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, 1) != bNewVal)
{
- DB::Setting::WriteByte(SET_REMIND_ENABLED, bNewVal);
+ db_set_b(NULL, MODNAME, SET_REMIND_ENABLED, bNewVal);
if (bNewVal == REMIND_OFF)
{
SvcReminderEnable(FALSE);
@@ -878,7 +873,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
WORD v;
v = (WORD)GetDlgItemInt(hDlg, LOWORD(wParam), &t, FALSE);
- if (t && (v != DB::Setting::GetWord(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET)))
+ if (t && (v != db_get_w(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET)))
{
NotifyParentOfChange(hDlg);
}
@@ -897,7 +892,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
BYTE v;
v = (BYTE)GetDlgItemInt(hDlg, LOWORD(wParam), &t, FALSE);
- if (t && (v != DB::Setting::GetByte(SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET)))
+ if (t && (v != db_get_b(NULL, MODNAME, SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET)))
{
NotifyParentOfChange(hDlg);
}
@@ -913,13 +908,9 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
if (bInitialized && HIWORD(wParam) == EN_UPDATE)
{
BOOL t;
- WORD v;
-
- v = (WORD)GetDlgItemInt(hDlg, LOWORD(wParam), &t, FALSE);
- if (t && (v != DB::Setting::GetWord(NULL, MODNAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL)))
- {
+ WORD v = (WORD)GetDlgItemInt(hDlg, LOWORD(wParam), &t, FALSE);
+ if (t && (v != db_get_w(NULL, MODNAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL)))
NotifyParentOfChange(hDlg);
- }
}
}
}
@@ -958,7 +949,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
EnableDlgItem(hDlg, CHECK_OPT_POPUP_MSGBOX, FALSE);
EnableDlgItem(hDlg, CHECK_OPT_POPUP_PROGRESS, FALSE);
}
- else if (!(DB::Setting::GetDWord(0, "Popup","Actions", 0) & 1)) {
+ else if (!(db_get_dw(0, "Popup","Actions", 0) & 1)) {
EnableDlgItem(hDlg, CHECK_OPT_POPUP_MSGBOX, FALSE);
}
@@ -969,7 +960,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
// set colortype checkboxes and color controls
DBGetColor(hDlg, CLR_BBACK, SET_POPUP_BIRTHDAY_COLOR_BACK, RGB(192, 180, 30));
DBGetColor(hDlg, CLR_BTEXT, SET_POPUP_BIRTHDAY_COLOR_TEXT, RGB(0, 0, 0));
- switch (DB::Setting::GetByte(SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM))
+ switch (db_get_b(NULL, MODNAME, SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM))
{
case POPUP_COLOR_DEFAULT:
{
@@ -985,7 +976,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
DBGetColor(hDlg, CLR_ABACK, SET_POPUP_ANNIVERSARY_COLOR_BACK, RGB(90, 190, 130));
DBGetColor(hDlg, CLR_ATEXT, SET_POPUP_ANNIVERSARY_COLOR_TEXT, RGB(0, 0, 0));
- switch (DB::Setting::GetByte(SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM))
+ switch (db_get_b(NULL, MODNAME, SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM))
{
case POPUP_COLOR_DEFAULT:
{
@@ -1004,7 +995,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(CHECK_OPT_POPUP_ADEFCLR, BN_CLICKED), NULL);
}
// set delay values
- bDelay = DB::Setting::GetByte(SET_POPUP_DELAY, 0);
+ bDelay = db_get_b(NULL, MODNAME, SET_POPUP_DELAY, 0);
switch (bDelay)
{
case 0:
@@ -1046,7 +1037,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
// save popup style for birthdays
DBWriteColor(hDlg, CLR_BBACK, SET_POPUP_BIRTHDAY_COLOR_BACK);
DBWriteColor(hDlg, CLR_BTEXT, SET_POPUP_BIRTHDAY_COLOR_TEXT);
- DB::Setting::WriteByte(SET_POPUP_BIRTHDAY_COLORTYPE,
+ db_set_b(NULL, MODNAME, SET_POPUP_BIRTHDAY_COLORTYPE,
SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_DEFCLR, BM_GETCHECK, NULL, NULL)
? POPUP_COLOR_DEFAULT
: SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_WINCLR, BM_GETCHECK, NULL, NULL)
@@ -1056,7 +1047,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
// save popup style for anniversaries
DBWriteColor(hDlg, CLR_ABACK, SET_POPUP_ANNIVERSARY_COLOR_BACK);
DBWriteColor(hDlg, CLR_ATEXT, SET_POPUP_ANNIVERSARY_COLOR_TEXT);
- DB::Setting::WriteByte(SET_POPUP_ANNIVERSARY_COLORTYPE,
+ db_set_b(NULL, MODNAME, SET_POPUP_ANNIVERSARY_COLORTYPE,
SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_ADEFCLR, BM_GETCHECK, NULL, NULL)
? POPUP_COLOR_DEFAULT
: SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_AWINCLR, BM_GETCHECK, NULL, NULL)
@@ -1066,17 +1057,17 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
// save delay
if (SendDlgItemMessage(hDlg, RADIO_OPT_POPUP_PERMANENT, BM_GETCHECK, NULL, NULL))
{
- DB::Setting::WriteByte(SET_POPUP_DELAY, 255);
+ db_set_b(NULL, MODNAME, SET_POPUP_DELAY, 255);
}
else if (SendDlgItemMessage(hDlg, RADIO_OPT_POPUP_CUSTOM, BM_GETCHECK, NULL, NULL))
{
TCHAR szDelay[4];
GetDlgItemText(hDlg, EDIT_DELAY, szDelay, SIZEOF(szDelay));
- DB::Setting::WriteByte(SET_POPUP_DELAY, (BYTE)_tcstol(szDelay, NULL, 10));
+ db_set_b(NULL, MODNAME, SET_POPUP_DELAY, (BYTE)_tcstol(szDelay, NULL, 10));
}
else
{
- DB::Setting::Delete(NULL, MODNAME, SET_POPUP_DELAY);
+ db_unset(NULL, MODNAME, SET_POPUP_DELAY);
}
}
}
@@ -1088,7 +1079,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
case BTN_PREVIEW:
{
POPUPDATAT ppd = { 0 };
- ppd.iSeconds = (int)DB::Setting::GetByte(SET_POPUP_DELAY, 0);
+ ppd.iSeconds = (int)db_get_b(NULL, MODNAME, SET_POPUP_DELAY, 0);
mir_tcsncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
// Birthday
diff --git a/plugins/UserInfoEx/src/psp_origin.cpp b/plugins/UserInfoEx/src/psp_origin.cpp
index 7980af97f6..979a574747 100644
--- a/plugins/UserInfoEx/src/psp_origin.cpp
+++ b/plugins/UserInfoEx/src/psp_origin.cpp
@@ -91,7 +91,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
{
DWORD dwStamp;
- dwStamp = DB::Contact::WhenAdded(DB::Setting::GetDWord(hContact, pszProto, "UIN", 0), pszProto);
+ dwStamp = DB::Contact::WhenAdded(db_get_dw(hContact, pszProto, "UIN", 0), pszProto);
if (dwStamp > 0)
{
mt.FromStampAsUTC(dwStamp);
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp
index 872f7ea9ea..f0e2084f16 100644
--- a/plugins/UserInfoEx/src/psp_profile.cpp
+++ b/plugins/UserInfoEx/src/psp_profile.cpp
@@ -502,8 +502,8 @@ static int ProfileList_AddItemlistFromDB(
DB::Setting::GetAString(hContact, pszModule, pszSetting, &dbvCat);
// create the itemobject
if (!(pItem = (LPLCITEM)mir_alloc(sizeof(LCITEM)))) {
- DB::Variant::Free(&dbvCat);
- DB::Variant::Free(&dbvVal);
+ db_free(&dbvCat);
+ db_free(&dbvVal);
break;
}
// fill item struct
@@ -544,12 +544,12 @@ static int ProfileList_AddItemlistFromDB(
// item not found in the predefined category list?
if ((idList == NULL || j == nList) && dbvCat.type == DBVT_ASCIIZ) {
pItem->pszText[0] = mir_a2t(dbvCat.pszVal);
- DB::Variant::Free(&dbvCat);
+ db_free(&dbvCat);
}
if ((lvi.iItem = ListView_InsertItem(pList->hList, &lvi)) < 0) {
mir_free(pItem);
- DB::Variant::Free(&dbvCat);
- DB::Variant::Free(&dbvVal);
+ db_free(&dbvCat);
+ db_free(&dbvVal);
break;
}
lvi.iItem++;
@@ -1228,16 +1228,16 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
continue;
if (!(pItem->wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA))) {
mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szValFmt, iItem);
- DB::Setting::WriteTString(hContact, pszModule, pszSetting, pItem->pszText[1]);
+ db_set_ts(hContact, pszModule, pszSetting, pItem->pszText[1]);
// save category
mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szCatFmt, iItem);
if (pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount)
- DB::Setting::WriteAString(hContact, pszModule, pszSetting, (LPSTR)pItem->idstrList[pItem->iListItem].pszText);
+ db_set_s(hContact, pszModule, pszSetting, (LPSTR)pItem->idstrList[pItem->iListItem].pszText);
else
if (pItem->pszText[0] && *pItem->pszText[0])
- DB::Setting::WriteTString(hContact, pszModule, pszSetting, (LPTSTR)pItem->pszText[0]);
+ db_set_ts(hContact, pszModule, pszSetting, (LPTSTR)pItem->pszText[0]);
else
- DB::Setting::Delete(hContact, pszModule, pszSetting);
+ db_unset(hContact, pszModule, pszSetting);
// redraw the item if required
if (pItem->wFlags & CTRLF_CHANGED) {
pItem->wFlags &= ~CTRLF_CHANGED;
diff --git a/plugins/UserInfoEx/src/svc_avatar.cpp b/plugins/UserInfoEx/src/svc_avatar.cpp
index cdf94288cc..abccecb80e 100644
--- a/plugins/UserInfoEx/src/svc_avatar.cpp
+++ b/plugins/UserInfoEx/src/svc_avatar.cpp
@@ -70,41 +70,22 @@ namespace NServices
//GetIconInfo(zodiac.hIcon, &iinfo);
// save the bitmap to a file used as avatar later
- //if (!SaveBitmapAsAvatar(iinfo.hbmColor, szFileName))
- {
- if (!CallService(MS_AV_SETAVATAR, (WPARAM)hContact, (LPARAM)szFileName))
- {
- DB::Setting::WriteByte(hContact, "ContactPhoto", "IsZodiac", 1);
- }
- }
+ if (!CallService(MS_AV_SETAVATAR, (WPARAM)hContact, (LPARAM)szFileName))
+ db_set_b(hContact, "ContactPhoto", "IsZodiac", 1);
}
}
}
void DeleteAvatar(HANDLE hContact)
{
- if (hContact && DB::Setting::GetByte(hContact, "ContactPhoto", "IsZodiac", FALSE))
+ if (hContact && db_get_b(hContact, "ContactPhoto", "IsZodiac", FALSE))
{
- //AVATARCACHEENTRY *ace;
- LPSTR szProto = DB::Contact::Proto(hContact);
-
- DB::Setting::Delete(hContact, "ContactPhoto", "File");
- DB::Setting::Delete(hContact, "ContactPhoto", "RFile");
- DB::Setting::Delete(hContact, "ContactPhoto", "Backup");
- DB::Setting::Delete(hContact, "ContactPhoto", "ImageHash");
+ db_unset(hContact, "ContactPhoto", "File");
+ db_unset(hContact, "ContactPhoto", "RFile");
+ db_unset(hContact, "ContactPhoto", "Backup");
+ db_unset(hContact, "ContactPhoto", "ImageHash");
- DB::Setting::WriteByte(hContact, "ContactPhoto", "IsZodiac", 0);
-
- /*
- ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETMYAVATAR, NULL, (LPARAM)szProto);
- if (ace)
- {
- if (!CallService(MS_AV_SETAVATAR, (WPARAM)hContact, (LPARAM)ace->szFilename))
- {
- DB::Setting::WriteByte(hContact, "ContactPhoto", "IsZodiac", 0);
- }
- }
- */
+ db_set_b(hContact, "ContactPhoto", "IsZodiac", 0);
}
}
@@ -125,15 +106,10 @@ namespace NServices
// set zodiac as avatar either if the desired avatar is invalid or a general protocol picture
((ace->dwFlags & AVS_PROTOPIC) || !(ace->dwFlags & AVS_BITMAP_VALID)))
{
- if (!DB::Setting::GetByte(hContact, "ContactPhoto", "IsZodiac", 0))
- {
+ if (!db_get_b(hContact, "ContactPhoto", "IsZodiac", 0))
SetZodiacAvatar(hContact);
- }
- }
- else
- {
- DB::Setting::WriteByte(hContact, "ContactPhoto", "IsZodiac", 0);
}
+ else db_set_b(hContact, "ContactPhoto", "IsZodiac", 0);
}
// avatar was deleted, so we can set up a zodiac avatar
@@ -158,12 +134,10 @@ namespace NServices
{
//walk through all the contacts stored in the DB
- for (hContact = DB::Contact::FindFirst();
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
// don't set if avatar is locked!
- if (!DB::Setting::GetByte(hContact, "ContactPhoto", "Locked", 0))
+ if (!db_get_b(hContact, "ContactPhoto", "Locked", 0))
{
BYTE bInvalidAvatar = TRUE;
@@ -182,7 +156,7 @@ namespace NServices
fclose(f);
}
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
// the absolute file is valid
@@ -193,7 +167,7 @@ namespace NServices
bInvalidAvatar = FALSE;
fclose(f);
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
// set the zodiac as avatar
@@ -210,12 +184,8 @@ namespace NServices
ghChangedHook = NULL;
//walk through all the contacts stored in the DB
- for (hContact = DB::Contact::FindFirst();
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
- {
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
DeleteAvatar(hContact);
- }
}
}
@@ -228,7 +198,7 @@ namespace NServices
**/
void OnModulesLoaded()
{
- Enable(DB::Setting::GetByte(SET_ZODIAC_AVATARS, FALSE));
+ Enable(db_get_b(NULL, MODNAME, SET_ZODIAC_AVATARS, FALSE));
}
} /* namespace NAvatar */
diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp
index a29d2e2b33..43f1522e8e 100644
--- a/plugins/UserInfoEx/src/svc_contactinfo.cpp
+++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp
@@ -92,7 +92,7 @@ static FORCEINLINE INT_PTR GCIVar(CONTACTINFO *ci, LPCSTR pszSetting)
if (DB::Setting::Get(ci->hContact, ci->szProto, pszSetting, &dbv, CI_TCHAR(ci)) == 0) {
if (VarToVarCI(&dbv, ci)) {
// On a error, we need to make sure, read data is cleared out!
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
}
else {
@@ -122,7 +122,7 @@ static FORCEINLINE INT_PTR GCIVarEx(CONTACTINFO *ci, LPCSTR pszSetting)
if (DB::Setting::GetEx(ci->hContact, USERINFO, ci->szProto, pszSetting, &dbv, CI_TCHAR(ci)) == 0) {
if (VarToVarCI(&dbv, ci)) {
// On a error, we need to make sure, read data is cleared out!
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
}
else {
@@ -200,7 +200,7 @@ static FORCEINLINE INT_PTR GCIStr(CONTACTINFO *ci, LPCSTR pszSetting)
ci->pszVal = dbv.ptszVal;
}
else {
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
ci->pszVal = NULL;
}
}
@@ -248,26 +248,26 @@ static FORCEINLINE INT_PTR GCIFirstLast(CONTACTINFO *ci)
{
mir_snwprintf((LPWSTR) ci->pszVal, cbf + cbl + 2, L"%s %s", dbvf.pwszVal, dbvl.pwszVal);
}
- DB::Variant::Free(&dbvf);
- DB::Variant::Free(&dbvl);
+ db_free(&dbvf);
+ db_free(&dbvl);
}
// set firstname as result
else if (dbvf.type == DBVT_WCHAR)
{
ci->pszVal = (LPTSTR) dbvf.pwszVal;
- DB::Variant::Free(&dbvl);
+ db_free(&dbvl);
}
// set lastname as result
else if (dbvl.type == DBVT_WCHAR)
{
ci->pszVal = (LPTSTR) dbvl.pwszVal;
- DB::Variant::Free(&dbvf);
+ db_free(&dbvf);
}
else
{
ci->pszVal = NULL;
- DB::Variant::Free(&dbvf);
- DB::Variant::Free(&dbvl);
+ db_free(&dbvf);
+ db_free(&dbvl);
}
}
else
@@ -283,26 +283,26 @@ static FORCEINLINE INT_PTR GCIFirstLast(CONTACTINFO *ci)
{
mir_snprintf((LPSTR) ci->pszVal, cbf + cbl + 2, "%s %s", dbvf.pszVal, dbvl.pszVal);
}
- DB::Variant::Free(&dbvf);
- DB::Variant::Free(&dbvl);
+ db_free(&dbvf);
+ db_free(&dbvl);
}
// set firstname as result
else if (dbvf.type == DBVT_ASCIIZ)
{
ci->pszVal = (LPTSTR) dbvf.pszVal;
- DB::Variant::Free(&dbvl);
+ db_free(&dbvl);
}
// set lastname as result
else if (dbvl.type == DBVT_ASCIIZ)
{
ci->pszVal = (LPTSTR) dbvl.pszVal;
- DB::Variant::Free(&dbvf);
+ db_free(&dbvf);
}
else
{
ci->pszVal = NULL;
- DB::Variant::Free(&dbvf);
- DB::Variant::Free(&dbvl);
+ db_free(&dbvf);
+ db_free(&dbvl);
}
}
ci->type = (ci->pszVal != NULL) ? CNFT_ASCIIZ : 0;
@@ -776,7 +776,7 @@ void SvcContactInfoLoadModule()
}
else {
memcpy(gNameOrder, dbv.pbVal, dbv.cpbVal);
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanged);
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp
index 105d7f2c68..bcc452c628 100644
--- a/plugins/UserInfoEx/src/svc_email.cpp
+++ b/plugins/UserInfoEx/src/svc_email.cpp
@@ -189,7 +189,7 @@ void SvcEMailRebuildMenu()
{
static HANDLE hPrebuildMenuHook = NULL;
- if (DB::Setting::GetByte(SET_EXTENDED_EMAILSERVICE, TRUE))
+ if (db_get_b(NULL, MODNAME, SET_EXTENDED_EMAILSERVICE, TRUE))
{
if (!hPrebuildMenuHook)
{
@@ -230,13 +230,9 @@ void SvcEMailRebuildMenu()
**/
void SvcEMailApplyCListIcons()
{
- HANDLE hContact;
-
//walk through all the contacts stored in the DB
- for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact))
- {
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
OnCListApplyIcons((WPARAM)hContact, 0);
- }
}
/**
@@ -248,7 +244,7 @@ void SvcEMailApplyCListIcons()
void SvcEMailEnableExtraIcons(BYTE bEnable, BYTE bUpdateDB)
{
if (bUpdateDB)
- DB::Setting::WriteByte(SET_CLIST_EXTRAICON_EMAIL, bEnable);
+ db_set_b(NULL, MODNAME, SET_CLIST_EXTRAICON_EMAIL, bEnable);
if (bEnable) { // E-mail checkt
// hook events
@@ -284,7 +280,7 @@ void SvcEMailEnableExtraIcons(BYTE bEnable, BYTE bUpdateDB)
void SvcEMailOnModulesLoaded()
{
SvcEMailEnableExtraIcons(
- DB::Setting::GetByte(SET_CLIST_EXTRAICON_EMAIL,
+ db_get_b(NULL, MODNAME, SET_CLIST_EXTRAICON_EMAIL,
DEFVAL_CLIST_EXTRAICON_EMAIL), FALSE);
}
@@ -293,7 +289,7 @@ void SvcEMailOnModulesLoaded()
**/
void SvcEMailLoadModule()
{
- if (DB::Setting::GetByte(SET_EXTENDED_EMAILSERVICE, TRUE)) {
+ if (db_get_b(NULL, MODNAME, SET_EXTENDED_EMAILSERVICE, TRUE)) {
// create own email send command
if (!myDestroyServiceFunction(MS_EMAIL_SENDEMAIL))
CreateServiceFunction(MS_EMAIL_SENDEMAIL, MenuCommand);
diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp
index 7178000293..a8bcf8d5bf 100644
--- a/plugins/UserInfoEx/src/svc_gender.cpp
+++ b/plugins/UserInfoEx/src/svc_gender.cpp
@@ -40,7 +40,7 @@ BYTE GenderOf(HANDLE hContact, LPCSTR pszProto)
{
return dbv.bVal;
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -110,13 +110,9 @@ static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw
**/
void SvcGenderApplyCListIcons()
{
- HANDLE hContact;
-
//walk through all the contacts stored in the DB
- for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact))
- {
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
OnCListApplyIcons(hContact, 0);
- }
}
/**
@@ -130,7 +126,7 @@ void SvcGenderEnableExtraIcons(BYTE bColumn, BYTE bUpdateDB)
bool bEnable = (bColumn!=((BYTE)-1));
if (bUpdateDB)
- DB::Setting::WriteByte(SET_CLIST_EXTRAICON_GENDER2, bColumn);
+ db_set_b(NULL, MODNAME, SET_CLIST_EXTRAICON_GENDER2, bColumn);
if (bEnable) { // Gender checkt or dropdown select
if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
@@ -165,7 +161,7 @@ void SvcGenderEnableExtraIcons(BYTE bColumn, BYTE bUpdateDB)
**/
void SvcGenderLoadModule()
{
- SvcGenderEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER2, 0), FALSE);
+ SvcGenderEnableExtraIcons(db_get_b(NULL, MODNAME, SET_CLIST_EXTRAICON_GENDER2, 0), FALSE);
}
/**
diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp
index 9ed2639af1..45e0b8330c 100644
--- a/plugins/UserInfoEx/src/svc_homepage.cpp
+++ b/plugins/UserInfoEx/src/svc_homepage.cpp
@@ -176,13 +176,9 @@ void SvcHomepageRebuildMenu()
**/
void SvcHomepageApplyCListIcons()
{
- HANDLE hContact;
-
//walk through all the contacts stored in the DB
- for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact))
- {
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
OnCListApplyIcons(hContact, 0);
- }
}
/**
@@ -194,7 +190,7 @@ void SvcHomepageApplyCListIcons()
void SvcHomepageEnableExtraIcons(BYTE bEnable, BYTE bUpdateDB)
{
if (bUpdateDB)
- DB::Setting::WriteByte(SET_CLIST_EXTRAICON_HOMEPAGE, bEnable);
+ db_set_b(NULL, MODNAME, SET_CLIST_EXTRAICON_HOMEPAGE, bEnable);
if (bEnable) {
// hook events
@@ -234,7 +230,7 @@ void SvcHomepageLoadModule()
{
CreateServiceFunction(MS_USERINFO_HOMEPAGE_OPENURL, MenuCommand);
SvcHomepageEnableExtraIcons(
- DB::Setting::GetByte(SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE), FALSE);
+ db_get_b(NULL, MODNAME, SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE), FALSE);
}
/**
diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp
index 11708b0bc7..a5d0aefb13 100644
--- a/plugins/UserInfoEx/src/svc_phone.cpp
+++ b/plugins/UserInfoEx/src/svc_phone.cpp
@@ -136,13 +136,9 @@ static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw
**/
void SvcPhoneApplyCListIcons()
{
- HANDLE hContact;
-
//walk through all the contacts stored in the DB
- for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact))
- {
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
OnCListApplyIcons(hContact, 0);
- }
}
/**
@@ -154,7 +150,7 @@ void SvcPhoneApplyCListIcons()
void SvcPhoneEnableExtraIcons(BYTE bEnable, BYTE bUpdateDB)
{
if (bUpdateDB)
- DB::Setting::WriteByte(SET_CLIST_EXTRAICON_PHONE, bEnable);
+ db_set_b(NULL, MODNAME, SET_CLIST_EXTRAICON_PHONE, bEnable);
// force module enabled, if extraicon plugin was found
if (bEnable) {
@@ -191,7 +187,7 @@ void SvcPhoneEnableExtraIcons(BYTE bEnable, BYTE bUpdateDB)
void SvcPhoneLoadModule()
{
SvcPhoneEnableExtraIcons(
- DB::Setting::GetByte(SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE), FALSE);
+ db_get_b(NULL, MODNAME, SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE), FALSE);
}
/**
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp
index 1224c8f9ec..ac9cf0d28f 100644
--- a/plugins/UserInfoEx/src/svc_refreshci.cpp
+++ b/plugins/UserInfoEx/src/svc_refreshci.cpp
@@ -242,7 +242,7 @@ class CDlgUpdProgress : public CUpdProgress
{ ICO_BTN_DOWNARROW, BM_SETIMAGE, IDSKIP },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- IcoLib_SetCtrlIcons(hWnd, idIcon, DB::Setting::GetByte(SET_ICONS_BUTTONS, 1) ? 2 : 1);
+ IcoLib_SetCtrlIcons(hWnd, idIcon, db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? 2 : 1);
SendDlgItemMessage(hWnd, IDCANCEL, BUTTONTRANSLATE, NULL, NULL);
SendDlgItemMessage(hWnd, IDSKIP, BUTTONTRANSLATE, NULL, NULL);
@@ -397,7 +397,7 @@ public:
: CUpdProgress(data)
{
_szText = NULL;
- _bBBCode = DB::Setting::GetByte("Popup", "UseMText", FALSE);
+ _bBBCode = db_get_b(NULL, "Popup", "UseMText", FALSE);
_popupButtons[0].cbSize = sizeof(POPUPACTION);
_popupButtons[0].flags = PAF_ENABLED;
@@ -706,21 +706,15 @@ public:
**/
void RefreshAll()
{
- HANDLE hContact;
- int iWait;
+ int iWait = 100;
- for (hContact = DB::Contact::FindFirst(), iWait = 100;
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
- {
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
if (QueueAddRefreshContact(hContact, iWait))
- {
iWait += 5000;
- }
- }
+
if (Size() && !_pProgress)
{
- if (ServiceExists(MS_POPUP_CHANGETEXTT) && DB::Setting::GetByte("PopupProgress", FALSE))
+ if (ServiceExists(MS_POPUP_CHANGETEXTT) && db_get_b(NULL, MODNAME, "PopupProgress", FALSE))
{
_pProgress = new CPopupUpdProgress(this);
}
@@ -846,9 +840,7 @@ static int OnContactAdded(WPARAM wParam, LPARAM lParam)
{
try
{
- DWORD dwStmp;
-
- dwStmp = DB::Setting::GetDWord((HANDLE)wParam, USERINFO, SET_CONTACT_ADDEDTIME, 0);
+ DWORD dwStmp = db_get_dw((HANDLE)wParam, USERINFO, SET_CONTACT_ADDEDTIME, 0);
if (!dwStmp)
{
MTime mt;
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index a52b513c3d..7bdd777281 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -251,7 +251,7 @@ static int NotifyWithPopup(HANDLE hContact, CEvent::EType eventType, int DaysToA
{
POPUPDATAT ppd = { 0 };
ppd.PluginWindowProc = PopupWindowProc;
- ppd.iSeconds = (int)DB::Setting::GetByte(SET_POPUP_DELAY, 0);
+ ppd.iSeconds = (int)db_get_b(NULL, MODNAME, SET_POPUP_DELAY, 0);
if (hContact) {
ppd.lchContact = hContact;
@@ -266,29 +266,29 @@ static int NotifyWithPopup(HANDLE hContact, CEvent::EType eventType, int DaysToA
switch (eventType) {
case CEvent::BIRTHDAY:
- switch (DB::Setting::GetByte(SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
+ switch (db_get_b(NULL, MODNAME, SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
case POPUP_COLOR_WINDOWS:
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
break;
case POPUP_COLOR_CUSTOM:
- ppd.colorBack = DB::Setting::GetDWord(SET_POPUP_BIRTHDAY_COLOR_BACK, RGB(192,180,30));
- ppd.colorText = DB::Setting::GetDWord(SET_POPUP_BIRTHDAY_COLOR_TEXT, 0);
+ ppd.colorBack = db_get_dw(NULL, MODNAME, SET_POPUP_BIRTHDAY_COLOR_BACK, RGB(192,180,30));
+ ppd.colorText = db_get_dw(NULL, MODNAME, SET_POPUP_BIRTHDAY_COLOR_TEXT, 0);
break;
}
break;
case CEvent::ANNIVERSARY:
- switch (DB::Setting::GetByte(SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
+ switch (db_get_b(NULL, MODNAME, SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
case POPUP_COLOR_WINDOWS:
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
break;
case POPUP_COLOR_CUSTOM:
- ppd.colorBack = DB::Setting::GetDWord(SET_POPUP_ANNIVERSARY_COLOR_BACK, RGB(90, 190, 130));
- ppd.colorText = DB::Setting::GetDWord(SET_POPUP_ANNIVERSARY_COLOR_TEXT, 0);
+ ppd.colorBack = db_get_dw(NULL, MODNAME, SET_POPUP_ANNIVERSARY_COLOR_BACK, RGB(90, 190, 130));
+ ppd.colorText = db_get_dw(NULL, MODNAME, SET_POPUP_ANNIVERSARY_COLOR_TEXT, 0);
break;
}
}
@@ -362,7 +362,7 @@ static void NotifyFlashCListIcon(HANDLE hContact, const CEvent &evt)
**/
static BYTE NotifyWithSound(const CEvent &evt)
{
- if (evt._wDaysLeft <= min(DB::Setting::GetByte(SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), gRemindOpts.wDaysEarlier))
+ if (evt._wDaysLeft <= min(db_get_b(NULL, MODNAME, SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), gRemindOpts.wDaysEarlier))
{
switch (evt._eType)
{
@@ -520,7 +520,7 @@ static BYTE CheckBirthday(HANDLE hContact, MTime &Now, CEvent &evt, BYTE bNotify
mtb.DBGetReminderOpts(hContact);
// make backup of each protocol based birthday
- if (DB::Setting::GetByte(SET_REMIND_SECUREBIRTHDAY, TRUE))
+ if (db_get_b(NULL, MODNAME, SET_REMIND_SECUREBIRTHDAY, TRUE))
{
mtb.BackupBirthday(hContact, NULL, 0, LastAnwer);
}
@@ -601,7 +601,7 @@ static void CheckContact(HANDLE hContact, MTime &Now, CEvent &evt, BYTE bNotify,
{
// ignore meta subcontacts here as their birthday information are collected explicitly
if (hContact &&
- (!gRemindOpts.bCheckVisibleOnly || !DB::Setting::GetByte(hContact, MOD_CLIST, "Hidden", FALSE)) &&
+ (!gRemindOpts.bCheckVisibleOnly || !db_get_b(hContact, MOD_CLIST, "Hidden", FALSE)) &&
(!DB::MetaContact::IsSub(hContact)))
{
CEvent ca;
@@ -631,7 +631,6 @@ void SvcReminderCheckAll(const ENotify notify)
{
if (gRemindOpts.RemindState != REMIND_OFF)
{
- HANDLE hContact;
CEvent evt;
MTime now;
WORD a1 = 0;
@@ -639,12 +638,8 @@ void SvcReminderCheckAll(const ENotify notify)
now.GetLocalTime();
//walk through all the contacts stored in the DB
- for (hContact = DB::Contact::FindFirst();
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
- {
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
CheckContact(hContact, now, evt, notify != NOTIFY_CLIST, &a1);
- }
if (notify != NOTIFY_CLIST)
{
@@ -652,15 +647,11 @@ void SvcReminderCheckAll(const ENotify notify)
NotifyWithSound(evt);
// popup anniversary list
- if (DB::Setting::GetByte(SET_ANNIVLIST_POPUP, FALSE))
- {
+ if (db_get_b(NULL, MODNAME, SET_ANNIVLIST_POPUP, FALSE))
DlgAnniversaryListShow(0, 0);
- }
if (evt._wDaysLeft > gRemindOpts.wDaysEarlier && notify == NOTIFY_NOANNIV)
- {
NotifyWithPopup(NULL, CEvent::NONE, 0, NULL, TranslateT("No anniversaries to remind of"));
- }
}
UpdateTimer(FALSE);
}
@@ -809,30 +800,22 @@ static INT_PTR CheckService(WPARAM, LPARAM)
**/
static INT_PTR BackupBirthdayService(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = (HANDLE)wParam;
+ HANDLE hContact = (HANDLE)wParam;
MAnnivDate mdb;
if (hContact)
{
if (!mdb.DBGetBirthDate(hContact))
- {
mdb.BackupBirthday(hContact, NULL, TRUE);
- }
}
else
{
WORD a1 = 0;
//walk through all the contacts stored in the DB
- for (hContact = DB::Contact::FindFirst();
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
- {
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
if (!DB::MetaContact::IsSub(hContact) && !mdb.DBGetBirthDate(hContact))
- {
mdb.BackupBirthday(hContact, NULL, TRUE, &a1);
- }
- }
}
if (lParam != TRUE)
@@ -859,7 +842,7 @@ static INT_PTR BackupBirthdayService(WPARAM wParam, LPARAM lParam)
**/
LPCSTR SvcReminderGetMyBirthdayModule()
{
- return ((DB::Setting::GetByte(SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE) == 1) ? USERINFO : MOD_MBIRTHDAY);
+ return ((db_get_b(NULL, MODNAME, SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE) == 1) ? USERINFO : MOD_MBIRTHDAY);
}
@@ -912,7 +895,7 @@ static void CALLBACK TimerProc_Check(HWND, UINT, UINT_PTR, DWORD)
**/
static void UpdateTimer(BYTE bStartup)
{
- LONG wNotifyInterval = 60 * 60 * (LONG)DB::Setting::GetWord(MODNAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL);
+ LONG wNotifyInterval = 60 * 60 * (LONG)db_get_w(NULL, MODNAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL);
MTime now, last;
now.GetTimeUTC();
@@ -921,7 +904,7 @@ static void UpdateTimer(BYTE bStartup)
last.DBGetStamp(NULL, MODNAME, SET_REMIND_LASTCHECK);
// if last check occured at least one day before just do it on startup again
- if (now.Year() > last.Year() || now.Month() > last.Month() || now.Day() > last.Day() || DB::Setting::GetByte(SET_REMIND_CHECKON_STARTUP, FALSE))
+ if (now.Year() > last.Year() || now.Month() > last.Month() || now.Day() > last.Day() || db_get_b(NULL, MODNAME, SET_REMIND_CHECKON_STARTUP, FALSE))
wNotifyInterval = 5;
else
wNotifyInterval -= now.Compare(last);
@@ -955,26 +938,21 @@ void SvcReminderEnable(BYTE bEnable)
ghSettingsChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged);
// reinit reminder options
- gRemindOpts.RemindState = DB::Setting::GetByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
- gRemindOpts.wDaysEarlier = DB::Setting::GetWord(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
- gRemindOpts.bCListExtraIcon = DB::Setting::GetByte(SET_REMIND_EXTRAICON, 1);
- gRemindOpts.bCheckVisibleOnly = DB::Setting::GetByte(SET_REMIND_CHECKVISIBLE, DEFVAL_REMIND_CHECKVISIBLE);
- gRemindOpts.bFlashCList = DB::Setting::GetByte(SET_REMIND_FLASHICON, FALSE);
- gRemindOpts.bPopups = ServiceExists(MS_POPUP_ADDPOPUPT) && DB::Setting::GetByte(SET_POPUP_ENABLED, DEFVAL_POPUP_ENABLED);
+ gRemindOpts.RemindState = db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
+ gRemindOpts.wDaysEarlier = db_get_w(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
+ gRemindOpts.bCListExtraIcon = db_get_b(NULL, MODNAME, SET_REMIND_EXTRAICON, 1);
+ gRemindOpts.bCheckVisibleOnly = db_get_b(NULL, MODNAME, SET_REMIND_CHECKVISIBLE, DEFVAL_REMIND_CHECKVISIBLE);
+ gRemindOpts.bFlashCList = db_get_b(NULL, MODNAME, SET_REMIND_FLASHICON, FALSE);
+ gRemindOpts.bPopups = ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, MODNAME, SET_POPUP_ENABLED, DEFVAL_POPUP_ENABLED);
// init the timer
UpdateTimer(TRUE);
}
else // Reminder is off
{
- HANDLE hContact;
-
- for (hContact = DB::Contact::FindFirst();
- hContact != NULL;
- hContact = DB::Contact::FindNext(hContact))
- {
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
NotifyWithExtraIcon(hContact, CEvent());
- }
+
gRemindOpts.RemindState = REMIND_OFF;
SvcReminderUnloadModule();
}
@@ -992,7 +970,7 @@ void SvcReminderOnModulesLoaded(void)
// init clist extra icon structure
OnCListRebuildIcons(0, 0);
- SvcReminderEnable(DB::Setting::GetByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF);
+ SvcReminderEnable(db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF);
}
/**
diff --git a/plugins/UserInfoEx/src/svc_timezone_old.cpp b/plugins/UserInfoEx/src/svc_timezone_old.cpp
index 768ef503cb..e38ec717cd 100644
--- a/plugins/UserInfoEx/src/svc_timezone_old.cpp
+++ b/plugins/UserInfoEx/src/svc_timezone_old.cpp
@@ -403,13 +403,13 @@ CTimeZone* GetContactTimeZone(HANDLE hContact, LPCSTR pszProto)
if (!myGlobals.TzIndexExist || DB::Setting::GetAsIsEx(hContact, USERINFO, pszProto, SET_CONTACT_TIMEZONEINDEX, &dbv) || FAILED(TzMgr.find(&pTimeZone,dbv.dVal)))
{
// maybe a failure lets us read a string, so clear it out
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
// try to get miranda's timezone value
if (DB::Setting::GetAsIsEx(hContact, USERINFO, pszProto, SET_CONTACT_TIMEZONE, &dbv) || (dbv.type != DBVT_BYTE))
{
// maybe a failure lets us read a string, so clear it out
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
}
else
{
@@ -459,7 +459,7 @@ WORD GetContactTimeZoneCtrl(HANDLE hContact, LPCSTR pszProto, CTimeZone** pTimeZ
flags = DB::Setting::GetCtrl(hContact, USERINFO, USERINFO, pszProto, SET_CONTACT_TIMEZONENAME, &dbv, DBVT_TCHAR);
if (flags == 0 || FAILED(TzMgr.find(&pTz, dbv.ptszVal)))
{
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
// try to get miranda's timezone index value
if (myGlobals.TzIndexExist)
@@ -489,7 +489,7 @@ WORD GetContactTimeZoneCtrl(HANDLE hContact, LPCSTR pszProto, CTimeZone** pTimeZ
{
*pTimeZone = pTz;
}
- DB::Variant::Free(&dbv);
+ db_free(&dbv);
return flags;
}
@@ -535,10 +535,10 @@ INT_PTR EnumTimeZones(PEnumNamesProc enumProc, LPARAM lParam)
**/
static BOOL SvcTimezoneSyncWithWindowsProc(LPCSTR pszProto, int bias)
{
- int tz = (int) ((CHAR)DB::Setting::GetByte(pszProto, SET_CONTACT_TIMEZONE, (BYTE)-100));
+ int tz = (int) ((CHAR)db_get_b(NULL, pszProto, SET_CONTACT_TIMEZONE, (BYTE)-100));
if (tz * 30 != bias)
{
- DB::Setting::WriteByte(pszProto, SET_CONTACT_TIMEZONE, (BYTE)(bias / 30));
+ db_set_b(NULL, pszProto, SET_CONTACT_TIMEZONE, (BYTE)(bias / 30));
return TRUE;
}
return FALSE;
@@ -628,7 +628,7 @@ void SvcTimezoneLoadModule_old()
TzMgr.Init();
CreateServiceFunction(MS_USERINFO_TIMEZONEINFO, GetContactTimeZoneInformation);
CreateServiceFunction(MS_USERINFO_LOCALTIME, GetContactLocalTime);
- if (DB::Setting::GetByte(SET_OPT_AUTOTIMEZONE, TRUE))
+ if (db_get_b(NULL, MODNAME, SET_OPT_AUTOTIMEZONE, TRUE))
{
SvcTimezoneSyncWithWindows();
}