diff options
author | George Hazan <george.hazan@gmail.com> | 2013-11-19 21:44:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-11-19 21:44:15 +0000 |
commit | a90a4275934b9b3c5889b3fbf3fb312a83714ede (patch) | |
tree | d5df88983626f23a235dc4169c910a5480269b25 /protocols/JabberG/src/jabber_std.cpp | |
parent | 60802648ddc84982418db8d8eb8ec40fa385a8ae (diff) |
password converter for Jabber
git-svn-id: http://svn.miranda-ng.org/main/trunk@6944 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_std.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_std.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp index daf1078a8f..cd6f95e4a1 100644 --- a/protocols/JabberG/src/jabber_std.cpp +++ b/protocols/JabberG/src/jabber_std.cpp @@ -40,10 +40,10 @@ void __forceinline sttCryptString(char *str) }
}
-TCHAR* CJabberProto::JGetStringCrypt(HANDLE hContact, char *valueName)
+static TCHAR* JSetStringCrypt(LPCSTR szModule, HANDLE hContact, char *valueName)
{
DBVARIANT dbv;
- if ( db_get_s(hContact, m_szModuleName, valueName, &dbv))
+ if (db_get_s(hContact, szModule, valueName, &dbv))
return NULL;
sttCryptString(dbv.pszVal);
@@ -52,11 +52,36 @@ TCHAR* CJabberProto::JGetStringCrypt(HANDLE hContact, char *valueName) return res;
}
-DWORD CJabberProto::JSetStringCrypt(HANDLE hContact, char *valueName, const TCHAR *parValue)
+void CJabberProto::ConvertPasswords()
{
- char *tmp = mir_utf8encodeT(parValue);
- sttCryptString(tmp);
- setString(hContact, valueName, tmp);
- mir_free(tmp);
- return 0;
-}
+ ptrT passw(JSetStringCrypt(m_szModuleName, NULL, "LoginPassword"));
+ if (passw == NULL)
+ return;
+
+ setTString("Password", passw);
+ delSetting("LoginPassword");
+
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ if ((passw = JSetStringCrypt(m_szModuleName, hContact, "LoginPassword")) == NULL)
+ continue;
+
+ setTString(hContact, "Password", passw);
+ delSetting(hContact, "LoginPassword");
+ }
+
+ for (int i = 0;; i++) {
+ char varName[100];
+ mir_snprintf(varName, sizeof(varName), "rcMuc_%d_server", i);
+ ptrA str(getStringA(NULL, varName));
+ if (str == NULL)
+ break;
+
+ mir_snprintf(varName, sizeof(varName), "rcMuc_%d", i);
+ if ((passw = JSetStringCrypt(m_szModuleName, NULL, varName)) != NULL) {
+ delSetting(varName);
+
+ mir_snprintf(varName, sizeof(varName), "password_rcMuc_%d", i);
+ setTString(varName, passw);
+ }
+ }
+}
\ No newline at end of file |