summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-06 17:29:19 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-06 17:29:19 +0000
commit108d0abc52b5a37be5b07d54aa31394224f671c2 (patch)
treee87f302b0ed5affb590b64a9f402c7987b46e334 /plugins
parentf6d53c90114069402b549aa7c0bc79044aace51d (diff)
fix for decoding settings
git-svn-id: http://svn.miranda-ng.org/main/trunk@7523 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Db3x_mmap/src/dbcrypt.cpp6
-rw-r--r--plugins/Db3x_mmap/src/dbintf.h3
-rw-r--r--plugins/Db3x_mmap/src/dbsettings.cpp15
3 files changed, 17 insertions, 7 deletions
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp
index 18d9fd5043..155aa04eee 100644
--- a/plugins/Db3x_mmap/src/dbcrypt.cpp
+++ b/plugins/Db3x_mmap/src/dbcrypt.cpp
@@ -360,9 +360,9 @@ void CDb3Mmap::ToggleSettingsEncryption(HANDLE hContact)
ptrA decoded(m_crypto->decodeString((PBYTE)(char*)p.szValue, p.iLen, &realLen));
if (decoded != NULL) {
DBCONTACTWRITESETTING dbcws = { szModule, p.szVar };
- dbcws.value.type = DBVT_UTF8;
+ dbcws.value.type = DBVT_UNENCRYPTED;
dbcws.value.pszVal = decoded;
- dbcws.value.cchVal = (WORD)len;
+ dbcws.value.cchVal = (WORD)realLen;
WriteContactSetting(hContact, &dbcws);
}
}
@@ -371,7 +371,7 @@ void CDb3Mmap::ToggleSettingsEncryption(HANDLE hContact)
if (!ofsNext)
break;
- setting = (DBContactSettings *)DBRead(offset = ofsNext, sizeof(DBContactSettings), NULL);
+ setting = (DBContactSettings*)DBRead(offset = ofsNext, sizeof(DBContactSettings), NULL);
if ((szModule = GetModuleNameByOfs(setting->ofsModuleName)) == NULL)
break;
}
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h
index 3e76d9a49a..92e8a9e0b0 100644
--- a/plugins/Db3x_mmap/src/dbintf.h
+++ b/plugins/Db3x_mmap/src/dbintf.h
@@ -52,7 +52,8 @@ DBHeader
#define WSOFS_END 0xFFFFFFFF
#define WS_ERROR 0xFFFFFFFF
-#define DBVT_ENCRYPTED 250
+#define DBVT_ENCRYPTED 250
+#define DBVT_UNENCRYPTED 251
#define NeedBytes(n) if (bytesRemaining<(n)) pBlob = (PBYTE)DBRead(ofsBlobPtr,(n),&bytesRemaining)
#define MoveAlong(n) {int x = n; pBlob += (x); ofsBlobPtr += (x); bytesRemaining -= (x);}
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp
index 6598890072..34d60c68a4 100644
--- a/plugins/Db3x_mmap/src/dbsettings.cpp
+++ b/plugins/Db3x_mmap/src/dbsettings.cpp
@@ -402,10 +402,13 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT
switch (dbcwWork.value.type) {
case DBVT_BYTE: case DBVT_WORD: case DBVT_DWORD:
break;
+
case DBVT_ASCIIZ: case DBVT_UTF8:
- if (dbcwWork.value.pszVal == NULL) return 1;
- dbcwWork.value.cchVal = (WORD)strlen(dbcwWork.value.pszVal);
bIsEncrypted = m_bEncrypted || ::isEncrypted(dbcws->szModule, dbcws->szSetting);
+LBL_WriteString:
+ if (dbcwWork.value.pszVal == NULL)
+ return 1;
+ dbcwWork.value.cchVal = (WORD)strlen(dbcwWork.value.pszVal);
if (bIsEncrypted) {
size_t len;
BYTE *pResult = m_crypto->encodeString(dbcwWork.value.pszVal, &len);
@@ -416,8 +419,14 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT
}
}
break;
+
+ case DBVT_UNENCRYPTED:
+ dbcwNotif.value.type = dbcwWork.value.type = DBVT_UTF8;
+ goto LBL_WriteString;
+
case DBVT_BLOB: case DBVT_ENCRYPTED:
- if (dbcwWork.value.pbVal == NULL) return 1;
+ if (dbcwWork.value.pbVal == NULL)
+ return 1;
break;
default:
return 1;