From 30b4c99fc0f89e4a0e1097dfcce9c5728bdfad64 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 12 Mar 2020 20:41:51 +0300 Subject: Jabber: - more logs added for #2243; - code cleaning --- protocols/JabberG/src/jabber_bookmarks.cpp | 4 +- protocols/JabberG/src/jabber_console.cpp | 4 +- protocols/JabberG/src/jabber_disco.cpp | 82 ++++++++++++++++-------------- protocols/JabberG/src/jabber_groupchat.cpp | 2 +- protocols/JabberG/src/jabber_iqid.cpp | 15 +++--- protocols/JabberG/src/jabber_list.h | 2 +- protocols/JabberG/src/jabber_opt.cpp | 36 ++++++------- protocols/JabberG/src/jabber_privacy.cpp | 20 ++++---- protocols/JabberG/src/jabber_thread.cpp | 4 +- protocols/JabberG/src/jabber_userinfo.cpp | 14 ++--- protocols/JabberG/src/stdafx.h | 5 +- 11 files changed, 97 insertions(+), 91 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index 34833cc2e8..7abca8bb6e 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -146,7 +146,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM } break; - case WM_JABBER_CHECK_ONLINE: + case WM_PROTO_CHECK_ONLINE: if (!param->ppro->m_bJabberOnline) EndDialog(hwndDlg, 0); break; @@ -343,6 +343,8 @@ public: { if (item = m_proto->ListGetItemPtrFromIndex(i)) { int itemType = mir_strcmpi(item->type, "conference") ? 1 : 0; + m_proto->debugLogA("BOOKMARK #%d: %d %s", i, itemType, item->jid); + int iItem = m_lvBookmarks.AddItem(item->name, itemType, (LPARAM)item->jid, itemType); m_lvBookmarks.SetItem(iItem, 1, Utf2T(item->jid)); if (itemType == 0) diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 2ec284e4a3..e44fce1c29 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -84,7 +84,7 @@ void CJabberProto::OnConsoleProcessXml(const TiXmlElement *node, DWORD flags) sttRtfAppendXml(&buf, node, flags, 1); sttAppendBufRaw(&buf, RTF_SEPARATOR); sttAppendBufRaw(&buf, RTF_FOOTER); - SendMessage(m_pDlgConsole->GetHwnd(), WM_JABBER_REFRESH, 0, (LPARAM)&buf); + m_pDlgConsole->OnProtoRefresh(0, (LPARAM)&buf); sttEmptyBuf(&buf); } } @@ -456,7 +456,7 @@ public: sttAppendBufRaw(&buf, RTF_ENDPLAINXML); sttAppendBufRaw(&buf, RTF_SEPARATOR); sttAppendBufRaw(&buf, RTF_FOOTER); - SendMessage(m_hwnd, WM_JABBER_REFRESH, 0, (LPARAM)&buf); + OnProtoRefresh(0, (LPARAM)&buf); sttEmptyBuf(&buf); } diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index c909bb5b5c..dcf92cbca1 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -133,7 +133,7 @@ void CJabberProto::OnIqResultServiceDiscoveryInfo(const TiXmlElement *iqNode, CJ if (m_pDlgServiceDiscovery) { ApplyNodeIcon(pNode->GetTreeItemHandle(), pNode); - PostMessage(m_pDlgServiceDiscovery->GetHwnd(), WM_JABBER_REFRESH, 0, 0); + PostMessage(m_pDlgServiceDiscovery->GetHwnd(), WM_PROTO_REFRESH, 0, 0); } } @@ -169,7 +169,7 @@ void CJabberProto::OnIqResultServiceDiscoveryItems(const TiXmlElement *iqNode, C if (m_pDlgServiceDiscovery) { ApplyNodeIcon(pNode->GetTreeItemHandle(), pNode); - PostMessage(m_pDlgServiceDiscovery->GetHwnd(), WM_JABBER_REFRESH, 0, 0); + PostMessage(m_pDlgServiceDiscovery->GetHwnd(), WM_PROTO_REFRESH, 0, 0); } } @@ -189,7 +189,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootInfo(const TiXmlElement *iqNode } lck.unlock(); - UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_REFRESH); + UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_PROTO_REFRESH); } void CJabberProto::OnIqResultServiceDiscoveryRootItems(const TiXmlElement *iqNode, CJabberIqInfo *pInfo) @@ -241,7 +241,7 @@ bool CJabberProto::SendInfoRequest(CJabberSDNode *pNode, TiXmlNode *parent) if (m_pDlgServiceDiscovery) { ApplyNodeIcon(pNode->GetTreeItemHandle(), pNode); - PostMessage(m_pDlgServiceDiscovery->GetHwnd(), WM_JABBER_REFRESH, 0, 0); + PostMessage(m_pDlgServiceDiscovery->GetHwnd(), WM_PROTO_REFRESH, 0, 0); } return true; @@ -288,7 +288,7 @@ bool CJabberProto::SendBothRequests(CJabberSDNode *pNode, TiXmlNode *parent) if (m_pDlgServiceDiscovery) { ApplyNodeIcon(pNode->GetTreeItemHandle(), pNode); - PostMessage(m_pDlgServiceDiscovery->GetHwnd(), WM_JABBER_REFRESH, 0, 0); + PostMessage(m_pDlgServiceDiscovery->GetHwnd(), WM_PROTO_REFRESH, 0, 0); } return true; @@ -370,7 +370,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) } lck.unlock(); - PostMessage(hwndDlg, WM_JABBER_REFRESH, 0, 0); + PostMessage(hwndDlg, WM_PROTO_REFRESH, 0, 0); } bool CJabberProto::IsNodeRegistered(CJabberSDNode *pNode) @@ -620,6 +620,17 @@ public: CSuper::OnDestroy(); } + void OnProtoRefresh(WPARAM, LPARAM) override + { + KillTimer(m_hwnd, REFRESH_TIMER); + if (GetTickCount() - m_proto->m_dwSDLastRefresh < REFRESH_TIMEOUT) { + SetTimer(m_hwnd, REFRESH_TIMER, REFRESH_TIMEOUT, nullptr); + return; + } + + RefreshTimer(); + } + int Resizer(UTILRESIZECONTROL *urc) override { RECT rc; @@ -815,6 +826,32 @@ public: TreeList_SetFilter(GetDlgItem(m_hwnd, IDC_TREE_DISCO), ptrW(m_filter.GetText())); } + void RefreshTimer() + { + mir_cslockfull lck(m_proto->m_SDManager.cs()); + + CJabberSDNode *pNode = m_proto->m_SDManager.GetPrimaryNode(); + while (pNode) { + if (pNode->GetJid()) { + if (!pNode->GetTreeItemHandle()) { + HTREELISTITEM hNewItem = TreeList_AddItem( + GetDlgItem(m_hwnd, IDC_TREE_DISCO), nullptr, + Utf2T(pNode->GetName() ? pNode->GetName() : pNode->GetJid()), + (LPARAM)pNode); + TreeList_AppendColumn(hNewItem, Utf2T(pNode->GetJid())); + TreeList_AppendColumn(hNewItem, Utf2T(pNode->GetNode())); + pNode->SetTreeItemHandle(hNewItem); + } + } + m_proto->SyncTree(nullptr, pNode); + pNode = pNode->GetNext(); + } + lck.unlock(); + TreeList_Update(GetDlgItem(m_hwnd, IDC_TREE_DISCO)); + KillTimer(m_hwnd, REFRESH_TIMER); + m_proto->m_dwSDLastRefresh = GetTickCount(); + } + INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override { BOOL result; @@ -830,40 +867,9 @@ public: } break; - case WM_JABBER_REFRESH: - KillTimer(m_hwnd, REFRESH_TIMER); - if (GetTickCount() - m_proto->m_dwSDLastRefresh < REFRESH_TIMEOUT) { - SetTimer(m_hwnd, REFRESH_TIMER, REFRESH_TIMEOUT, nullptr); - return TRUE; - } - - wParam = REFRESH_TIMER; - __fallthrough; - case WM_TIMER: if (wParam == REFRESH_TIMER) { - mir_cslockfull lck(m_proto->m_SDManager.cs()); - - CJabberSDNode *pNode = m_proto->m_SDManager.GetPrimaryNode(); - while (pNode) { - if (pNode->GetJid()) { - if (!pNode->GetTreeItemHandle()) { - HTREELISTITEM hNewItem = TreeList_AddItem( - GetDlgItem(m_hwnd, IDC_TREE_DISCO), nullptr, - Utf2T(pNode->GetName() ? pNode->GetName() : pNode->GetJid()), - (LPARAM)pNode); - TreeList_AppendColumn(hNewItem, Utf2T(pNode->GetJid())); - TreeList_AppendColumn(hNewItem, Utf2T(pNode->GetNode())); - pNode->SetTreeItemHandle(hNewItem); - } - } - m_proto->SyncTree(nullptr, pNode); - pNode = pNode->GetNext(); - } - lck.unlock(); - TreeList_Update(GetDlgItem(m_hwnd, IDC_TREE_DISCO)); - KillTimer(m_hwnd, REFRESH_TIMER); - m_proto->m_dwSDLastRefresh = GetTickCount(); + RefreshTimer(); return TRUE; } diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 47bd88b9b7..a66b530a67 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -688,7 +688,7 @@ public: } break; - case WM_JABBER_CHECK_ONLINE: + case WM_PROTO_CHECK_ONLINE: if (!m_proto->m_bJabberOnline) EndDialog(m_hwnd, 0); break; diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index ae375fc6f8..4447a88c77 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -137,6 +137,8 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) LISTFOREACH(i, this, LIST_BOOKMARK) { JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i); + debugLogA("BOOKMARK #%d: %s %s", i, item->type, item->jid); + if (item != nullptr && !mir_strcmp(item->type, "conference") && item->bAutoJoin) ll.insert(item); } @@ -491,8 +493,8 @@ void CJabberProto::OnIqResultGetRoster(const TiXmlElement *iqNode, CJabberIqInfo for (auto &it : chatRooms) GroupchatJoinByHContact((DWORD_PTR)it, true); - UI_SAFE_NOTIFY_HWND(m_hwndJabberAddBookmark, WM_JABBER_CHECK_ONLINE); - WindowList_Broadcast(m_hWindowList, WM_JABBER_CHECK_ONLINE, 0, 0); + UI_SAFE_NOTIFY_HWND(m_hwndJabberAddBookmark, WM_PROTO_CHECK_ONLINE); + WindowList_Broadcast(m_hWindowList, WM_PROTO_CHECK_ONLINE, 0, 0); UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH); @@ -1414,6 +1416,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(const TiXmlElement *iqNode, CJabberI const char *autoJ = XmlGetAttr(itemNode, "autojoin"); if (autoJ != nullptr) item->bAutoJoin = !mir_strcmp(autoJ, "true") || !mir_strcmp(autoJ, "1"); + debugLogA("+BOOKMARK %s %s", item->type, item->jid); } else if (!mir_strcmp(name, "url") && (jid = XmlGetAttr(itemNode, "url"))) { JABBER_LIST_ITEM *item = ListAdd(LIST_BOOKMARK, jid); @@ -1424,7 +1427,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(const TiXmlElement *iqNode, CJabberI } } - UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_REFRESH); + UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_PROTO_REFRESH); m_ThreadInfo->bBookmarksLoaded = true; OnProcessLoginRq(m_ThreadInfo, JABBER_LOGIN_BOOKMARKS); } @@ -1433,7 +1436,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(const TiXmlElement *iqNode, CJabberI if (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE) { m_ThreadInfo->jabberServerCaps &= ~JABBER_CAPS_PRIVATE_STORAGE; EnableMenuItems(true); - UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_ACTIVATE); + UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_PROTO_ACTIVATE); } } } @@ -1481,11 +1484,11 @@ void CJabberProto::OnIqResultSetBookmarks(const TiXmlElement *iqNode, CJabberIqI return; if (!mir_strcmp(type, "result")) { - UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_REFRESH); + UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_PROTO_REFRESH); } else if (!mir_strcmp(type, "error")) { MessageBox(nullptr, JabberErrorMsg(iqNode), TranslateT("Jabber Bookmarks Error"), MB_OK | MB_SETFOREGROUND); - UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_ACTIVATE); + UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_PROTO_ACTIVATE); } } diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h index 01a8179805..fd773eaf96 100644 --- a/protocols/JabberG/src/jabber_list.h +++ b/protocols/JabberG/src/jabber_list.h @@ -204,7 +204,7 @@ struct JABBER_LIST_ITEM : public MZeroedObject // jid = string representation of stream id (sid) // ft = file transfer data - //LIST_BOOKMARK + // LIST_BOOKMARK // jid = room JID char *password; // password for room bool bAutoJoin; diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 509f4c94b5..d6c67b4078 100755 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -511,18 +511,19 @@ protected: CheckRegistration(); } - INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override + void OnProtoRefresh(WPARAM, LPARAM lParam) override { - switch (msg) { - case WM_ACTIVATE: - m_chkUseTls.Enable(!m_proto->m_bDisable3920auth && (m_proto->m_bUseSSL ? false : true)); - if (m_proto->m_bDisable3920auth) m_chkUseTls.SetState(BST_UNCHECKED); - break; + RefreshServers((TiXmlElement *)lParam); + } - case WM_JABBER_REFRESH: - RefreshServers((TiXmlElement*)lParam); - break; + INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override + { + if (msg == WM_ACTIVATE) { + m_chkUseTls.Enable(!m_proto->m_bDisable3920auth && !m_proto->m_bUseSSL); + if (m_proto->m_bDisable3920auth) + m_chkUseTls.SetState(BST_UNCHECKED); } + return CSuper::DlgProc(msg, wParam, lParam); } @@ -718,14 +719,14 @@ private: TiXmlDocument doc; if (0 == doc.Parse(result->pData)) { TiXmlElement *queryNode = doc.FirstChildElement("query"); - SendMessage(hwnd, WM_JABBER_REFRESH, 0, (LPARAM)queryNode); + SendMessage(hwnd, WM_PROTO_REFRESH, 0, (LPARAM)queryNode); bIsError = false; } } } if (bIsError) - SendMessage(hwnd, WM_JABBER_REFRESH, 0, 0); + SendMessage(hwnd, WM_PROTO_REFRESH, 0, 0); } }; @@ -1216,14 +1217,9 @@ protected: CheckRegistration(); } - INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override + void OnProtoRefresh(WPARAM, LPARAM lParam) override { - switch (msg) { - case WM_JABBER_REFRESH: - RefreshServers((TiXmlElement*)lParam); - break; - } - return CSuper::DlgProc(msg, wParam, lParam); + RefreshServers((TiXmlElement*)lParam); } private: @@ -1587,7 +1583,7 @@ private: if (0 == doc.Parse(result->pData)) { const TiXmlElement *queryNode = doc.FirstChildElement("query"); if (queryNode && IsWindow(hwnd)) { - SendMessage(hwnd, WM_JABBER_REFRESH, 0, (LPARAM)queryNode); + SendMessage(hwnd, WM_PROTO_REFRESH, 0, (LPARAM)queryNode); bIsError = false; } } @@ -1595,7 +1591,7 @@ private: } if (bIsError) - SendMessage(hwnd, WM_JABBER_REFRESH, 0, 0); + SendMessage(hwnd, WM_PROTO_REFRESH, 0, 0); } }; diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 57dd58ab77..f55d0bbbd8 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -138,7 +138,7 @@ void CJabberProto::OnIqResultPrivacyList(const TiXmlElement *iqNode, CJabberIqIn pList->SetModified(FALSE); lck.unlock(); - UI_SAFE_NOTIFY(m_pDlgPrivacyLists, WM_JABBER_REFRESH); + UI_SAFE_NOTIFY(m_pDlgPrivacyLists, WM_PROTO_REFRESH); } CPrivacyList* GetSelectedList(HWND hDlg) @@ -280,7 +280,7 @@ void CJabberProto::OnIqResultPrivacyLists(const TiXmlElement *iqNode, CJabberIqI szName = XmlGetAttr(node, "name"); m_privacyListManager.SetDefaultListName(szName); } - UI_SAFE_NOTIFY(m_pDlgPrivacyLists, WM_JABBER_REFRESH); + UI_SAFE_NOTIFY(m_pDlgPrivacyLists, WM_PROTO_REFRESH); BuildPrivacyListsMenu(true); } @@ -1707,7 +1707,7 @@ public: int nResult = dlgPrivacyRule.DoModal(); if (nResult) { pList->SetModified(); - PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0); + ::PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0); } } } @@ -1726,7 +1726,7 @@ public: pList->AddRule(pRule); pList->Reorder(); pList->SetModified(); - PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0); + PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0); } else delete pRule; } @@ -1746,7 +1746,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_SETCURSEL, nCurSel != nItemCount - 1 ? nCurSel : nCurSel - 1, 0); pList->Reorder(); pList->SetModified(); - PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0); + PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0); } } @@ -1763,7 +1763,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_SETCURSEL, nCurSel - 1, 0); pList->Reorder(); pList->SetModified(); - PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0); + PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0); } } @@ -1781,7 +1781,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_SETCURSEL, nCurSel + 1, 0); pList->Reorder(); pList->SetModified(); - PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0); + PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0); } } @@ -1812,7 +1812,7 @@ public: } lck.unlock(); - PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0); + PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0); } } @@ -1834,7 +1834,7 @@ public: } lck.unlock(); - PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0); + PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0); } void btnApply_OnClick(CCtrlButton*) @@ -1911,7 +1911,7 @@ public: } SetStatusText(TranslateW(JABBER_PL_BUSY_MSG)); - PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0); + PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0); } void OnCommand_Close(HWND /*hwndCtrl*/, WORD /*idCtrl*/, WORD /*idCode*/) diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 5ba36d7907..36c2018ea3 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -507,8 +507,8 @@ recvRest: ListRemoveList(LIST_CHATROOM); ListRemoveList(LIST_BOOKMARK); - UI_SAFE_NOTIFY_HWND(m_hwndJabberAddBookmark, WM_JABBER_CHECK_ONLINE); - WindowList_Broadcast(m_hWindowList, WM_JABBER_CHECK_ONLINE, 0, 0); + UI_SAFE_NOTIFY_HWND(m_hwndJabberAddBookmark, WM_PROTO_CHECK_ONLINE); + WindowList_Broadcast(m_hWindowList, WM_PROTO_CHECK_ONLINE, 0, 0); // Set status to offline debugLogA("m_iDesiredStatus reset to (%d,%d) => %d", m_iStatus, m_iDesiredStatus, ID_STATUS_OFFLINE); diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 5e17ec4c46..de7dfc1669 100755 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -416,7 +416,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa } break; - case WM_JABBER_CHECK_ONLINE: + case WM_PROTO_CHECK_ONLINE: if (dat && dat->ppro) if (!dat->ppro->m_bJabberOnline) { dat->item = nullptr; @@ -424,7 +424,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa } __fallthrough; - case WM_JABBER_REFRESH: + case WM_PROTO_REFRESH: if (dat == nullptr) break; if (dat->item == nullptr) { @@ -511,7 +511,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa if (((LPNMHDR)lParam)->idFrom == 0) { switch (((LPNMHDR)lParam)->code) { case PSN_INFOCHANGED: - SendMessage(hwndDlg, WM_JABBER_REFRESH, 0, ((LPPSHNOTIFY)lParam)->lParam); // hContact + SendMessage(hwndDlg, WM_PROTO_REFRESH, 0, ((LPPSHNOTIFY)lParam)->lParam); // hContact break; case PSN_PARAMCHANGED: @@ -580,7 +580,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP case 0: switch (((LPNMHDR)lParam)->code) { case PSN_INFOCHANGED: - SendMessage(hwndDlg, WM_JABBER_REFRESH, 0, 0); + SendMessage(hwndDlg, WM_PROTO_REFRESH, 0, 0); break; case PSN_PARAMCHANGED: @@ -591,7 +591,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP } break; - case WM_JABBER_REFRESH: + case WM_PROTO_REFRESH: if (photoInfo->hBitmap) { DeleteObject(photoInfo->hBitmap); photoInfo->hBitmap = nullptr; @@ -804,7 +804,7 @@ void JabberUserInfoUninit() void JabberUserInfoUpdate(MCONTACT hContact) { if (!hContact) - WindowList_BroadcastAsync(hUserInfoList, WM_JABBER_REFRESH, 0, 0); + WindowList_BroadcastAsync(hUserInfoList, WM_PROTO_REFRESH, 0, 0); else if (HWND hwnd = WindowList_Find(hUserInfoList, hContact)) - PostMessage(hwnd, WM_JABBER_REFRESH, 0, 0); + PostMessage(hwnd, WM_PROTO_REFRESH, 0, 0); } diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index 78f7a10173..1cfc249659 100755 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -130,6 +130,8 @@ struct CMPlugin : public ACCPROTOPLUGIN class CJabberDlgBase : public CProtoDlgBase { typedef CProtoDlgBase CSuper; + friend struct CJabberProto; + protected: __inline CJabberDlgBase(CJabberProto *proto, int idDialog) : CSuper(proto, idDialog) @@ -178,9 +180,6 @@ protected: #define WM_JABBER_AGENT_REFRESH (WM_PROTO_LAST + 101) #define WM_JABBER_TRANSPORT_REFRESH (WM_PROTO_LAST + 102) #define WM_JABBER_REGINPUT_ACTIVATE (WM_PROTO_LAST + 103) -#define WM_JABBER_REFRESH WM_PROTO_REFRESH -#define WM_JABBER_CHECK_ONLINE WM_PROTO_CHECK_ONLINE -#define WM_JABBER_ACTIVATE WM_PROTO_ACTIVATE #define WM_JABBER_CHANGED (WM_PROTO_LAST + 106) #define WM_JABBER_SET_FONT (WM_PROTO_LAST + 108) #define WM_JABBER_FLASHWND (WM_PROTO_LAST + 109) -- cgit v1.2.3