From 7bdb598e26e7e98788933af43090d34027166969 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 14 Sep 2016 18:01:49 +0000 Subject: second major wipeout of database services & structures: - DBCONTACTENUMSETTINGS removed; - all helpers moved to mir_core.dll git-svn-id: http://svn.miranda-ng.org/main/trunk@17296 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../src/ex_import/classExImContactBase.cpp | 6 +-- .../src/ex_import/classExImContactXML.cpp | 4 +- plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 8 ++-- plugins/UserInfoEx/src/mir_db.cpp | 43 ++-------------------- plugins/UserInfoEx/src/mir_db.h | 6 --- 5 files changed, 12 insertions(+), 55 deletions(-) (limited to 'plugins/UserInfoEx') diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index b8d878b188..34eb007d36 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -236,18 +236,18 @@ MCONTACT CExImContactBase::toDB() } // create new contact - _hContact = DB::Contact::Add(); + _hContact = db_add_contact(); if (!_hContact) { return _hContact = INVALID_CONTACT_ID; } // Add the protocol to the new contact if (Proto_AddToContact(_hContact, _pszProto)) { - DB::Contact::Delete(_hContact); + db_delete_contact(_hContact); return _hContact = INVALID_CONTACT_ID; } // write uid to protocol module if (db_set(_hContact, _pszProto, _pszUIDKey, &_dbvUID)) { - DB::Contact::Delete(_hContact); + db_delete_contact(_hContact); return _hContact = INVALID_CONTACT_ID; } // write nick and display name diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index 4a9b06f82e..c3b8f48f8e 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -607,7 +607,7 @@ int CExImContactXML::ImportContact() LPGENW("Importing a new contact was aborted!"), LPGENW("You aborted import of a new contact.\nSome information may be missing for this contact.\n\nDo you want to delete the incomplete contact?")); if (result == IDYES) { - DB::Contact::Delete(_hContact); + db_delete_contact(_hContact); _hContact = INVALID_CONTACT_ID; } } @@ -749,7 +749,7 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact) MIR_FREE(ptszNick); MIR_FREE(ptszMetaNick); if (result == IDYES) { - DB::Contact::Delete(_hContact); + db_delete_contact(_hContact); _hContact = INVALID_CONTACT_ID; } } diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 2ac2aaa37d..aee6a83b5f 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -366,11 +366,11 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) int ret; // disable database safty mode to speed up the operation - CallService(MS_DB_SETSAFETYMODE, 0, 0); + db_set_safety_mode(0); // import owner contact ret = ImportOwner(xmlCard->FirstChildElement(XKEY_OWNER)); // as soon as possible enable safty mode again! - CallService(MS_DB_SETSAFETYMODE, 1, 0); + db_set_safety_mode(1); if (!ret) { MsgBox(NULL, MB_ICONINFORMATION, @@ -395,11 +395,11 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) if (_numContactsTodo > 0) { _progress.SetContactCount(_numContactsTodo); // disable database safty mode to speed up the operation - CallService(MS_DB_SETSAFETYMODE, 0, 0); + db_set_safety_mode(0); // import the contacts ImportContacts(xmlCard); // as soon as possible enable safty mode again! - CallService(MS_DB_SETSAFETYMODE, 1, 0); + db_set_safety_mode(1); } // finally hide the progress dialog _progress.Hide(); diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index 6bf79fc8e7..f1b8feaf83 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -28,36 +28,6 @@ namespace DB { **/ namespace Contact { - -/** - * Gets the number of contacts in the database, which does not count the user - * @param hContact - handle to the contact - * @return Returns the number of contacts. They can be retrieved using - * contact/findfirst and contact/findnext - **/ -INT_PTR GetCount() -{ - return CallService(MS_DB_CONTACT_GETCOUNT, 0, 0); -} - -/** - * Simply adds a new contact without setting up any protocol or something else - * @return HANDLE The function returns the HANDLE of the new contact - **/ -MCONTACT Add() -{ - return (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); -} - -/** - * This function deletes a contact from the database. - * @param hContact - handle to the contact - **/ -BYTE Delete(MCONTACT hContact) -{ - return CallService(MS_DB_CONTACT_DELETE, hContact, 0) != 0; -} - /** * This function trys to guess, when an ICQ contact was added to database. **/ @@ -121,10 +91,7 @@ static int IsEmptyEnumProc(LPCSTR, LPARAM) bool IsEmpty(MCONTACT hContact, LPCSTR pszModule) { - DBCONTACTENUMSETTINGS dbces = { 0 }; - dbces.pfnEnumProc = IsEmptyEnumProc; - dbces.szModule = pszModule; - return (0 > CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces)); + return 0 > db_enum_settings(hContact, IsEmptyEnumProc, pszModule); } /** @@ -755,7 +722,7 @@ LPSTR CEnumList::Insert(LPCSTR str) INT_PTR CEnumList::EnumModules() { - return CallService(MS_DB_MODULES_ENUM, (WPARAM)this, (LPARAM)CEnumList::EnumProc); + return db_enum_modules(CEnumList::EnumProc, this); } /** @@ -765,11 +732,7 @@ INT_PTR CEnumList::EnumModules() INT_PTR CEnumList::EnumSettings(MCONTACT hContact, LPCSTR pszModule) { - DBCONTACTENUMSETTINGS dbces = { 0 }; - dbces.pfnEnumProc = (DBSETTINGENUMPROC)CEnumList::EnumSettingsProc; - dbces.szModule = pszModule; - dbces.lParam = (LPARAM)this; - return CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces); + return db_enum_settings(hContact, &CEnumList::EnumSettingsProc, pszModule, this); } } /* namespace DB */ \ No newline at end of file diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h index 6b83a4e3a5..a9897306b5 100644 --- a/plugins/UserInfoEx/src/mir_db.h +++ b/plugins/UserInfoEx/src/mir_db.h @@ -32,13 +32,7 @@ namespace Contact { { return pcli->pfnGetContactDisplayName(hContact, 0); } - INT_PTR GetCount(); - - MCONTACT Add(); - BYTE Delete(MCONTACT hContact); - DWORD WhenAdded(DWORD dwUIN, LPCSTR szBaseProto); - } /* namespace Contact */ namespace Module { -- cgit v1.2.3