From 037286255b6a26ed5fba94c5fe9e68b88c1755f7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 23 Jun 2013 21:56:20 +0000 Subject: unifoex moved to the standard db_* functions git-svn-id: http://svn.miranda-ng.org/main/trunk@5103 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../src/ex_import/classExImContactBase.cpp | 34 ++++++++++----------- .../src/ex_import/classExImContactXML.cpp | 4 +-- .../UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 6 ++-- .../src/ex_import/dlg_ExImOpenSaveFile.cpp | 4 +-- .../UserInfoEx/src/ex_import/dlg_ExImProgress.cpp | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp | 8 ++--- plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp | 35 +++++++++++----------- plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 6 ++-- 8 files changed, 45 insertions(+), 54 deletions(-) (limited to 'plugins/UserInfoEx/src/ex_import') 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) { -- cgit v1.2.3