diff options
Diffstat (limited to 'src/mir_app/src/findadd.cpp')
-rw-r--r-- | src/mir_app/src/findadd.cpp | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 8d6fd86e88..0a66352c4a 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -745,36 +745,28 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_ADD: - { - ADDCONTACTSTRUCT acs = { 0 }; - - if (ListView_GetSelectedCount(hwndList) == 1) { - LVITEM lvi; - lvi.mask = LVIF_PARAM; - lvi.iItem = ListView_GetNextItem(hwndList, -1, LVNI_ALL | LVNI_SELECTED); - ListView_GetItem(hwndList, &lvi); - ListSearchResult *lsr = (ListSearchResult*)lvi.lParam; - acs.szProto = lsr->szProto; - acs.psr = &lsr->psr; - } - else { - wchar_t str[256]; - GetDlgItemText(hwndDlg, IDC_PROTOID, str, _countof(str)); - if (*rtrimw(str) == 0) - break; - - PROTOSEARCHRESULT psr = { 0 }; - psr.cbSize = sizeof(psr); - psr.flags = PSR_UNICODE; - psr.id.w = str; + if (ListView_GetSelectedCount(hwndList) == 1) { + LVITEM lvi; + lvi.mask = LVIF_PARAM; + lvi.iItem = ListView_GetNextItem(hwndList, -1, LVNI_ALL | LVNI_SELECTED); + ListView_GetItem(hwndList, &lvi); + ListSearchResult *lsr = (ListSearchResult*)lvi.lParam; + Contact_AddBySearch(lsr->szProto, &lsr->psr, hwndDlg); + } + else { + wchar_t str[256]; + GetDlgItemText(hwndDlg, IDC_PROTOID, str, _countof(str)); + if (*rtrimw(str) == 0) + break; - acs.psr = &psr; - acs.szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, - SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); - } + char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, + SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); - acs.handleType = HANDLE_SEARCHRESULT; - CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); + PROTOSEARCHRESULT psr = { 0 }; + psr.cbSize = sizeof(psr); + psr.flags = PSR_UNICODE; + psr.id.w = str; + Contact_AddBySearch(szProto, &psr, hwndDlg); } break; |