diff options
Diffstat (limited to 'plugins/Dbx_mdb/src/dbsettings.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbsettings.cpp | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/plugins/Dbx_mdb/src/dbsettings.cpp b/plugins/Dbx_mdb/src/dbsettings.cpp index 711b0b45a3..14f6f7d3c5 100644 --- a/plugins/Dbx_mdb/src/dbsettings.cpp +++ b/plugins/Dbx_mdb/src/dbsettings.cpp @@ -222,140 +222,6 @@ LBL_Seek: return 0;
}
-STDMETHODIMP_(BOOL) CDbxMdb::GetContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv)
-{
- dbv->type = 0;
- if (GetContactSettingWorker(contactID, szModule, szSetting, dbv, 0))
- return 1;
-
- if (dbv->type == DBVT_UTF8)
- {
- WCHAR *tmp = NULL;
- char *p = NEWSTR_ALLOCA(dbv->pszVal);
- if (mir_utf8decode(p, &tmp) != NULL)
- {
- BOOL bUsed = FALSE;
- int result = WideCharToMultiByte(m_codePage, WC_NO_BEST_FIT_CHARS, tmp, -1, NULL, 0, NULL, &bUsed);
-
- mir_free(dbv->pszVal);
-
- if (bUsed || result == 0) {
- dbv->type = DBVT_WCHAR;
- dbv->pwszVal = tmp;
- }
- else {
- dbv->type = DBVT_ASCIIZ;
- dbv->pszVal = (char *)mir_alloc(result);
- WideCharToMultiByte(m_codePage, WC_NO_BEST_FIT_CHARS, tmp, -1, dbv->pszVal, result, NULL, NULL);
- mir_free(tmp);
- }
- }
- else
- {
- dbv->type = DBVT_ASCIIZ;
- mir_free(tmp);
- }
- }
-
- return 0;
-}
-
-STDMETHODIMP_(BOOL) CDbxMdb::GetContactSettingStr(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv)
-{
- int iSaveType = dbv->type;
-
- if (GetContactSettingWorker(contactID, szModule, szSetting, dbv, 0))
- return 1;
-
- if (iSaveType == 0 || iSaveType == dbv->type)
- return 0;
-
- if (dbv->type != DBVT_ASCIIZ && dbv->type != DBVT_UTF8)
- return 1;
-
- if (iSaveType == DBVT_WCHAR) {
- if (dbv->type != DBVT_UTF8) {
- int len = MultiByteToWideChar(CP_ACP, 0, dbv->pszVal, -1, NULL, 0);
- wchar_t *wszResult = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (wszResult == NULL)
- return 1;
-
- MultiByteToWideChar(CP_ACP, 0, dbv->pszVal, -1, wszResult, len);
- wszResult[len] = 0;
- mir_free(dbv->pszVal);
- dbv->pwszVal = wszResult;
- }
- else {
- char* savePtr = NEWSTR_ALLOCA(dbv->pszVal);
- mir_free(dbv->pszVal);
- if (!mir_utf8decode(savePtr, &dbv->pwszVal))
- return 1;
- }
- }
- else if (iSaveType == DBVT_UTF8) {
- char* tmpBuf = mir_utf8encode(dbv->pszVal);
- if (tmpBuf == NULL)
- return 1;
-
- mir_free(dbv->pszVal);
- dbv->pszVal = tmpBuf;
- }
- else if (iSaveType == DBVT_ASCIIZ)
- mir_utf8decode(dbv->pszVal, NULL);
-
- dbv->type = iSaveType;
- return 0;
-}
-
-STDMETHODIMP_(BOOL) CDbxMdb::GetContactSettingStatic(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv)
-{
- if (GetContactSettingWorker(contactID, szModule, szSetting, dbv, 1))
- return 1;
-
- if (dbv->type == DBVT_UTF8) {
- mir_utf8decode(dbv->pszVal, NULL);
- dbv->type = DBVT_ASCIIZ;
- }
-
- return 0;
-}
-
-STDMETHODIMP_(BOOL) CDbxMdb::FreeVariant(DBVARIANT *dbv)
-{
- if (dbv == 0) return 1;
-
- switch (dbv->type) {
- case DBVT_ASCIIZ:
- case DBVT_UTF8:
- case DBVT_WCHAR:
- if (dbv->pszVal) mir_free(dbv->pszVal);
- dbv->pszVal = 0;
- break;
- case DBVT_BLOB:
- if (dbv->pbVal) mir_free(dbv->pbVal);
- dbv->pbVal = 0;
- break;
- }
- dbv->type = 0;
- return 0;
-}
-
-STDMETHODIMP_(BOOL) CDbxMdb::SetSettingResident(BOOL bIsResident, const char *pszSettingName)
-{
- char *szSetting = m_cache->GetCachedSetting(NULL, pszSettingName, 0, (int)strlen(pszSettingName));
- szSetting[-1] = (char)bIsResident;
-
- int idx = m_lResidentSettings.getIndex(szSetting);
- if (idx == -1) {
- if (bIsResident)
- m_lResidentSettings.insert(szSetting);
- }
- else if (!bIsResident)
- m_lResidentSettings.remove(idx);
-
- return 0;
-}
-
STDMETHODIMP_(BOOL) CDbxMdb::WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws)
{
if (dbcws == NULL || dbcws->szSetting == NULL || dbcws->szModule == NULL || m_bReadOnly)
|