summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-06-30 12:16:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-06-30 12:16:44 +0000
commit25ec54ea27a7099f33573b260a620ed7273176fe (patch)
tree1810a0cb35d23deeed9ccdaf0ab276a4022f9a41
parenta546606709e6bb72e01eb38b2c8c8756608fd5d6 (diff)
- db_set_blob used everywhere for writing blobs
- DBCONTACTWRITESETTING left only in the event handlers git-svn-id: http://svn.miranda-ng.org/main/trunk@5191 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/delphi/m_database.inc12
-rw-r--r--include/m_database.h28
-rw-r--r--plugins/Alarms/src/alarmlist.cpp9
-rw-r--r--plugins/AssocMgr/src/reg.cpp19
-rw-r--r--plugins/ClientChangeNotify/src/CommonLibs/Options.cpp21
-rw-r--r--plugins/DbEditorPP/src/findwindow.cpp69
-rw-r--r--plugins/HistoryPlusPlus/hpp_database.pas28
-rw-r--r--plugins/ImportTXT/General.pas8
-rw-r--r--plugins/MetaContacts/src/meta_menu.cpp21
-rwxr-xr-xplugins/MetaContacts/src/meta_services.cpp16
-rw-r--r--plugins/MetaContacts/src/meta_utils.cpp132
-rw-r--r--plugins/MetaContacts/src/metacontacts.h1
-rw-r--r--plugins/MirandaNGHistoryToDB/Database.pas8
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp10
-rw-r--r--plugins/NotesAndReminders/src/miscutils.cpp15
-rw-r--r--plugins/NotesAndReminders/src/miscutils.h2
-rw-r--r--plugins/NotesAndReminders/src/notes.cpp2
-rw-r--r--plugins/NotesAndReminders/src/options.cpp2
-rw-r--r--plugins/NotesAndReminders/src/reminders.cpp2
-rw-r--r--plugins/Popup/src/notifications.cpp25
-rw-r--r--plugins/Quotes/src/DBUtils.cpp9
-rw-r--r--plugins/Quotes/src/ImportExport.cpp7
-rw-r--r--plugins/SMS/src/common.h2
-rw-r--r--plugins/SMS/src/functions.cpp30
-rw-r--r--plugins/SecureIM/src/crypt_dll.cpp14
-rw-r--r--plugins/SecureIM/src/main.cpp21
-rw-r--r--plugins/SecureIM/src/options.cpp11
-rw-r--r--plugins/SecureIM/src/svcs_menu.cpp9
-rw-r--r--plugins/SecureIM/src/svcs_rsa.cpp25
-rw-r--r--plugins/SkypeStatusChange/src/main.cpp2
-rw-r--r--plugins/TipperYM/src/options.cpp20
-rw-r--r--plugins/UserInfoEx/src/ctrl_edit.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp7
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp97
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp40
-rw-r--r--plugins/UserInfoEx/src/mir_db.cpp20
-rw-r--r--plugins/UserInfoEx/src/mir_db.h6
-rw-r--r--plugins/Utils.pas/dbsettings.pas8
-rw-r--r--protocols/GTalkExt/src/tipper_items.cpp18
-rw-r--r--protocols/IcqOscarJ/src/fam_02location.cpp15
-rw-r--r--protocols/MRA/src/MraProto.h3
-rw-r--r--protocols/MRA/src/Mra_functions.cpp34
-rw-r--r--protocols/Twitter/src/connection.cpp9
-rw-r--r--src/modules/clist/contacts.cpp11
-rw-r--r--src/modules/database/dbini.cpp14
-rw-r--r--src/modules/database/dbintf.cpp6
46 files changed, 242 insertions, 628 deletions
diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc
index 210f4dc914..051690457c 100644
--- a/include/delphi/m_database.inc
+++ b/include/delphi/m_database.inc
@@ -77,18 +77,6 @@ const
}
MS_DB_CONTACT_GETSETTINGSTATIC:PAnsiChar = 'DB/Contact/GetSettingStatic';
- {
- wParam : Handle to contact to write setting for
- lParam : Pointer to TDBCONTACTWRITESETTING which must be initalised
- affects: writes a setting under a contact -- TDBCONTACTWRITESETTING structure
- must contain the module name writing -- the setting name, and the value
- to write (which is NOT a pointer) .szModule, .szSetting, .Value, see notes
- returns: 0 on success, non zero on failure
- notes : this service triggers 'DB/Contact/SettingChanged' before it returns
- as always, there is a helper function to use this service.
- }
- MS_DB_CONTACT_WRITESETTING:PAnsiChar = 'DB/Contact/WriteSetting';
-
{
wParam : Handle of a contact to enum settings for
lParam : Pointer to a TDBCONTACTENUMSETTINGS structure, must be initalised
diff --git a/include/m_database.h b/include/m_database.h
index c5657b91b7..0706c95b0a 100644
--- a/include/m_database.h
+++ b/include/m_database.h
@@ -147,6 +147,13 @@ typedef struct {
DBVARIANT *pValue; // pointer to variant to receive the value
} DBCONTACTGETSETTING;
+typedef struct {
+ const char *szModule; // pointer to name of the module that wrote the
+ // setting to get
+ const char *szSetting; // pointer to name of the setting to get
+ DBVARIANT value; // variant containing the value to set
+} DBCONTACTWRITESETTING;
+
/* DB/Contact/GetSettingStatic service
Look up the value of a named setting for a specific contact in the database
wParam = (WPARAM)(HANDLE)hContact
@@ -174,27 +181,6 @@ was invalid.
*/
#define MS_DB_CONTACT_GETSETTINGSTATIC "DB/Contact/GetSettingStatic"
-/* DB/Contact/WriteSetting service
-Change the value of, or create a new value with, a named setting for a specific
-contact in the database to the given value
- wParam = (WPARAM)(HANDLE)hContact
- lParam = (LPARAM)(DBCONTACTWRITESETTING*)&dbcws
-hContact should have been returned by find*contact or addcontact
-Returns 0 on success or nonzero if hContact was invalid
-Note that DBCONTACTGETSETTING takes a pointer to a DBVARIANT, whereas
-DBCONTACTWRITESETTING contains a DBVARIANT.
-Because this is such a common function there are some short helper function at
-the bottom of this header that use it.
-Triggers a db/contact/settingchanged event just before it returns.
-*/
-typedef struct {
- const char *szModule; // pointer to name of the module that wrote the
- // setting to get
- const char *szSetting; // pointer to name of the setting to get
- DBVARIANT value; // variant containing the value to set
-} DBCONTACTWRITESETTING;
-#define MS_DB_CONTACT_WRITESETTING "DB/Contact/WriteSetting"
-
/* db/contact/enumsettings v0.1.0.1+
Lists all the settings a specific modules has stored in the database for a
specific contact.
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp
index ffd15809ee..2bfe65a20a 100644
--- a/plugins/Alarms/src/alarmlist.cpp
+++ b/plugins/Alarms/src/alarmlist.cpp
@@ -581,14 +581,7 @@ void DoAlarm(ALARM *alarm)
void WriteLastCheckTime() {
// save last-check time
- DBCONTACTWRITESETTING dbcws;
- dbcws.szModule = MODULE;
- dbcws.szSetting = "LastCheck";
- dbcws.value.type = DBVT_BLOB;
- dbcws.value.cpbVal = sizeof(SYSTEMTIME);
- dbcws.value.pbVal = (BYTE *)&last_check;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&dbcws);
-
+ db_set_blob(NULL, MODULE, "LastCheck", &last_check, sizeof(SYSTEMTIME));
last_saved_check = last_check;
}
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp
index 143b262533..d792a69566 100644
--- a/plugins/AssocMgr/src/reg.cpp
+++ b/plugins/AssocMgr/src/reg.cpp
@@ -341,17 +341,14 @@ static BOOL IsRegStrValueA(HKEY hKey,const TCHAR *pszValName,const char *pszCmpV
// pData must always be Unicode data, registry supports Unicode even on Win95
static void WriteDbBackupData(const char *pszSetting,DWORD dwType,BYTE *pData,DWORD cbData)
{
- DBCONTACTWRITESETTING dbcws;
- dbcws.szModule="AssocMgr";
- dbcws.szSetting=pszSetting;
- dbcws.value.type=DBVT_BLOB;
- dbcws.value.cpbVal=(WORD)(cbData+sizeof(DWORD));
- dbcws.value.pbVal=(BYTE*)mir_alloc(cbData+sizeof(DWORD));
- if (dbcws.value.pbVal==NULL) return;
- *(DWORD*)dbcws.value.pbVal=dwType;
- CopyMemory(dbcws.value.pbVal+sizeof(DWORD),pData,cbData);
- CallService(MS_DB_CONTACT_WRITESETTING,0,(LPARAM)&dbcws);
- mir_free(dbcws.value.pbVal);
+ size_t cbLen = cbData + sizeof(DWORD);
+ PBYTE buf = (PBYTE)mir_alloc(cbLen);
+ if (buf) {
+ *(DWORD*)buf = dwType;
+ CopyMemory(buf+sizeof(DWORD), pData, cbData);
+ db_set_blob(NULL, "AssocMgr", pszSetting, buf, cbLen);
+ mir_free(buf);
+ }
}
// mir_free() the value returned in ppData
diff --git a/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp b/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp
index 0c62967232..e0d585d991 100644
--- a/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp
+++ b/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp
@@ -166,22 +166,11 @@ void COptItem::SetIntDBVal(CString &sModule, int Value, CString *sDBSettingPrefi
if (sDBSetting != NULL && !ReadOnly)
{
_ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD);
- DBCONTACTWRITESETTING cws;
- cws.szModule = sModule;
- //NightFox: WTF is this shit
- //cws.szSetting = sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting;
- cws.szSetting = sDBSetting;
-
- cws.value.type = nValueSize;
- cws.value.dVal = Value;
-
-// db_set_b(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, Value[I].Flags);
-
- //itoa(Value[I].ID, StrID.GetBuffer(64), 10);
- //StrID.ReleaseBuffer();
-
- CallService(MS_DB_CONTACT_WRITESETTING, NULL, (LPARAM)&cws);
-
+
+ DBVARIANT dbv;
+ dbv.type = nValueSize;
+ dbv.dVal = Value;
+ db_set(NULL, sModule, sDBSetting, &dbv);
}
}
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp
index 16b952f9f8..ae1eabcde8 100644
--- a/plugins/DbEditorPP/src/findwindow.cpp
+++ b/plugins/DbEditorPP/src/findwindow.cpp
@@ -291,14 +291,12 @@ char *multiReplace(const char* value, const char *find, const char *replace, int
int replaceValue(HWND hwnd, HANDLE hContact, const char *module, const char *setting, DBVARIANT *dbv, const char *find, const char *replace, int mode)
{
-
int count = 0;
-
DWORD num = 0;
BOOL write = 0;
int isNumeric;
char *myreplace = NULL;
- DBCONTACTWRITESETTING cws = {0};
+ DBVARIANT val = {0};
if (!dbv->type || dbv->type == DBVT_BLOB)
return 0;
@@ -308,40 +306,36 @@ int replaceValue(HWND hwnd, HANDLE hContact, const char *module, const char *set
else
isNumeric = sscanf(replace,"%d",&num);
- cws.szModule=module;
- cws.szSetting=setting;
- cws.value.type=dbv->type;
+ val.type=dbv->type;
- switch(dbv->type)
- {
+ switch(dbv->type) {
case DBVT_UTF8:
case DBVT_ASCIIZ:
if (mode & RW_FULL)
- cws.value.pszVal = (char*)replace;
- else
- {
+ val.pszVal = (char*)replace;
+ else {
myreplace = multiReplace(dbv->pszVal, find, replace, mode & RW_CASE);
- cws.value.pszVal=myreplace;
+ val.pszVal = myreplace;
}
break;
case DBVT_BYTE:
if (isNumeric && num < 0x100)
- cws.value.bVal = (BYTE)num;
+ val.bVal = (BYTE)num;
else
return 0;
break;
case DBVT_WORD:
if (isNumeric && num < 0x10000)
- cws.value.wVal = (WORD)num;
+ val.wVal = (WORD)num;
else
return 0;
break;
case DBVT_DWORD:
if (isNumeric)
- cws.value.dVal = num;
+ val.dVal = num;
else
return 0;
break;
@@ -350,16 +344,14 @@ int replaceValue(HWND hwnd, HANDLE hContact, const char *module, const char *set
return 0;
}
- if ((!cws.value.pszVal && !replace[0]) || (cws.value.pszVal && !cws.value.pszVal[0]))
- {
+ if ((!val.pszVal && !replace[0]) || (val.pszVal && !val.pszVal[0])) {
ItemFound(hwnd,hContact,module,setting,NULL,FW_SETTINGNAME|FW_DELETED);
db_unset(hContact,module,setting);
mir_free(myreplace);
return 1;
}
- if (!CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws))
- {
+ if (!db_set(hContact, module, setting, &val)) {
count++;
ItemFound(hwnd,hContact,module,setting,myreplace?myreplace:(char*)replace,FW_SETTINGVALUE|FW_REPLACED);
}
@@ -372,52 +364,35 @@ int replaceValue(HWND hwnd, HANDLE hContact, const char *module, const char *set
int replaceSetting(HWND hwnd, HANDLE hContact, const char *module, const char *setting, DBVARIANT *dbv, const char *find, const char *replace, int mode)
{
- DBCONTACTWRITESETTING cws;
- char *myreplace = NULL;
+ char *szSetting;
+ ptrA myreplace;
int count = 0;
DBVARIANT dbv2;
if (!dbv->type) return 0;
if (mode & RW_FULL)
- cws.szSetting = (char*)replace;
- else
- {
+ szSetting = (char*)replace;
+ else {
myreplace = multiReplace(setting, find, replace, mode & RW_CASE);
- cws.szSetting = myreplace;
+ szSetting = myreplace;
}
- if (cws.szSetting[0]==0)
- {
+ if (szSetting[0] == 0) {
ItemFound(hwnd,hContact,module,setting,NULL,FW_SETTINGNAME|FW_DELETED);
- db_unset(hContact,module,setting);
- mir_free(myreplace);
+ db_unset(hContact, module, setting);
return 1;
}
// check & write
- if (GetSetting(hContact, module, myreplace, &dbv2))
- {
- cws.szModule=module;
- cws.value.type=dbv->type;
- cws.value.pszVal=dbv->pszVal;
- cws.value.bVal=dbv->bVal;
- cws.value.wVal=dbv->wVal;
- cws.value.dVal=dbv->dVal;
- cws.value.pbVal = dbv->pbVal;
- cws.value.cpbVal = dbv->cpbVal;
-
- if (!CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws))
- {
+ if ( GetSetting(hContact, module, myreplace, &dbv2)) {
+ if ( !db_set(hContact, module, szSetting, &dbv2)) {
count++;
db_unset(hContact,module,setting);
- ItemFound(hwnd,hContact,module,cws.szSetting,NULL,FW_SETTINGNAME|FW_REPLACED);
+ ItemFound(hwnd, hContact, module, szSetting, NULL, FW_SETTINGNAME | FW_REPLACED);
}
}
- else
- db_free(&dbv2);
-
- mir_free(myreplace);
+ else db_free(&dbv2);
return count;
}
diff --git a/plugins/HistoryPlusPlus/hpp_database.pas b/plugins/HistoryPlusPlus/hpp_database.pas
index 4341fa64e2..38f307c6ed 100644
--- a/plugins/HistoryPlusPlus/hpp_database.pas
+++ b/plugins/HistoryPlusPlus/hpp_database.pas
@@ -177,14 +177,8 @@ begin
end;
function WriteDBInt(const hContact: THandle; const Module,Param: AnsiString; Value: Integer): Integer;
-var
- cws: TDBCONTACTWRITESETTING;
begin
- cws.szModule := PAnsiChar(Module);
- cws.szSetting := PAnsiChar(Param);
- cws.value._type := DBVT_DWORD;
- cws.value.dVal := Value;
- Result := CallService(MS_DB_CONTACT_WRITESETTING, hContact, lParam(@cws));
+ Result := db_set_dw(hContact, PAnsiChar(Module), PAnsiChar(Param), Value);
end;
function WriteDBStr(const Module,Param: AnsiString; const Value: AnsiString): Integer;
@@ -208,14 +202,8 @@ begin
end;
function DBWriteContactSettingWideString(hContact: THandle; const szModule: PAnsiChar; const szSetting: PAnsiChar; const val: PWideChar): Integer;
-var
- cws: TDBCONTACTWRITESETTING;
begin
- cws.szModule := szModule;
- cws.szSetting := szSetting;
- cws.value._type := DBVT_WCHAR;
- cws.value.szVal.w := val;
- Result := CallService(MS_DB_CONTACT_WRITESETTING, hContact, lParam(@cws));
+ Result := db_set_ws(hContact, szModule, szSetting, val);
end;
function WriteDBBlob(const Module,Param: AnsiString; Value: Pointer; Size: Integer): Integer;
@@ -224,16 +212,8 @@ begin
end;
function WriteDBBlob(const hContact: THandle; const Module,Param: AnsiString; Value: Pointer; Size: Integer): Integer;
-var
- cws: TDBContactWriteSetting;
-begin
- ZeroMemory(@cws,SizeOf(cws));
- cws.szModule := PAnsiChar(Module);
- cws.szSetting := PAnsiChar(Param);
- cws.value._type := DBVT_BLOB;
- cws.value.pbVal := Value;
- cws.value.cpbVal := Word(Size);
- Result := CallService(MS_DB_CONTACT_WRITESETTING,hContact,lParam(@cws));
+begin
+ Result := db_set_blob(hContact, PAnsiChar(Module), PAnsiChar(Param), Value, Size);
end;
function WriteDBDateTime(const hContact: THandle; const Module,Param: AnsiString; Value: TDateTime): Integer; overload;
diff --git a/plugins/ImportTXT/General.pas b/plugins/ImportTXT/General.pas
index a57e497b0f..a27c64728a 100644
--- a/plugins/ImportTXT/General.pas
+++ b/plugins/ImportTXT/General.pas
@@ -458,14 +458,8 @@ begin
end;
function DBWriteByte(hContact: THandle; szModule: PAnsiChar; szSetting: PAnsiChar; val: byte): integer;
-var
- cws: TDBCONTACTWRITESETTING;
begin
- cws.szModule := szModule;
- cws.szSetting := szSetting;
- cws.value._type := DBVT_BYTE;
- cws.value.bVal := val;
- result := CallService(MS_DB_CONTACT_WRITESETTING, hContact, lParam(@cws));
+ result := db_set_b(hContact, szModule, szSetting, val);
end;
procedure SetLastPattern(lp: byte);
diff --git a/plugins/MetaContacts/src/meta_menu.cpp b/plugins/MetaContacts/src/meta_menu.cpp
index 5bb857b2f3..e32f4ae75a 100644
--- a/plugins/MetaContacts/src/meta_menu.cpp
+++ b/plugins/MetaContacts/src/meta_menu.cpp
@@ -106,27 +106,6 @@ INT_PTR Meta_Edit(WPARAM wParam,LPARAM lParam)
return 0;
}
-/* DB/Contact/WriteSetting service
-Change the value of, or create a new value with, a named setting for a specific
-contact in the database to the given value
- wParam=(WPARAM)(HANDLE)hContact
- lParam=(LPARAM)(DBCONTACTWRITESETTING*)&dbcws
-hContact should have been returned by find*contact or addcontact
-Returns 0 on success or nonzero if hContact was invalid
-Note that DBCONTACTGETSETTING takes a pointer to a DBVARIANT, whereas
-DBCONTACTWRITESETTING contains a DBVARIANT.
-Because this is such a common function there are some short helper function at
-the bottom of this header that use it.
-Triggers a db/contact/settingchanged event just before it returns.
-*/
-//typedef struct {
-// const char *szModule; // pointer to name of the module that wrote the
-// // setting to get
-// const char *szSetting; // pointer to name of the setting to get
-// DBVARIANT value; // variant containing the value to set
-//} DBCONTACTWRITESETTING;
-//#define MS_DB_CONTACT_WRITESETTING "DB/Contact/WriteSetting"
-
void Meta_RemoveContactNumber(HANDLE hMeta, int number)
{
int num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", 0);
diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp
index 349227c4da..79f40b5ca2 100755
--- a/plugins/MetaContacts/src/meta_services.cpp
+++ b/plugins/MetaContacts/src/meta_services.cpp
@@ -618,7 +618,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
Meta_IsEnabled() && db_get_b((HANDLE)wParam, META_PROTO, "Hidden", 0) == 0 && !Miranda_Terminated()) {
if ((dcws->value.type == DBVT_ASCIIZ || dcws->value.type == DBVT_UTF8) && !Meta_IsHiddenGroup(dcws->value.pszVal)) {
// subcontact group reassigned - copy to saved group
- MyDBWriteContactSetting((HANDLE)wParam, META_PROTO, "OldCListGroup", &dcws->value);
+ db_set((HANDLE)wParam, META_PROTO, "OldCListGroup", &dcws->value);
db_set_s((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
} else if (dcws->value.type == DBVT_DELETED) {
db_unset((HANDLE)wParam, META_PROTO, "OldCListGroup");
@@ -655,18 +655,18 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
}
}
else if ( !strcmp(dcws->szSetting, "Nick") && !dcws->value.type == DBVT_DELETED) {
- DBVARIANT dbv;
HANDLE most_online;
// subcontact nick has changed - update metacontact
strcpy(buffer, "Nick");
strcat(buffer, _itoa(contact_number, szId, 10));
- MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
+ db_set(hMeta, META_PROTO, buffer, &dcws->value);
+ DBVARIANT dbv;
if (Mydb_get((HANDLE)wParam, "CList", "MyHandle", &dbv)) {
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, szId, 10));
- MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
+ db_set(hMeta, META_PROTO, buffer, &dcws->value);
}
else db_free(&dbv);
@@ -692,13 +692,13 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
HANDLE most_online;
if (dcws->value.type == DBVT_DELETED) {
- DBVARIANT dbv;
-
char *proto = GetContactProto((HANDLE)wParam);
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, szId, 10));
+
+ DBVARIANT dbv;
if (proto && !Mydb_get((HANDLE)wParam, proto, "Nick", &dbv)) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dbv);
+ db_set(hMeta, META_PROTO, buffer, &dbv);
db_free(&dbv);
} else {
db_unset(hMeta, META_PROTO, buffer);
@@ -708,7 +708,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, szId, 10));
- MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
+ db_set(hMeta, META_PROTO, buffer, &dcws->value);
}
// copy nick to metacontact, if it's the most online
diff --git a/plugins/MetaContacts/src/meta_utils.cpp b/plugins/MetaContacts/src/meta_utils.cpp
index 088417e473..11e273e11a 100644
--- a/plugins/MetaContacts/src/meta_utils.cpp
+++ b/plugins/MetaContacts/src/meta_utils.cpp
@@ -28,15 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
HANDLE invisiGroup;
POINT menuMousePoint;
-INT_PTR MyDBWriteContactSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) {
- DBCONTACTWRITESETTING dcws;
- dcws.szModule = szModule;
- dcws.szSetting = szSetting;
- dcws.value = *dbv;
- return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&dcws);
-}
-
-INT_PTR Mydb_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) {
+INT_PTR Mydb_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
+{
memset(dbv, 0, sizeof(DBVARIANT));
return db_get_s(hContact, szModule, szSetting, dbv, 0);
}
@@ -218,7 +211,6 @@ int Meta_SetNick(char *szProto)
*/
BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
{
- DBCONTACTWRITESETTING cws;
DWORD metaID, num_contacts;
char buffer[512], szId[40];
WORD status;
@@ -242,7 +234,8 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
// Get the login of the subcontact
char *field = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ( db_get(src,szProto,field,&cws.value)) {
+ DBVARIANT dbv;
+ if ( db_get(src,szProto, field, &dbv)) {
MessageBox(0, TranslateT("Could not get unique id of contact"), TranslateT("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -250,14 +243,14 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
// Check that is is 'on the list'
if ( db_get_b(src, "CList", "NotOnList", 0) == 1) {
MessageBox(0, TranslateT("Contact is 'Not on List' - please add the contact to your contact list before assigning."), TranslateT("Assignment Error"), MB_OK | MB_ICONWARNING);
- db_free(&cws.value);
+ db_free(&dbv);
return FALSE;
}
num_contacts++;
if (num_contacts >= MAX_CONTACTS) {
MessageBox(0, TranslateT("MetaContact is full"), TranslateT("Assignment Error"), MB_OK | MB_ICONWARNING);
- db_free(&cws.value);
+ db_free(&dbv);
return FALSE;
}
@@ -267,7 +260,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
if ( db_set_s(dest, META_PROTO, buffer, szProto)) {
MessageBox(0, TranslateT("Could not write contact protocol to MetaContact"), TranslateT("Assignment Error"), MB_OK | MB_ICONWARNING);
- db_free(&cws.value);
+ db_free(&dbv);
return FALSE;
}
@@ -275,32 +268,25 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
strcpy(buffer, "Login");
strcat(buffer, szId);
- cws.szModule = META_PROTO;
- cws.szSetting = buffer;
-
- if ( CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)dest,(LPARAM)&cws)) {
+ if ( db_set(dest, META_PROTO, buffer, &dbv)) {
MessageBox(0, TranslateT("Could not write unique id of contact to MetaContact"), TranslateT("Assignment Error"), MB_OK | MB_ICONWARNING);
- db_free(&cws.value);
+ db_free(&dbv);
return FALSE;
}
- db_free(&cws.value);
+ db_free(&dbv);
// If we can get the nickname of the subcontact...
- if ( !db_get(src,szProto,"Nick",&cws.value)) {
+ if ( !db_get(src, szProto, "Nick", &dbv)) {
// write the nickname
strcpy(buffer, "Nick");
strcat(buffer, szId);
-
- cws.szModule = META_PROTO;
- cws.szSetting = buffer;
-
- if (CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)dest,(LPARAM)&cws)) {
+ if (db_set(dest, META_PROTO, buffer, &dbv)) {
MessageBox(0, TranslateT("Could not write nickname of contact to MetaContact"), TranslateT("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
- db_free(&cws.value);
+ db_free(&dbv);
}
// write the display name
@@ -569,14 +555,14 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) {
if (strcmp(settings[i], "MirVer") == 0) {
if (db_get_w(hContact, used_mod, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
if ( !free || (dbv1.pszVal == NULL || strcmp(dbv1.pszVal, "") == 0 || strlen(dbv1.pszVal) < 2)) {
- MyDBWriteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2);
+ db_set(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2);
bDataWritten = TRUE; //only break if found something to copy
}
}
}
else {
if ( !free || !dbv_same(&dbv1, &dbv2)) {
- MyDBWriteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2);
+ db_set(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2);
if (dbv2.type == DBVT_ASCIIZ || dbv2.type == DBVT_UTF8) {
if (dbv2.pszVal != NULL && strcmp(dbv2.pszVal, "") != 0)
bDataWritten = TRUE; //only break if found something to copy
@@ -633,7 +619,6 @@ void CopyStatusData(HANDLE hMeta)
most_online = Meta_GetContactNumber(Meta_GetMostOnline(hMeta));
WORD status = db_get_w(hMeta, META_PROTO, "Status", ID_STATUS_OFFLINE);
HANDLE hContact;
- DBVARIANT dbv;
BOOL bDoneStatus = FALSE, bDoneXStatus = FALSE;
for (int i = 0; i < num_contacts; i++) {
@@ -647,22 +632,23 @@ void CopyStatusData(HANDLE hMeta)
char *szProto = GetContactProto(hContact);
if (szProto && db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) == status) {
+ DBVARIANT dbv;
if ( !bDoneStatus && !Mydb_get(hContact, "CList", "StatusMsg", &dbv)) {
- MyDBWriteContactSetting(hMeta, "CList", "StatusMsg", &dbv);
+ db_set(hMeta, "CList", "StatusMsg", &dbv);
db_free(&dbv);
bDoneStatus = TRUE;
}
if ((!bDoneXStatus) && (!Mydb_get(hContact, szProto, "XStatusId", &dbv)) && dbv.type != DBVT_DELETED) {
db_set_s(hMeta, META_PROTO, "XStatusProto", szProto);
- MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusId", &dbv);
+ db_set(hMeta, META_PROTO, "XStatusId", &dbv);
db_free(&dbv);
if ( !Mydb_get(hContact, szProto, "XStatusMsg", &dbv)) {
- MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusMsg", &dbv);
+ db_set(hMeta, META_PROTO, "XStatusMsg", &dbv);
db_free(&dbv);
}
if ( !Mydb_get(hContact, szProto, "XStatusName", &dbv)) {
- MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusName", &dbv);
+ db_set(hMeta, META_PROTO, "XStatusName", &dbv);
db_free(&dbv);
}
bDoneXStatus = TRUE;
@@ -937,14 +923,14 @@ int Meta_HideLinkedContacts(void) {
if (szProto && !db_get(hContact, szProto, "Nick", &dbv)) {
strcpy(buffer, "Nick");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
+ db_set(hContact2, META_PROTO, buffer, &dbv);
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
if (db_get(hContact, "CList", "MyHandle", &dbv2)) {
- MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
+ db_set(hContact2, META_PROTO, buffer, &dbv);
} else {
- MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv2);
+ db_set(hContact2, META_PROTO, buffer, &dbv2);
db_free(&dbv2);
}
@@ -953,7 +939,7 @@ int Meta_HideLinkedContacts(void) {
if ( !db_get(hContact, "CList", "MyHandle", &dbv)) {
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
+ db_set(hContact2, META_PROTO, buffer, &dbv);
db_free(&dbv);
}
}
@@ -1066,20 +1052,17 @@ void Meta_RestoreGroup(HANDLE hContact) {
hGroup++;
} while(name);
- if (found) {
- cws.szModule = "CList";
- cws.szSetting = "Group";
- CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
- } else {
- //db_unset(hContact, "CList", "Group");
+ if (found)
+ db_set(hContact, "CList", "Group", &cws.value);
+ else {
// put back into metacontact's group
DBVARIANT dbv;
HANDLE hMeta = (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0);
if (hMeta && !Mydb_get(hMeta, "CList", "Group", &dbv)) {
- MyDBWriteContactSetting(hContact, "CList", "Group", &dbv);
+ db_set(hContact, "CList", "Group", &dbv);
db_free(&dbv);
- } else
- db_unset(hContact, "CList", "Group");
+ }
+ else db_unset(hContact, "CList", "Group");
}
}
db_free(&cws.value);
@@ -1115,20 +1098,19 @@ void Meta_SetGroup(HANDLE hContact) {
// if it's a jabber contact, hide it, and record the fact that it was us who did
db_set_b(hContact, META_PROTO, "Hidden", 1);
db_set_b(hContact, "CList", "Hidden", 1);
- } else {
- DBCONTACTWRITESETTING cws;
+ }
+ else {
+ DBVARIANT dbv;
// save old group and move to invisible group (i.e. non-existent group)
- if ( !Mydb_get(hContact, "CList", "Group", &cws.value)) {
- if ((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) {
- // it's already in the group (shouldn't be - but maybe a crash)
- } else {
- cws.szModule = META_PROTO;
- cws.szSetting = "OldCListGroup";
- CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
- }
- db_free(&cws.value);
- } else
- db_unset(hContact, META_PROTO, "OldCListGroup");
+ if ( !Mydb_get(hContact, "CList", "Group", &dbv)) {
+ if ((dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) && !strcmp(dbv.pszVal, META_HIDDEN_GROUP))
+ ; // it's already in the group (shouldn't be - but maybe a crash)
+ else
+ db_set(hContact, META_PROTO, "OldCListGroup", &dbv);
+
+ db_free(&dbv);
+ }
+ else db_unset(hContact, META_PROTO, "OldCListGroup");
db_set_s(hContact, "CList", "Group", META_HIDDEN_GROUP);
}
@@ -1166,7 +1148,7 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) {
szProto = dbv_proto.pszVal;
if (options.clist_contact_name == CNNT_NICK && szProto) {
if ( !Mydb_get(hContact, szProto, "Nick", &dbv)) {
- MyDBWriteContactSetting(hMeta, META_PROTO, "Nick", &dbv);
+ db_set(hMeta, META_PROTO, "Nick", &dbv);
db_free(&dbv);
//CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)hMeta, 0);
//CallService(MS_CLUI_CONTACTRENAMED, (WPARAM)hMeta, 0);
@@ -1224,11 +1206,11 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2
ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
+ db_set(hMeta, META_PROTO, buff2, &dbv1);
db_free(&dbv1);
}
if (ok2) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
+ db_set(hMeta, META_PROTO, buff1, &dbv2);
db_free(&dbv2);
}
@@ -1240,11 +1222,11 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2
ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
ok1 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
+ db_set(hMeta, META_PROTO, buff2, &dbv1);
db_free(&dbv1);
}
if (ok2) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
+ db_set(hMeta, META_PROTO, buff1, &dbv2);
db_free(&dbv2);
}
@@ -1256,11 +1238,11 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2
ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
+ db_set(hMeta, META_PROTO, buff2, &dbv1);
db_free(&dbv1);
}
if (ok2) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
+ db_set(hMeta, META_PROTO, buff1, &dbv2);
db_free(&dbv2);
}
@@ -1273,12 +1255,12 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2
ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
db_unset(hMeta, META_PROTO, buff2);
- MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
+ db_set(hMeta, META_PROTO, buff2, &dbv1);
db_free(&dbv1);
}
if (ok2) {
db_unset(hMeta, META_PROTO, buff1);
- MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
+ db_set(hMeta, META_PROTO, buff1, &dbv2);
db_free(&dbv2);
}
@@ -1290,13 +1272,13 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2
ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
+ db_set(hMeta, META_PROTO, buff2, &dbv1);
db_free(&dbv1);
} else {
db_unset(hMeta, META_PROTO, buff2);
}
if (ok2) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
+ db_set(hMeta, META_PROTO, buff1, &dbv2);
db_free(&dbv2);
} else {
db_unset(hMeta, META_PROTO, buff1);
@@ -1310,13 +1292,13 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2
ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
+ db_set(hMeta, META_PROTO, buff2, &dbv1);
db_free(&dbv1);
} else {
db_unset(hMeta, META_PROTO, buff2);
}
if (ok2) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
+ db_set(hMeta, META_PROTO, buff1, &dbv2);
db_free(&dbv2);
} else {
db_unset(hMeta, META_PROTO, buff1);
@@ -1330,13 +1312,13 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2
ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
+ db_set(hMeta, META_PROTO, buff2, &dbv1);
db_free(&dbv1);
} else {
db_unset(hMeta, META_PROTO, buff2);
}
if (ok2) {
- MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
+ db_set(hMeta, META_PROTO, buff1, &dbv2);
db_free(&dbv2);
} else {
db_unset(hMeta, META_PROTO, buff1);
diff --git a/plugins/MetaContacts/src/metacontacts.h b/plugins/MetaContacts/src/metacontacts.h
index 8843e9c1b8..680b8c78b5 100644
--- a/plugins/MetaContacts/src/metacontacts.h
+++ b/plugins/MetaContacts/src/metacontacts.h
@@ -186,7 +186,6 @@ INT_PTR MetaAPI_RemoveFromMeta(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_DisableHiddenGroup(WPARAM wParam, LPARAM lParam);
// extended db get/write setting functions, that handle unicode
-INT_PTR MyDBWriteContactSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
INT_PTR Mydb_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
// IcoLib support
diff --git a/plugins/MirandaNGHistoryToDB/Database.pas b/plugins/MirandaNGHistoryToDB/Database.pas
index 2b5e03b647..e12d340c23 100644
--- a/plugins/MirandaNGHistoryToDB/Database.pas
+++ b/plugins/MirandaNGHistoryToDB/Database.pas
@@ -323,14 +323,8 @@ begin
end;
function WriteDBInt(const hContact: THandle; const Module,Param: AnsiString; Value: Integer): Integer;
-var
- cws: TDBCONTACTWRITESETTING;
begin
- cws.szModule := PAnsiChar(Module);
- cws.szSetting := PAnsiChar(Param);
- cws.value._type := DBVT_DWORD;
- cws.value.dVal := Value;
- Result := CallService(MS_DB_CONTACT_WRITESETTING, hContact, lParam(@cws));
+ Result := db_set_dw(hContact, PAnsiChar(Module), PAnsiChar(Param), Value);
end;
function WriteDBStr(const Module,Param: AnsiString; Value: AnsiString): Integer;
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index 52c2bf8583..a9c4473b4f 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -479,13 +479,9 @@ int ProcessStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact)
if (cws->value.type == DBVT_DELETED)
db_unset(smi.hContact, "UserOnline", "OldStatusMsg");
- else {
- DBCONTACTWRITESETTING cws_old;
- cws_old.szModule = "UserOnline";
- cws_old.szSetting = "OldStatusMsg";
- cws_old.value = cws->value;
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)smi.hContact, (LPARAM)&cws_old);
- }
+ else
+ db_set(smi.hContact, "UserOnline", "OldStatusMsg", &cws->value);
+
smi.cust = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)smi.hContact, GCDNF_TCHAR);
if (opt.IgnoreEmpty && (smi.compare == 2))
diff --git a/plugins/NotesAndReminders/src/miscutils.cpp b/plugins/NotesAndReminders/src/miscutils.cpp
index 3031922af6..f29ef4c233 100644
--- a/plugins/NotesAndReminders/src/miscutils.cpp
+++ b/plugins/NotesAndReminders/src/miscutils.cpp
@@ -32,19 +32,6 @@ void FreeSettingBlob(WORD pSize,void *pbBlob)
db_free(&dbv);
}
-void WriteSettingBlob(HANDLE hContact,char *ModuleName,char *SettingName,WORD pSize,void *pbBlob)
-{
- DBCONTACTWRITESETTING cgs = {0};
- DBVARIANT dbv = {0};
- dbv.type = DBVT_BLOB;
- dbv.cpbVal = pSize;
- dbv.pbVal = (BYTE*)pbBlob;
- cgs.szModule = ModuleName;
- cgs.szSetting = SettingName;
- cgs.value = dbv;
- CallService(MS_DB_CONTACT_WRITESETTING,(DWORD)hContact,(DWORD)&cgs);
-}
-
void ReadSettingBlob(HANDLE hContact, char *ModuleName, char *SettingName, WORD *pSize, void **pbBlob)
{
DBVARIANT dbv = {0};
@@ -61,7 +48,7 @@ void ReadSettingBlob(HANDLE hContact, char *ModuleName, char *SettingName, WORD
void WriteSettingIntArray(HANDLE hContact,char *ModuleName,char *SettingName,const int *Value, int Size)
{
- WriteSettingBlob(hContact, ModuleName, SettingName, WORD(sizeof(int)*Size), (void*)Value);
+ db_set_blob(hContact, ModuleName, SettingName, (void*)Value, sizeof(int)*Size);
}
bool ReadSettingIntArray(HANDLE hContact,char *ModuleName,char *SettingName,int *Value, int Size)
diff --git a/plugins/NotesAndReminders/src/miscutils.h b/plugins/NotesAndReminders/src/miscutils.h
index 52652891d5..9b8106a7ff 100644
--- a/plugins/NotesAndReminders/src/miscutils.h
+++ b/plugins/NotesAndReminders/src/miscutils.h
@@ -1,7 +1,5 @@
void ReadSettingBlob(HANDLE hContact, char *ModuleName,
char *SettingName, WORD *pSize, void **pbBlob);
-void WriteSettingBlob(HANDLE hContact,char *ModuleName,
- char *SettingName,WORD pSize,void *pbBlob);
void FreeSettingBlob(WORD pSize,void * pbBlob);
BOOL ReadSettingBool(HANDLE hContact,char *ModuleName,
char *SettingName,BOOL Default);
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp
index d54b8ea03b..9eaca318a1 100644
--- a/plugins/NotesAndReminders/src/notes.cpp
+++ b/plugins/NotesAndReminders/src/notes.cpp
@@ -942,7 +942,7 @@ static void JustSaveNotesEx(STICKYNOTE *pModified)
sprintf(ValueName, "NotesData%d", NotesCount - I - 1); // we do not reverse notes in DB
- WriteSettingBlob(0, MODULENAME, ValueName, (WORD)(n+1), Value);
+ db_set_blob(0, MODULENAME, ValueName, Value, n+1);
SAFE_FREE((void**)&Value);
if (bDeleteTData)
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp
index aaa257163c..fefe500820 100644
--- a/plugins/NotesAndReminders/src/options.cpp
+++ b/plugins/NotesAndReminders/src/options.cpp
@@ -419,7 +419,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPar
SendDlgItemMessage(hdlg,IDC_EDIT_EMAILSMS ,WM_GETTEXT,SzT+1,(LPARAM)g_RemindSMS);
}
P = g_RemindSMS;
- WriteSettingBlob(0,MODULENAME,"RemindEmail",SzT,P);
+ db_set_blob(0,MODULENAME,"RemindEmail",P,SzT);
SzT = (WORD)SendDlgItemMessage(hdlg,IDC_EDIT_ALTBROWSER,WM_GETTEXTLENGTH,0,0);
if (SzT != 0)
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp
index 25c2772251..f23bcbfdc4 100644
--- a/plugins/NotesAndReminders/src/reminders.cpp
+++ b/plugins/NotesAndReminders/src/reminders.cpp
@@ -450,7 +450,7 @@ void JustSaveReminders(void)
sprintf(ValueName, "RemindersData%d", ReminderCount - I - 1); // do not want to reverse in DB
- WriteSettingBlob(0, MODULENAME, ValueName, (WORD)(n+1), Value);
+ db_set_blob(0, MODULENAME, ValueName, Value, n+1);
SAFE_FREE((void**)&Value);
}
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp
index 92a2e28652..30ef622d2d 100644
--- a/plugins/Popup/src/notifications.cpp
+++ b/plugins/Popup/src/notifications.cpp
@@ -124,24 +124,13 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul)
ptd->notification.lpzName);
db_set_s(NULL, szModul, setting, ptd->rightAction);
- for (int i=0; i < ptd->notification.actionCount; ++i)
- {
- if (!lstrcmpA(ptd->leftAction, ptd->notification.lpActions[i].lpzTitle))
- {
- DBCONTACTWRITESETTING dbcws = {0};
- dbcws.szModule = ptd->notification.lpActions[i].lpzLModule;
- dbcws.szModule = ptd->notification.lpActions[i].lpzLSetting;
- dbcws.value = ptd->notification.lpActions[i].dbvLData;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&dbcws);
- }
- if (!lstrcmpA(ptd->rightAction, ptd->notification.lpActions[i].lpzTitle))
- {
- DBCONTACTWRITESETTING dbcws = {0};
- dbcws.szModule = ptd->notification.lpActions[i].lpzRModule;
- dbcws.szModule = ptd->notification.lpActions[i].lpzRSetting;
- dbcws.value = ptd->notification.lpActions[i].dbvRData;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&dbcws);
- }
+ for (int i=0; i < ptd->notification.actionCount; ++i) {
+ POPUPNOTIFYACTION &p = ptd->notification.lpActions[i];
+ if (!lstrcmpA(ptd->leftAction, p.lpzTitle))
+ db_set(NULL, p.lpzLModule, p.lpzLSetting, &p.dbvLData);
+
+ if (!lstrcmpA(ptd->rightAction, p.lpzTitle))
+ db_set(NULL, p.lpzRModule, p.lpzRSetting, &p.dbvRData);
}
}
}
diff --git a/plugins/Quotes/src/DBUtils.cpp b/plugins/Quotes/src/DBUtils.cpp
index 583cedcf85..d85f85c282 100644
--- a/plugins/Quotes/src/DBUtils.cpp
+++ b/plugins/Quotes/src/DBUtils.cpp
@@ -36,14 +36,7 @@ std::wstring Quotes_DBGetStringW(HANDLE hContact,const char* szModule,const char
bool Quotes_DBWriteDouble(HANDLE hContact,const char* szModule,const char* szSetting,double dValue)
{
- DBCONTACTWRITESETTING cws = {0};
-
- cws.szModule = szModule;
- cws.szSetting = szSetting;
- cws.value.type = DBVT_BLOB;
- cws.value.cpbVal = sizeof(dValue);
- cws.value.pbVal = reinterpret_cast<BYTE*>(&dValue);
- return 0 == CallService(MS_DB_CONTACT_WRITESETTING,reinterpret_cast<WPARAM>(hContact),reinterpret_cast<LPARAM>(&cws));
+ return 0 == db_set_blob(hContact, szModule, szSetting, &dValue, sizeof(dValue));
}
bool Quotes_DBReadDouble(HANDLE hContact,const char* szModule,const char* szSetting,double& rdValue)
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp
index 00153d79dd..6c7d7fc1fa 100644
--- a/plugins/Quotes/src/ImportExport.cpp
+++ b/plugins/Quotes/src/ImportExport.cpp
@@ -309,17 +309,14 @@ INT_PTR Quotes_Export(WPARAM wp,LPARAM lp)
namespace
{
- bool set_contact_settings(HANDLE hContact,DBCONTACTWRITESETTING& dbs)
+ bool set_contact_settings(HANDLE hContact, DBCONTACTWRITESETTING& dbs)
{
assert(DBVT_DELETED != dbs.value.type);
- return (0 == CallService(MS_DB_CONTACT_WRITESETTING,reinterpret_cast<WPARAM>(hContact),
- reinterpret_cast<LPARAM>(&dbs)));
+ return (0 == db_set(hContact, dbs.szModule, dbs.szSetting, &dbs.value));
}
bool handle_module(HANDLE hContact,const IXMLNode::TXMLNodePtr& pXmlModule,UINT nFlags)
{
-// USES_CONVERSION;
-
size_t cCreatedRecords = 0;
tstring sModuleName = pXmlModule->GetText();
if(false == sModuleName.empty())
diff --git a/plugins/SMS/src/common.h b/plugins/SMS/src/common.h
index e88b11c131..7c2eab9643 100644
--- a/plugins/SMS/src/common.h
+++ b/plugins/SMS/src/common.h
@@ -113,10 +113,8 @@ extern SMS_SETTINGS ssSMSSettings;
#define DB_SMS_SetByte(Contact,valueName,parValue) db_set_b(Contact,PROTOCOL_NAMEA,valueName,parValue)
BOOL DB_GetStaticStringW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpszRetBuff,SIZE_T dwRetBuffSize,SIZE_T *pdwRetBuffSize);
#define DB_SMS_GetStaticStringW(Contact,ValueName,Ret,RetBuffSize,pRetBuffSize) DB_GetStaticStringW(Contact,PROTOCOL_NAMEA,ValueName,Ret,RetBuffSize,pRetBuffSize)
-BOOL DB_SetStringExW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszValue,SIZE_T dwValueSize);
#define DB_SetStringW(Contact,Module,valueName,parValue) db_set_ws(Contact,Module,valueName,parValue)
#define DB_SMS_SetStringW(Contact,valueName,parValue) db_set_ws(Contact,PROTOCOL_NAMEA,valueName,parValue)
-#define DB_SMS_SetStringExW(Contact,valueName,parValue,parValueSize) DB_SetStringExW(Contact,PROTOCOL_NAMEA,valueName,parValue,parValueSize)
LRESULT CALLBACK MessageSubclassProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp
index 7eca077e23..f61e6ee67d 100644
--- a/plugins/SMS/src/functions.cpp
+++ b/plugins/SMS/src/functions.cpp
@@ -26,36 +26,6 @@ BOOL DB_GetStaticStringW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LP
return(bRet);
}
-
-BOOL DB_SetStringExW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszValue,SIZE_T dwValueSize)
-{
- BOOL bRet=FALSE;
-
- if (lpwszValue && dwValueSize)
- {
- LPWSTR lpwszValueLocal=(LPWSTR)MEMALLOC(((dwValueSize+MAX_PATH)*sizeof(WCHAR)));
-
- if (lpwszValueLocal)
- {
- DBCONTACTWRITESETTING cws={0};
-
- cws.szModule=lpszModule;
- cws.szSetting=lpszValueName;
- cws.value.type=DBVT_WCHAR;
- cws.value.pwszVal=(WCHAR*)lpwszValueLocal;
- CopyMemory(lpwszValueLocal,lpwszValue,(dwValueSize*sizeof(WCHAR)));
- bRet=(CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws)==0);
-
- MEMFREE(lpwszValueLocal);
- }
- }else{
- bRet=TRUE;
- db_unset(hContact,lpszModule,lpszValueName);
- }
- return(bRet);
-}
-
-
LPSTR GetModuleName(HANDLE hContact)
{
LPSTR lpszRet;
diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp
index 4b3c73c088..05220acf99 100644
--- a/plugins/SecureIM/src/crypt_dll.cpp
+++ b/plugins/SecureIM/src/crypt_dll.cpp
@@ -87,21 +87,11 @@ BOOL CalculateKeyX(pUinKey ptr,HANDLE hContact) {
// store key
cpp_get_keyx(ptr->cntx,buffer);
- DBCONTACTWRITESETTING cws;
- cws.szModule = MODULENAME;
-
// store key in database
- cws.szSetting = "offlineKey";
- cws.value.type = DBVT_BLOB;
- cws.value.cpbVal = keysize;
- cws.value.pbVal = buffer;
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
+ db_set_blob(hContact, MODULENAME, "offlineKey", buffer, keysize);
// store timeout of key in database (2 days)
- cws.szSetting = "offlineKeyTimeout";
- cws.value.type = DBVT_DWORD;
- cws.value.dVal = gettime()+(60*60*24*db_get_w(0,MODULENAME,"okt",2));
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
+ db_set_dw(hContact, MODULENAME, "offlineKeyTimeout", gettime()+(60*60*24*db_get_w(0,MODULENAME,"okt",2)));
// key exchange is finished
showPopupEC(ptr->hContact);
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp
index c4c22653af..e07e91669c 100644
--- a/plugins/SecureIM/src/main.cpp
+++ b/plugins/SecureIM/src/main.cpp
@@ -161,24 +161,11 @@ int onModulesLoaded(WPARAM, LPARAM)
char priv_key[4096]; int priv_len;
char pub_key[4096]; int pub_len;
- DBCONTACTWRITESETTING cws;
- cws.szModule = MODULENAME;
- cws.value.type = DBVT_BLOB;
-
exp->rsa_get_keypair(CPP_MODE_RSA_4096,(PBYTE)&priv_key,&priv_len,(PBYTE)&pub_key,&pub_len);
-
- cws.szSetting = "rsa_priv";
- cws.value.pbVal = (PBYTE)&priv_key;
- cws.value.cpbVal = priv_len;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
-
- cws.szSetting = "rsa_pub";
- cws.value.pbVal = (PBYTE)&pub_key;
- cws.value.cpbVal = pub_len;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
-
- db_unset(0, MODULENAME, "rsa_priv_2048");
- db_unset(0, MODULENAME, "rsa_pub_2048");
+ db_set_blob(NULL, MODULENAME, "rsa_priv", priv_key, priv_len);
+ db_set_blob(NULL, MODULENAME, "rsa_pub", &pub_key, pub_len);
+ db_unset(NULL, MODULENAME, "rsa_priv_2048");
+ db_unset(NULL, MODULENAME, "rsa_pub_2048");
rsa_4096 = 1;
}
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp
index 795e88b14c..173447a1bb 100644
--- a/plugins/SecureIM/src/options.cpp
+++ b/plugins/SecureIM/src/options.cpp
@@ -336,15 +336,8 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
if (!LoadImportRSAKeyDlg(hDlg,pub,0)) return TRUE;
if (exp->rsa_import_pubkey(ptr->cntx,pub)) {
int len;
- exp->rsa_get_pubkey(ptr->cntx,(PBYTE)pub,&len);
-
- DBCONTACTWRITESETTING cws;
- cws.szModule = MODULENAME;
- cws.szSetting = "rsa_pub";
- cws.value.type = DBVT_BLOB;
- cws.value.pbVal = (PBYTE)pub;
- cws.value.cpbVal = len;
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)ptr->hContact, (LPARAM)&cws);
+ exp->rsa_get_pubkey(ptr->cntx, (PBYTE)pub, &len);
+ db_set_blob(ptr->hContact, MODULENAME, "rsa_pub", pub, len);
setListViewPUB(hLV,idx,1);
}
diff --git a/plugins/SecureIM/src/svcs_menu.cpp b/plugins/SecureIM/src/svcs_menu.cpp
index 516e941459..f9a22638c3 100644
--- a/plugins/SecureIM/src/svcs_menu.cpp
+++ b/plugins/SecureIM/src/svcs_menu.cpp
@@ -76,14 +76,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam)
PVOID KeyID = pgp_select_keyid(GetForegroundWindow(),szKeyID);
if (szKeyID[0]) {
db_unset((HANDLE)wParam,MODULENAME,"pgp");
- DBCONTACTWRITESETTING cws;
- memset(&cws,0,sizeof(cws));
- cws.szModule = MODULENAME;
- cws.szSetting = "pgp";
- cws.value.type = DBVT_BLOB;
- cws.value.pbVal = (LPBYTE)KeyID;
- cws.value.cpbVal = pgp_size_keyid();
- CallService(MS_DB_CONTACT_WRITESETTING,wParam,(LPARAM)&cws);
+ db_set_blob((HANDLE)wParam, MODULENAME, "pgp", KeyID, pgp_size_keyid());
db_set_b((HANDLE)wParam,MODULENAME,"pgp_mode",0);
db_set_s((HANDLE)wParam,MODULENAME,"pgp_abbr",szKeyID);
del = false;
diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp
index a55a393875..1ef0ecbbb0 100644
--- a/plugins/SecureIM/src/svcs_rsa.cpp
+++ b/plugins/SecureIM/src/svcs_rsa.cpp
@@ -68,13 +68,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int
#endif
}
if (v) {
- DBCONTACTWRITESETTING cws;
- cws.szModule = MODULENAME;
- cws.szSetting = "rsa_pub";
- cws.value.type = DBVT_BLOB;
- cws.value.pbVal = pub;
- cws.value.cpbVal = pubLen;
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)ptr->hContact, (LPARAM)&cws);
+ db_set_blob(ptr->hContact, MODULENAME, "rsa_pub", pub, pubLen);
ptr->keyLoaded = true;
}
mir_free(cnm);
@@ -155,23 +149,10 @@ void sttGenerateRSA(LPVOID)
char pub_key[4096]; int pub_len;
exp->rsa_gen_keypair(CPP_MODE_RSA_4096);
-
- DBCONTACTWRITESETTING cws;
- cws.szModule = MODULENAME;
- cws.value.type = DBVT_BLOB;
-
exp->rsa_get_keypair(CPP_MODE_RSA_4096,(PBYTE)&priv_key,&priv_len,(PBYTE)&pub_key,&pub_len);
- cws.szSetting = "rsa_priv";
- cws.value.pbVal = (PBYTE)&priv_key;
- cws.value.cpbVal = priv_len;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
-
- cws.szSetting = "rsa_pub";
- cws.value.pbVal = (PBYTE)&pub_key;
- cws.value.cpbVal = pub_len;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
-
+ db_set_blob(NULL, MODULENAME, "rsa_priv", priv_key, priv_len);
+ db_set_blob(NULL, MODULENAME, "rsa_pub", pub_key, pub_len);
rsa_4096 = 1;
}
diff --git a/plugins/SkypeStatusChange/src/main.cpp b/plugins/SkypeStatusChange/src/main.cpp
index d94d0920f1..667e3fefe3 100644
--- a/plugins/SkypeStatusChange/src/main.cpp
+++ b/plugins/SkypeStatusChange/src/main.cpp
@@ -189,7 +189,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
SendMessage(wndSkypeAPIWindow,WM_COPYDATA,(WPARAM)hWnd,(LPARAM)&oCopyData);
if (g_Options.GetSyncStatusMsgFlag()) {
TCHAR* pszStatusMsg = NULL;
- if (true == ProtoServiceExists(si.Module(), PS_GETMYAWAYMSG))
+ if ( ProtoServiceExists(si.Module(), PS_GETMYAWAYMSG))
pszStatusMsg = reinterpret_cast<TCHAR*>(CallProtoService(si.Module(),PS_GETMYAWAYMSG,(WPARAM)ms.m_nMirandaStatus,SGMA_TCHAR));
if ((NULL == pszStatusMsg) || (CALLSERVICE_NOTFOUND == reinterpret_cast<int>(pszStatusMsg)))
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp
index f422396f33..c8a8ce52ac 100644
--- a/plugins/TipperYM/src/options.cpp
+++ b/plugins/TipperYM/src/options.cpp
@@ -1656,15 +1656,9 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY)
{
TVITEM item = {0};
- int i = 0;
- DBCONTACTWRITESETTING cws;
- cws.szModule = MODULE;
- cws.szSetting = "IconOrder";
- cws.value.type = DBVT_BLOB;
- cws.value.cpbVal = SIZEOF(extraIconName);
- cws.value.pbVal = opt.exIconsOrder;
-
item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS));
+
+ int i = 0;
while (item.hItem != NULL)
{
item.mask = TVIF_HANDLE | TVIF_PARAM;
@@ -1672,16 +1666,10 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
opt.exIconsOrder[i++] = ((ICONSTATE *)item.lParam)->order;
item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg,IDC_TREE_EXTRAICONS), item.hItem);
}
- CallService(MS_DB_CONTACT_WRITESETTING, 0,(LPARAM)&cws);
+ db_set_blob(NULL, MODULE, "IconOrder", opt.exIconsOrder, SIZEOF(opt.exIconsOrder));
i = 0;
- cws.szModule = MODULE;
- cws.szSetting = "icons_vis";
- cws.value.type = DBVT_BLOB;
- cws.value.cpbVal = SIZEOF(extraIconName);
- cws.value.pbVal = opt.exIconsVis;
item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg,IDC_TREE_EXTRAICONS));
-
while (item.hItem != NULL)
{
item.mask = TVIF_HANDLE | TVIF_PARAM;
@@ -1689,7 +1677,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
opt.exIconsVis[i++] = ((ICONSTATE *)item.lParam)->vis;
item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), item.hItem);
}
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
+ db_set_blob(NULL, MODULE, "icons_vis", opt.exIconsVis, SIZEOF(opt.exIconsVis));
opt.iSmileyAddFlags = 0;
opt.iSmileyAddFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLESMILEYS) ? SMILEYADD_ENABLE : 0) |
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp
index 947bb68c19..2d25aa7213 100644
--- a/plugins/UserInfoEx/src/ctrl_edit.cpp
+++ b/plugins/UserInfoEx/src/ctrl_edit.cpp
@@ -208,7 +208,7 @@ void CEditCtrl::OnApply(HANDLE hContact, LPCSTR pszProto)
}
if (dbv.type != DBVT_DELETED)
{
- if (!DB::Setting::WriteVariant(hContact, pszModule, _pszSetting, &dbv))
+ if (!db_set(hContact, pszModule, _pszSetting, &dbv))
{
if (!hContact)
{
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
index 77ae97f992..ffbce296e9 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
@@ -245,8 +245,6 @@ BYTE CExImContactBase::fromIni(LPSTR& row)
**/
HANDLE CExImContactBase::toDB()
{
- DBCONTACTWRITESETTING cws;
-
// create new contact if none exists
if (_hContact == INVALID_HANDLE_VALUE && _pszProto && _pszUIDKey && _dbvUID.type != DBVT_DELETED) {
PROTOACCOUNT* pszAccount = 0;
@@ -271,10 +269,7 @@ HANDLE CExImContactBase::toDB()
return INVALID_HANDLE_VALUE;
}
// write uid to protocol module
- cws.szModule = _pszProto;
- cws.szSetting = _pszUIDKey;
- cws.value = _dbvUID;
- if (CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)_hContact, (LPARAM)&cws)) {
+ if (db_set(_hContact, _pszProto, _pszUIDKey, &_dbvUID)) {
DB::Contact::Delete(_hContact);
_hContact = INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
index e17d64f7c7..78d81fdbf6 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
@@ -964,78 +964,71 @@ int CExImContactXML::ImportModule(TiXmlNode* xmlModule)
**/
int CExImContactXML::ImportSetting(LPCSTR pszModule, TiXmlElement *xmlEntry)
{
- DBCONTACTWRITESETTING cws = {0};
- TiXmlText* xval;
- LPCSTR value;
-
// validate parameter
if (!xmlEntry || !pszModule || !*pszModule)
return ERROR_INVALID_PARAMS;
// validate value
- xval = (TiXmlText*)xmlEntry->FirstChild();
+ TiXmlText* xval = (TiXmlText*)xmlEntry->FirstChild();
if (!xval || xval->Type() != TiXmlText::TEXT)
return ERROR_INVALID_VALUE;
- value = xval->Value();
- // init write structure
- cws.szModule = (LPSTR)pszModule;
- cws.szSetting = xmlEntry->Attribute("key");
+ LPCSTR value = xval->Value();
+ DBVARIANT dbv = { 0 };
// convert data
size_t len = 0;
INT_PTR baselen = NULL;
switch (value[0]) {
- case 'b': //'b' bVal and cVal are valid
- cws.value.type = DBVT_BYTE;
- cws.value.bVal = (BYTE)atoi(value + 1);
- break;
- case 'w': //'w' wVal and sVal are valid
- cws.value.type = DBVT_WORD;
- cws.value.wVal = (WORD)atoi(value + 1);
- break;
- case 'd': //'d' dVal and lVal are valid
- cws.value.type = DBVT_DWORD;
- cws.value.dVal = (DWORD)_atoi64(value + 1);
-// cws.value.dVal = (DWORD)atoi(value + 1);
- break;
- case 's': //'s' pszVal is valid
- cws.value.type = DBVT_ASCIIZ;
- cws.value.pszVal = (LPSTR)mir_utf8decodeA((LPSTR)(value + 1));
- break;
- case 'u':
- cws.value.type = DBVT_UTF8;
- cws.value.pszVal = (LPSTR)mir_strdup((LPSTR)(value + 1));
- break;
- case 'n':
- len = strlen(value + 1);
- baselen = Base64DecodeGetRequiredLength(len);
- cws.value.type = DBVT_BLOB;
- cws.value.pbVal = (PBYTE)mir_alloc(baselen +1);
- if (cws.value.pbVal != NULL){
- if (Base64Decode((value + 1), len, cws.value.pbVal, &baselen)) {
- cws.value.cpbVal = baselen;
- }
- else {
- mir_free(cws.value.pbVal);
- return ERROR_NOT_ADDED;
- }
+ case 'b': //'b' bVal and cVal are valid
+ dbv.type = DBVT_BYTE;
+ dbv.bVal = (BYTE)atoi(value + 1);
+ break;
+ case 'w': //'w' wVal and sVal are valid
+ dbv.type = DBVT_WORD;
+ dbv.wVal = (WORD)atoi(value + 1);
+ break;
+ case 'd': //'d' dVal and lVal are valid
+ dbv.type = DBVT_DWORD;
+ dbv.dVal = (DWORD)_atoi64(value + 1);
+ break;
+ case 's': //'s' pszVal is valid
+ dbv.type = DBVT_ASCIIZ;
+ dbv.pszVal = (LPSTR)mir_utf8decodeA((LPSTR)(value + 1));
+ break;
+ case 'u':
+ dbv.type = DBVT_UTF8;
+ dbv.pszVal = (LPSTR)mir_strdup((LPSTR)(value + 1));
+ break;
+ case 'n':
+ len = strlen(value + 1);
+ baselen = Base64DecodeGetRequiredLength(len);
+ dbv.type = DBVT_BLOB;
+ dbv.pbVal = (PBYTE)mir_alloc(baselen +1);
+ if (dbv.pbVal != NULL){
+ if (Base64Decode((value + 1), len, dbv.pbVal, &baselen))
+ dbv.cpbVal = baselen;
+ else {
+ mir_free(dbv.pbVal);
+ return ERROR_NOT_ADDED;
}
- break;
- default:
- return ERROR_INVALID_TYPE;
+ }
+ break;
+ default:
+ return ERROR_INVALID_TYPE;
}
+
// write value to db
- if (CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)_hContact, (LPARAM)&cws)) {
+ if (db_set(_hContact, pszModule, xmlEntry->Attribute("key"), &dbv)) {
//if (cws.value.pbVal>0)
- mir_free(cws.value.pbVal);
- if (cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) mir_free(cws.value.pszVal);
+ mir_free(dbv.pbVal);
+ if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) mir_free(dbv.pszVal);
return ERROR_NOT_ADDED;
}
- //if (cws.value.pbVal>0)
- mir_free(cws.value.pbVal);
- if (cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) mir_free(cws.value.pszVal);
+ //if (dbv.pbVal>0)
+ mir_free(dbv.pbVal);
+ if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) mir_free(dbv.pszVal);
return ERROR_OK;
}
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
index f8b5fbc3ae..1949ae96f0 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
@@ -324,7 +324,7 @@ static HANDLE ImportFindContact(HANDLE hContact, LPSTR &strBuf, BYTE bCanCreate)
**/
int ImportSetting(HANDLE hContact, LPCSTR pszModule, LPSTR &strLine)
{
- DBCONTACTWRITESETTING cws;
+ DBVARIANT dbv;
LPSTR end, value;
size_t numLines = 0;
size_t brk;
@@ -341,10 +341,8 @@ int ImportSetting(HANDLE hContact, LPCSTR pszModule, LPSTR &strLine)
if (end == pszLine)
return 1;
*(end--) = 0;
- } while (*end == '\t' || *end == ' ' || *end < 27);
-
- cws.szModule = pszModule;
- cws.szSetting = pszLine;
+ }
+ while (*end == '\t' || *end == ' ' || *end < 27);
// skip spaces from the beginning of the value
do {
@@ -360,22 +358,22 @@ int ImportSetting(HANDLE hContact, LPCSTR pszModule, LPSTR &strLine)
case 'B':
if (brk = strspn(value, "0123456789-"))
*(value + brk) = 0;
- cws.value.type = DBVT_BYTE;
- cws.value.bVal = (BYTE)atoi(value);
+ dbv.type = DBVT_BYTE;
+ dbv.bVal = (BYTE)atoi(value);
break;
case 'w':
case 'W':
if (brk = strspn(value, "0123456789-"))
*(value + brk) = 0;
- cws.value.type = DBVT_WORD;
- cws.value.wVal = (WORD)atoi(value);
+ dbv.type = DBVT_WORD;
+ dbv.wVal = (WORD)atoi(value);
break;
case 'd':
case 'D':
if (brk = strspn(value, "0123456789-"))
*(value + brk) = 0;
- cws.value.type = DBVT_DWORD;
- cws.value.dVal = (DWORD)_atoi64(value);
+ dbv.type = DBVT_DWORD;
+ dbv.dVal = (DWORD)_atoi64(value);
break;
case 's':
case 'S':
@@ -396,13 +394,13 @@ int ImportSetting(HANDLE hContact, LPCSTR pszModule, LPSTR &strLine)
switch (*(value - 1)) {
case 's':
case 'S':
- cws.value.type = DBVT_ASCIIZ;
- cws.value.pszVal = value;
+ dbv.type = DBVT_ASCIIZ;
+ dbv.pszVal = value;
break;
case 'u':
case 'U':
- cws.value.type = DBVT_UTF8;
- cws.value.pszVal = value;
+ dbv.type = DBVT_UTF8;
+ dbv.pszVal = value;
break;
}
break;
@@ -410,10 +408,10 @@ int ImportSetting(HANDLE hContact, LPCSTR pszModule, LPSTR &strLine)
case 'N':
{
PBYTE dest;
- cws.value.type = DBVT_BLOB;
- cws.value.cpbVal = (WORD)mir_strlen(value) / 3;
- cws.value.pbVal = (PBYTE)value;
- for ( dest = cws.value.pbVal, value = strtok(value, " ");
+ dbv.type = DBVT_BLOB;
+ dbv.cpbVal = (WORD)mir_strlen(value) / 3;
+ dbv.pbVal = (PBYTE)value;
+ for ( dest = dbv.pbVal, value = strtok(value, " ");
value && *value;
value = strtok(NULL, " "))
*(dest++) = (BYTE)strtol(value, NULL, 16);
@@ -421,10 +419,10 @@ int ImportSetting(HANDLE hContact, LPCSTR pszModule, LPSTR &strLine)
break;
}
default:
- cws.value.type = DBVT_DELETED;
+ dbv.type = DBVT_DELETED;
//return 1;
}
- return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
+ return db_set(hContact, pszModule, pszLine, &dbv);
}
/**
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp
index e40855b24b..fcd347e373 100644
--- a/plugins/UserInfoEx/src/mir_db.cpp
+++ b/plugins/UserInfoEx/src/mir_db.cpp
@@ -466,26 +466,6 @@ BYTE GetStatic(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPSTR pszVa
}
/**
- * 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)
- * @param pszSetting - the setting to write
- * @param dbv - the DBVARIANT to store
- *
- * @retval 0 - success
- * @retval 1 - error
- **/
-BYTE WriteVariant(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, const DBVARIANT *dbv)
-{
- DBCONTACTWRITESETTING cws;
-
- cws.szModule = pszModule;
- cws.szSetting = pszSetting;
- memcpy(&cws.value, dbv, sizeof(DBVARIANT));
- 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)
diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h
index be4248bebf..ed60f07b90 100644
--- a/plugins/UserInfoEx/src/mir_db.h
+++ b/plugins/UserInfoEx/src/mir_db.h
@@ -97,17 +97,11 @@ namespace Setting {
BYTE GetStatic (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPSTR szValue, int cchValue);
- /**
- * write values to the database.
- **/
- BYTE WriteVariant (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, const DBVARIANT *dbv);
-
#define GetTString GetWString
#define GetTStringEx GetWStringEx
#define GetTStringCtrl GetWStringCtrl
#define WriteTString WriteWString
-
/**
* misc operations
**/
diff --git a/plugins/Utils.pas/dbsettings.pas b/plugins/Utils.pas/dbsettings.pas
index 5e2b5b08fd..4d7da84f2a 100644
--- a/plugins/Utils.pas/dbsettings.pas
+++ b/plugins/Utils.pas/dbsettings.pas
@@ -159,13 +159,9 @@ begin
end;
function DBWriteSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
-var
- cws: TDBCONTACTWRITESETTING;
+ {$IFDEF AllowInline}inline;{$ENDIF}
begin
- cws.szModule :=szModule;
- cws.szSetting :=szSetting;
- move(dbv^,cws.value,SizeOf(TDBVARIANT));
- Result := CallService(MS_DB_CONTACT_WRITESETTING, hContact, lParam(@cws));
+ Result:=db_set(hContact, szModule, szSetting, dbv);
end;
function DBWriteByte(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Byte):int_ptr;
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp
index 6dc8a3d6ae..36d0cbb0b1 100644
--- a/protocols/GTalkExt/src/tipper_items.cpp
+++ b/protocols/GTalkExt/src/tipper_items.cpp
@@ -47,29 +47,27 @@ static const LPTSTR UNREAD_THREADS_LABEL = LPGENT("Unread threads:");
void ShiftTipperSettings(LPSTR buff, int count, LPSTR format)
{
for (int i = count; i > 0; i--) {
- DBCONTACTWRITESETTING cws;
+ DBVARIANT dbv;
sprintf(buff, format, i - 1);
- if (db_get(0, TIPPER_ITEMS_MOD_NAME, buff, &cws.value))
+ if (db_get(0, TIPPER_ITEMS_MOD_NAME, buff, &dbv))
break;
__try {
- if (DBVT_ASCIIZ == cws.value.type) {
- db_free(&cws.value);
- if (db_get_ws(0, TIPPER_ITEMS_MOD_NAME, buff, &cws.value))
+ if (DBVT_ASCIIZ == dbv.type) {
+ db_free(&dbv);
+ if (db_get_ws(0, TIPPER_ITEMS_MOD_NAME, buff, &dbv))
break;
}
- if (db_get_s(0, TIPPER_ITEMS_MOD_NAME, buff, &cws.value))
+ if (db_get_s(0, TIPPER_ITEMS_MOD_NAME, buff, &dbv))
break;
- cws.szModule = TIPPER_ITEMS_MOD_NAME;
sprintf(buff, format, i);
- cws.szSetting = buff;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
+ db_set(NULL, TIPPER_ITEMS_MOD_NAME, buff, &dbv);
}
__finally {
- db_free(&cws.value);
+ db_free(&dbv);
}
}
}
diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp
index 8aa2a56aa7..7687c18444 100644
--- a/protocols/IcqOscarJ/src/fam_02location.cpp
+++ b/protocols/IcqOscarJ/src/fam_02location.cpp
@@ -185,19 +185,8 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie
// Get Profile encoding TLV
pTLV = pChain->getTLV(0x05, 1);
- if (pTLV && (pTLV->wLen > 0))
- {
- // store client capabilities
- BYTE* capBuf = pTLV->pData;
- WORD capLen = pTLV->wLen;
- DBCONTACTWRITESETTING dbcws;
- dbcws.value.type = DBVT_BLOB;
- dbcws.value.cpbVal = capLen;
- dbcws.value.pbVal = capBuf;
- dbcws.szModule = m_szModuleName;
- dbcws.szSetting = "CapBuf";
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&dbcws);
- }
+ if (pTLV && pTLV->wLen > 0) // store client capabilities
+ db_set_blob(hContact, m_szModuleName, "CapBuf", pTLV->pData, pTLV->wLen);
else
deleteSetting(hContact, "CapBuf");
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h
index 2ba636de92..019401c90d 100644
--- a/protocols/MRA/src/MraProto.h
+++ b/protocols/MRA/src/MraProto.h
@@ -30,7 +30,6 @@ BOOL DB_GetStaticStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueNam
BOOL DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPCSTR lpszValue, size_t dwValueSize);
BOOL DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPCWSTR lpwszValue, size_t dwValueSize);
-int DB_WriteContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpValue, size_t dwValueSize);
BOOL DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
struct CMraProto : public PROTO_INTERFACE
@@ -140,7 +139,7 @@ struct CMraProto : public PROTO_INTERFACE
return DB_SetStringExW(Contact, m_szModuleName, valueName, parValue, parValueSize); }
__forceinline BOOL mraWriteContactSettingBlob(HANDLE hContact, const char *lpszValueName, LPVOID lpbValue, size_t dwValueSize) {
- return DB_WriteContactSettingBlob(hContact, m_szModuleName, lpszValueName, lpbValue, dwValueSize); }
+ return db_set_blob(hContact, m_szModuleName, lpszValueName, lpbValue, dwValueSize); }
__forceinline BOOL mraGetContactSettingBlob(HANDLE hContact, const char *lpszValueName, LPVOID lpbRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize) {
return DB_GetContactSettingBlob(hContact, m_szModuleName, lpszValueName, lpbRet, dwRetBuffSize, pdwRetBuffSize); }
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 65ed85f6c1..3d5b14bc64 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -268,16 +268,13 @@ BOOL DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, L
lpwszValueLocal = (LPWSTR)mir_calloc((dwValueSizeLocal*sizeof(WCHAR)));
if (lpwszValueLocal) {
- DBCONTACTWRITESETTING cws = {0};
-
- cws.szModule = lpszModule;
- cws.szSetting = lpszValueName;
- cws.value.type = DBVT_WCHAR;
- cws.value.pwszVal = (WCHAR*)lpwszValueLocal;
+ DBVARIANT dbv = {0};
+ dbv.type = DBVT_WCHAR;
+ dbv.pwszVal = (WCHAR*)lpwszValueLocal;
dwValueSizeLocal = MultiByteToWideChar(MRA_CODE_PAGE, 0, lpszValue, dwValueSize, lpwszValueLocal, dwValueSizeLocal);
lpwszValueLocal[dwValueSizeLocal] = 0;
- bRet = (CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws) == 0);
+ bRet = (db_set(hContact, lpszModule, lpszValueName, &dbv) == 0);
mir_free(lpwszValueLocal);
}
@@ -297,14 +294,11 @@ BOOL DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, L
LPWSTR lpwszValueLocal = (LPWSTR)mir_calloc(((dwValueSize+MAX_PATH)*sizeof(WCHAR)));
if (lpwszValueLocal) {
- DBCONTACTWRITESETTING cws = {0};
-
- cws.szModule = lpszModule;
- cws.szSetting = lpszValueName;
- cws.value.type = DBVT_WCHAR;
- cws.value.pwszVal = (WCHAR*)lpwszValueLocal;
+ DBVARIANT dbv = {0};
+ dbv.type = DBVT_WCHAR;
+ dbv.pwszVal = (WCHAR*)lpwszValueLocal;
memmove(lpwszValueLocal, lpwszValue, (dwValueSize*sizeof(WCHAR)));
- bRet = (CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws) == 0);
+ bRet = (db_set(hContact, lpszModule, lpszValueName, &dbv) == 0);
mir_free(lpwszValueLocal);
}
@@ -316,18 +310,6 @@ BOOL DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, L
return bRet;
}
-int DB_WriteContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpValue, size_t dwValueSize)
-{
- DBCONTACTWRITESETTING cws = {0};
-
- cws.szModule = lpszModule;
- cws.szSetting = lpszValueName;
- cws.value.type = DBVT_BLOB;
- cws.value.pbVal = (LPBYTE)lpValue;
- cws.value.cpbVal = (WORD)dwValueSize;
- return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
-}
-
BOOL DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize)
{
BOOL bRet = FALSE;
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp
index 5dac1643bf..77ed802696 100644
--- a/protocols/Twitter/src/connection.cpp
+++ b/protocols/Twitter/src/connection.cpp
@@ -43,14 +43,7 @@ inline static T db_pod_get(HANDLE hContact,const char *module,const char *settin
template<typename T>
inline static INT_PTR db_pod_set(HANDLE hContact,const char *module,const char *setting,T val)
{
- DBCONTACTWRITESETTING cws;
-
- cws.szModule = module;
- cws.szSetting = setting;
- cws.value.type = DBVT_BLOB;
- cws.value.cpbVal = sizeof(T);
- cws.value.pbVal = reinterpret_cast<BYTE*>(&val);
- return CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
+ return db_set_blob(hContact, module, setting, &val, sizeof(T));
}
void TwitterProto::SignOn(void*)
diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp
index d15bbd5e6c..ff2763964c 100644
--- a/src/modules/clist/contacts.cpp
+++ b/src/modules/clist/contacts.cpp
@@ -395,23 +395,16 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara
case 0:
if (((LPNMHDR)lParam)->code == PSN_APPLY)
{
- DBCONTACTWRITESETTING cws;
TVITEM tvi;
- int i;
- cws.szModule = "Contact";
- cws.szSetting = "NameOrder";
- cws.value.type = DBVT_BLOB;
- cws.value.cpbVal = SIZEOF(nameOrderDescr);
- cws.value.pbVal = nameOrder;
tvi.hItem = TreeView_GetRoot( GetDlgItem(hwndDlg, IDC_NAMEORDER));
- i=0;
+ int i=0;
while (tvi.hItem != NULL) {
tvi.mask = TVIF_PARAM | TVIF_HANDLE;
TreeView_GetItem( GetDlgItem(hwndDlg, IDC_NAMEORDER), &tvi);
nameOrder[i++] = (BYTE)tvi.lParam;
tvi.hItem = TreeView_GetNextSibling( GetDlgItem(hwndDlg, IDC_NAMEORDER), tvi.hItem);
}
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)(HANDLE)NULL, (LPARAM)&cws);
+ db_set_blob(NULL, "Contact", "NameOrder", nameOrder, SIZEOF(nameOrderDescr));
CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)INVALID_HANDLE_VALUE, 0);
}
break;
diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp
index 6b56ad2f9a..8c5aa31fce 100644
--- a/src/modules/database/dbini.cpp
+++ b/src/modules/database/dbini.cpp
@@ -362,23 +362,17 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf
case 'N':
case 'H':
{
- PBYTE buf;
int len;
char *pszValue, *pszEnd;
- DBCONTACTWRITESETTING cws;
- buf = (PBYTE)mir_alloc(lstrlenA(szValue+1));
+ PBYTE buf = (PBYTE)mir_alloc(lstrlenA(szValue+1));
for (len = 0, pszValue = szValue+1;;len++) {
buf[len] = (BYTE)strtol(pszValue, &pszEnd, 0x10);
- if (pszValue == pszEnd) break;
+ if (pszValue == pszEnd)
+ break;
pszValue = pszEnd;
}
- cws.szModule = szSection;
- cws.szSetting = szName;
- cws.value.type = DBVT_BLOB;
- cws.value.pbVal = buf;
- cws.value.cpbVal = len;
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)(HANDLE)NULL, (LPARAM)&cws);
+ db_set_blob(NULL, szSection, szName, buf, len);
mir_free(buf);
}
break;
diff --git a/src/modules/database/dbintf.cpp b/src/modules/database/dbintf.cpp
index 78102a8e80..4c37e0884a 100644
--- a/src/modules/database/dbintf.cpp
+++ b/src/modules/database/dbintf.cpp
@@ -76,11 +76,6 @@ static INT_PTR srvGetContactSettingStatic(WPARAM wParam,LPARAM lParam)
return (currDb) ? (INT_PTR)currDb->GetContactSettingStatic((HANDLE)wParam, (DBCONTACTGETSETTING*)lParam) : 0;
}
-static INT_PTR srvWriteContactSetting(WPARAM wParam,LPARAM lParam)
-{
- return (currDb) ? (INT_PTR)currDb->WriteContactSetting((HANDLE)wParam, (DBCONTACTWRITESETTING*)lParam) : 0;
-}
-
static INT_PTR srvEnumContactSettings(WPARAM wParam,LPARAM lParam)
{
return (currDb) ? (INT_PTR)currDb->EnumContactSettings((HANDLE)wParam, (DBCONTACTENUMSETTINGS*)lParam) : 0;
@@ -155,7 +150,6 @@ int LoadDbintfModule()
CreateServiceFunction(MS_DB_MODULES_ENUM, srvEnumModuleNames);
CreateServiceFunction(MS_DB_CONTACT_GETSETTINGSTATIC, srvGetContactSettingStatic);
- CreateServiceFunction(MS_DB_CONTACT_WRITESETTING, srvWriteContactSetting);
CreateServiceFunction(MS_DB_CONTACT_ENUMSETTINGS, srvEnumContactSettings);
CreateServiceFunction("DB/ResidentSettings/Enum", srvEnumResidentSettings);