diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2014-11-02 11:19:25 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2014-11-02 11:19:25 +0000 |
commit | 4fb42b711df5d8a9986d9587d7a1edc72f13eb0c (patch) | |
tree | 50d1b643508145fde1e99fe3a95cc72070d00f6f /plugins/NewsAggregator/Src/Authentication.cpp | |
parent | b31a2b228e4585acc015760aa7e84ddf1312bc8d (diff) |
NewsAggregator:
-Fixed memory leak
-Fixed crash when server isn't available
-performance improvements
git-svn-id: http://svn.miranda-ng.org/main/trunk@10899 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewsAggregator/Src/Authentication.cpp')
-rw-r--r-- | plugins/NewsAggregator/Src/Authentication.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp index 47918c4706..5d3a56b645 100644 --- a/plugins/NewsAggregator/Src/Authentication.cpp +++ b/plugins/NewsAggregator/Src/Authentication.cpp @@ -21,24 +21,19 @@ Boston, MA 02111-1307, USA. void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg)
{
- DBVARIANT dbv;
- char *user = NULL, *pass = NULL;
- TCHAR *tlogin = NULL, *tpass = NULL, buf[MAX_PATH] = {0};
+ TCHAR *tlogin = NULL, *tpass = NULL;
if (hContact && db_get_b(hContact, MODULE, "UseAuth", 0)) {
- if (!db_get_ts(hContact, MODULE, "Login", &dbv)) {
- tlogin = mir_tstrdup(dbv.ptszVal);
- db_free(&dbv);
- }
+ tlogin = db_get_tsa(hContact, MODULE, "Login");
tpass = db_get_tsa(hContact, MODULE, "Password");
}
else if (hwndDlg && IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
+ TCHAR buf[MAX_PATH] = {0};
GetDlgItemText(hwndDlg, IDC_LOGIN, buf, SIZEOF(buf));
tlogin = mir_tstrdup(buf);
GetDlgItemText(hwndDlg, IDC_PASSWORD, buf, SIZEOF(buf));
tpass = mir_tstrdup(buf);
}
- user = mir_t2a(tlogin);
- pass = mir_t2a(tpass);
+ char *user = mir_t2a(tlogin), *pass = mir_t2a(tpass);
char str[MAX_PATH];
int len = mir_snprintf(str, SIZEOF(str), "%s:%s", user, pass);
@@ -69,14 +64,17 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
}
else if (SelItem.hContact) {
- DBVARIANT dbv;
- if (!db_get_ts(SelItem.hContact, MODULE, "Nick", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_FEEDNAME, dbv.ptszVal);
- db_free(&dbv);
+ TCHAR *ptszNick = db_get_tsa(SelItem.hContact, MODULE, "Nick");
+ if (ptszNick) {
+ SetDlgItemText(hwndDlg, IDC_FEEDNAME, ptszNick);
+ mir_free(ptszNick);
}
- else if (!db_get_ts(SelItem.hContact, MODULE, "URL", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_FEEDNAME, dbv.ptszVal);
- db_free(&dbv);
+ else {
+ TCHAR *ptszURL = db_get_tsa(SelItem.hContact, MODULE, "URL");
+ if (ptszURL) {
+ SetDlgItemText(hwndDlg, IDC_FEEDNAME, ptszURL);
+ mir_free(ptszURL);
+ }
}
}
}
|