From c28421bd29ffc9ae33839c8271d145ab9aef2b00 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 5 Apr 2020 14:09:22 +0300 Subject: =?UTF-8?q?fixes=20#2290=20(SecureIM:=20=D1=80=D0=B0=D1=81=D0=BF?= =?UTF-8?q?=D0=B8=D0=BB=D0=B8=D1=82=D1=8C=20=D1=81=D1=82=D0=BE=D0=BB=D0=B1?= =?UTF-8?q?=D0=B5=D1=86=20"User=20ID"=20=D0=BD=D0=B0=20=D0=B4=D0=B2=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/SecureIM/src/options.cpp | 42 +++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'plugins/SecureIM/src/options.cpp') diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 4f17f26e38..5043497cf2 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -105,7 +105,7 @@ static void setListViewMode(HWND hLV, UINT iItem, UINT iMode) extern LPCSTR sim231[]; char tmp[256]; strncpy(tmp, Translate(sim231[iMode]), sizeof(tmp) - 1); - LV_SetItemTextA(hLV, iItem, 2, tmp); + LV_SetItemTextA(hLV, iItem, 3, tmp); } static void setListViewStatus(HWND hLV, UINT iItem, UINT iStatus) @@ -113,13 +113,13 @@ static void setListViewStatus(HWND hLV, UINT iItem, UINT iStatus) extern LPCSTR sim232[]; char tmp[128]; strncpy(tmp, Translate(sim232[iStatus]), sizeof(tmp) - 1); - LV_SetItemTextA(hLV, iItem, 3, tmp); + LV_SetItemTextA(hLV, iItem, 4, tmp); } static UINT getListViewPSK(HWND hLV, UINT iItem) { char str[128]; - LV_GetItemTextA(hLV, iItem, 4, str, _countof(str)); + LV_GetItemTextA(hLV, iItem, 5, str, _countof(str)); return strncmp(str, Translate("PSK"), sizeof(str)) == 0; } @@ -127,13 +127,13 @@ static void setListViewPSK(HWND hLV, UINT iItem, UINT iStatus) { char str[128]; strncpy(str, (iStatus) ? Translate("PSK") : "-", sizeof(str) - 1); - LV_SetItemTextA(hLV, iItem, 4, str); + LV_SetItemTextA(hLV, iItem, 5, str); } static UINT getListViewPUB(HWND hLV, UINT iItem) { char str[128]; - LV_GetItemTextA(hLV, iItem, 4, str, _countof(str)); + LV_GetItemTextA(hLV, iItem, 5, str, _countof(str)); return strncmp(str, Translate("PUB"), sizeof(str)) == 0; } @@ -141,7 +141,7 @@ static void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus) { char str[128]; strncpy(str, (iStatus) ? Translate("PUB") : "-", sizeof(str) - 1); - LV_SetItemTextA(hLV, iItem, 4, str); + LV_SetItemTextA(hLV, iItem, 5, str); LPSTR sha = nullptr; if (iStatus) { @@ -156,10 +156,10 @@ static void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus) } } if (sha) { - LV_SetItemTextA(hLV, iItem, 5, sha); + LV_SetItemTextA(hLV, iItem, 6, sha); mir_free(sha); } - else LV_SetItemTextA(hLV, iItem, 5, ""); + else LV_SetItemTextA(hLV, iItem, 6, ""); } static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) @@ -412,6 +412,10 @@ static void ResetGeneralDlg(HWND hDlg) lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; for (auto &hContact : Contacts()) { + auto *pa = Proto_GetAccount(Proto_GetBaseAccountName(hContact)); + if (!pa) + continue; + if (!isSecureProtocol(hContact) || isChatRoom(hContact)) continue; @@ -428,9 +432,10 @@ static void ResetGeneralDlg(HWND hDlg) lvi.pszText = Clist_GetContactDisplayName(hContact); int itemNum = LV_InsertItem(hLV, &lvi); - wchar_t tmp[NAMSIZE]; - getContactUin(hContact, tmp); - LV_SetItemText(hLV, itemNum, 1, tmp); + LV_SetItemText(hLV, itemNum, 1, pa->tszAccountName); + + ptrW uid(Contact_GetInfo(CNF_UNIQUEID, hContact, pa->szModuleName)); + LV_SetItemText(hLV, itemNum, 2, uid); setListViewMode(hLV, itemNum, ptr->tmode); setListViewStatus(hLV, itemNum, ptr->tstatus); @@ -480,10 +485,9 @@ static void RefreshGeneralDlg(HWND hDlg, BOOL iInit) LVITEMW lvi; memset(&lvi, 0, sizeof(lvi)); lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; - wchar_t tmp[NAMSIZE]; - for (auto &hContact : Contacts()) { - if (!Proto_GetAccount(Proto_GetBaseAccountName(hContact))) + auto *pa = Proto_GetAccount(Proto_GetBaseAccountName(hContact)); + if (!pa) continue; pUinKey ptr = getUinKey(hContact); @@ -499,8 +503,10 @@ static void RefreshGeneralDlg(HWND hDlg, BOOL iInit) lvi.pszText = Clist_GetContactDisplayName(hContact); int itemNum = LV_InsertItem(hLV, &lvi); - getContactUin(hContact, tmp); - LV_SetItemText(hLV, itemNum, 1, tmp); + LV_SetItemText(hLV, itemNum, 1, pa->tszAccountName); + + ptrW uid(Contact_GetInfo(CNF_UNIQUEID, hContact, pa->szModuleName)); + LV_SetItemText(hLV, itemNum, 2, uid); setListViewMode(hLV, itemNum, ptr->tmode); setListViewStatus(hLV, itemNum, ptr->tstatus); @@ -652,8 +658,8 @@ static INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wPara ListView_SetImageList(hLV, hSmall, LVSIL_SMALL); ListView_SetImageList(hLV, hLarge, LVSIL_NORMAL); { - static const char *szColHdr[] = { LPGEN("Nickname"), LPGEN("User ID"), LPGEN("Mode"), LPGEN("Status"), "", "SHA-1" }; - static int iColWidth[] = { 150, 110, 60, 55, 35, 330 }; + static const char *szColHdr[] = { LPGEN("Nickname"), LPGEN("Account"), LPGEN("User ID"), LPGEN("Mode"), LPGEN("Status"), "", "SHA-1" }; + static int iColWidth[] = { 150, 70, 70, 60, 55, 35, 330 }; LVCOLUMN lvc; lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; -- cgit v1.2.3