diff options
author | George Hazan <ghazan@miranda.im> | 2022-07-29 18:41:09 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-07-29 18:41:09 +0300 |
commit | 05eb7b2b067f366d9575be05f0f6bb90cb26a972 (patch) | |
tree | a59a4a9680e330d18c2dccbad7dd329adb2add57 /protocols/JabberG/src | |
parent | 8afcca9538a45e834bb0d69658ab6cfd8a437bf3 (diff) |
fixes #3110 (remove Jabber frame)
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r-- | protocols/JabberG/src/jabber_frame.cpp | 502 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iq_handlers.cpp | 1 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 11 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 27 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 16 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_util.cpp | 65 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_xstatus.cpp | 18 | ||||
-rw-r--r-- | protocols/JabberG/src/stdafx.h | 65 |
10 files changed, 3 insertions, 706 deletions
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp deleted file mode 100644 index b59791eb92..0000000000 --- a/protocols/JabberG/src/jabber_frame.cpp +++ /dev/null @@ -1,502 +0,0 @@ -/*
-
-Jabber Protocol Plugin for Miranda NG
-
-Copyright (c) 2002-04 Santithorn Bunchua
-Copyright (c) 2005-12 George Hazan
-Copyright (c) 2007 Maxim Mluhov
-Copyright (C) 2012-22 Miranda NG team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#include "stdafx.h"
-#include "jabber_caps.h"
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// CJabberInfoFrame
-
-class CJabberInfoFrameItem : public MZeroedObject
-{
-public:
- char *m_pszName;
- HANDLE m_hIcolibIcon;
- wchar_t *m_pszText;
- LPARAM m_pUserData;
- bool m_bCompact;
- bool m_bShow;
- RECT m_rcItem;
- int m_tooltipId;
-
- void (CJabberProto::*m_onEvent)(CJabberInfoFrame_Event*);
-
-public:
- CJabberInfoFrameItem(char *pszName, bool bCompact = false, LPARAM pUserData = 0) :
- m_bShow(true), m_bCompact(bCompact), m_pUserData(pUserData)
- {
- m_pszName = mir_strdup(pszName);
- }
-
- ~CJabberInfoFrameItem()
- {
- mir_free(m_pszName);
- mir_free(m_pszText);
- }
-
- void SetInfo(HANDLE hIcolibIcon, wchar_t *pszText)
- {
- mir_free(m_pszText);
- m_pszText = pszText ? mir_wstrdup(pszText) : nullptr;
- m_hIcolibIcon = hIcolibIcon;
- }
-
- static int cmp(const CJabberInfoFrameItem *p1, const CJabberInfoFrameItem *p2)
- {
- return mir_strcmp(p1->m_pszName, p2->m_pszName);
- }
-};
-
-CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto) :
- m_pItems(3, CJabberInfoFrameItem::cmp), m_compact(false)
-{
- m_proto = proto;
- m_clickedItem = -1;
-
- InitClass();
-
- CLISTFrame frame = { sizeof(frame) };
- HWND hwndClist = g_clistApi.hwndContactList;
- frame.hWnd = CreateWindowEx(0, L"JabberInfoFrameClass", nullptr, WS_CHILD | WS_VISIBLE, 0, 0, 100, 100, hwndClist, nullptr, g_plugin.getInst(), this);
- frame.align = alBottom;
- frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default
- frame.Flags = F_VISIBLE | F_LOCKED | F_NOBORDER | F_UNICODE;
- frame.szName.w = mir_a2u(proto->m_szModuleName);
- frame.szTBname.w = proto->m_tszUserName;
- m_frameId = g_plugin.addFrame(&frame);
- mir_free(frame.szName.w);
- if (m_frameId == -1) {
- DestroyWindow(frame.hWnd);
- return;
- }
-
- m_hhkFontsChanged = HookEventMessage(ME_FONT_RELOAD, m_hwnd, WM_APP);
- ReloadFonts();
-
- m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr,
- WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- m_hwnd, nullptr, g_plugin.getInst(), nullptr);
- SetWindowPos(m_hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
-
- CreateInfoItem("$", true);
- UpdateInfoItem("$", proto->m_hProtoIcon, proto->m_tszUserName);
-
- CreateInfoItem("$/JID", true);
- UpdateInfoItem("$/JID", Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS), L"Offline");
- SetInfoItemCallback("$/JID", &CJabberProto::InfoFrame_OnSetup);
-}
-
-CJabberInfoFrame::~CJabberInfoFrame()
-{
- CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)m_frameId, 0);
-
- if (m_hhkFontsChanged)
- UnhookEvent(m_hhkFontsChanged);
-
- if (m_hwnd != nullptr) {
- SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
- DestroyWindow(m_hwnd);
- DestroyWindow(m_hwndToolTip);
- DeleteObject(m_hfntText);
- DeleteObject(m_hfntTitle);
- m_hwnd = nullptr;
- }
-}
-
-void CJabberInfoFrame::InitClass()
-{
- static bool bClassRegistered = false;
- if (bClassRegistered)
- return;
-
- WNDCLASSEX wcx = { 0 };
- wcx.cbSize = sizeof(wcx);
- wcx.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
- wcx.lpfnWndProc = GlobalWndProc;
- wcx.hInstance = g_plugin.getInst();
- wcx.lpszClassName = L"JabberInfoFrameClass";
- wcx.hCursor = LoadCursor(nullptr, IDC_ARROW);
- RegisterClassEx(&wcx);
- bClassRegistered = true;
-}
-
-LRESULT CALLBACK CJabberInfoFrame::GlobalWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- CJabberInfoFrame *pFrame;
-
- if (msg == WM_CREATE) {
- CREATESTRUCT *pcs = (CREATESTRUCT *)lParam;
- pFrame = (CJabberInfoFrame *)pcs->lpCreateParams;
- if (pFrame) pFrame->m_hwnd = hwnd;
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pFrame);
- }
- else pFrame = (CJabberInfoFrame *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-
- return pFrame ? pFrame->WndProc(msg, wParam, lParam) : DefWindowProc(hwnd, msg, wParam, lParam);
-}
-
-LRESULT CJabberInfoFrame::WndProc(UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_APP:
- ReloadFonts();
- return 0;
-
- case WM_PAINT:
- {
- RECT rc; GetClientRect(m_hwnd, &rc);
- m_compact = rc.bottom < (2 * (GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING) + SZ_LINESPACING + 2 * SZ_FRAMEPADDING);
-
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint(m_hwnd, &ps);
- m_compact ? PaintCompact(hdc) : PaintNormal(hdc);
- EndPaint(m_hwnd, &ps);
- return 0;
- }
-
- case WM_RBUTTONUP:
- {
- POINT pt = { LOWORD(lParam), HIWORD(lParam) };
- MapWindowPoints(m_hwnd, nullptr, &pt, 1);
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDFRAMECONTEXT, m_frameId, 0);
- int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, g_clistApi.hwndContactList, nullptr);
- Clist_MenuProcessCommand(res, 0, m_frameId);
- return 0;
- }
-
- case WM_LBUTTONDOWN:
- {
- POINT pt = { LOWORD(lParam), HIWORD(lParam) };
- for (auto &it : m_pItems)
- if (it->m_onEvent && PtInRect(&it->m_rcItem, pt)) {
- m_clickedItem = m_pItems.indexOf(&it);
- return 0;
- }
- }
- return 0;
-
- case WM_LBUTTONUP:
- {
- POINT pt = { LOWORD(lParam), HIWORD(lParam) };
- if ((m_clickedItem >= 0) && (m_clickedItem < m_pItems.getCount()) && m_pItems[m_clickedItem].m_onEvent && PtInRect(&m_pItems[m_clickedItem].m_rcItem, pt)) {
- CJabberInfoFrame_Event evt;
- evt.m_event = CJabberInfoFrame_Event::CLICK;
- evt.m_pszName = m_pItems[m_clickedItem].m_pszName;
- evt.m_pUserData = m_pItems[m_clickedItem].m_pUserData;
- (m_proto->*m_pItems[m_clickedItem].m_onEvent)(&evt);
- return 0;
- }
-
- m_clickedItem = -1;
-
- return 0;
- }
-
- case WM_LBUTTONDBLCLK:
- m_compact = !m_compact;
- UpdateSize();
- return 0;
- }
-
- return DefWindowProc(m_hwnd, msg, wParam, lParam);
-}
-
-void CJabberInfoFrame::LockUpdates()
-{
- m_bLocked = true;
-}
-
-void CJabberInfoFrame::Update()
-{
- m_bLocked = false;
- UpdateSize();
-}
-
-void CJabberInfoFrame::ReloadFonts()
-{
- LOGFONT lfFont;
- m_clTitle = Font_GetW(L"Jabber", L"Frame title", &lfFont);
- DeleteObject(m_hfntTitle);
- m_hfntTitle = CreateFontIndirect(&lfFont);
-
- m_clText = Font_GetW(L"Jabber", L"Frame text", &lfFont);
- DeleteObject(m_hfntText);
- m_hfntText = CreateFontIndirect(&lfFont);
-
- m_clBack = Colour_GetW(L"Jabber", L"Background");
-
- UpdateSize();
-}
-
-void CJabberInfoFrame::UpdateSize()
-{
- if (!m_hwnd || m_bLocked)
- return;
-
- int line_count = m_compact ? 1 : (m_pItems.getCount() - m_hiddenItemCount);
- int height = 2 * SZ_FRAMEPADDING + line_count * (GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING) + (line_count - 1) * SZ_LINESPACING;
-
- if (CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, m_frameId), 0) & F_VISIBLE) {
- if (!ServiceExists(MS_SKIN_DRAWGLYPH)) {
- // crazy resizing for clist_nicer...
- CallService(MS_CLIST_FRAMES_SHFRAME, m_frameId, 0);
- CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, m_frameId), height);
- CallService(MS_CLIST_FRAMES_SHFRAME, m_frameId, 0);
- }
- else {
- CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, m_frameId), height);
- RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE);
- }
- }
- else CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, m_frameId), height);
-}
-
-void CJabberInfoFrame::RemoveTooltip(int id)
-{
- TOOLINFO ti = { 0 };
- ti.cbSize = sizeof(TOOLINFO);
-
- ti.hwnd = m_hwnd;
- ti.uId = id;
- SendMessage(m_hwndToolTip, TTM_DELTOOLW, 0, (LPARAM)&ti);
-}
-
-void CJabberInfoFrame::SetToolTip(int id, RECT *rc, wchar_t *pszText)
-{
- TOOLINFO ti = { 0 };
- ti.cbSize = sizeof(TOOLINFO);
-
- ti.hwnd = m_hwnd;
- ti.uId = id;
- SendMessage(m_hwndToolTip, TTM_DELTOOLW, 0, (LPARAM)&ti);
-
- ti.uFlags = TTF_SUBCLASS;
- ti.hwnd = m_hwnd;
- ti.uId = id;
- ti.hinst = g_plugin.getInst();
- ti.lpszText = pszText;
- ti.rect = *rc;
- SendMessage(m_hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
-}
-
-void CJabberInfoFrame::PaintSkinGlyph(HDC hdc, RECT *rc, char **glyphs, COLORREF fallback)
-{
- if (ServiceExists(MS_SKIN_DRAWGLYPH)) {
- SKINDRAWREQUEST rq = { 0 };
- rq.hDC = hdc;
- rq.rcDestRect = *rc;
- rq.rcClipRect = *rc;
-
- for (; *glyphs; ++glyphs) {
- strncpy_s(rq.szObjectID, *glyphs, _TRUNCATE);
- if (!CallService(MS_SKIN_DRAWGLYPH, (WPARAM)&rq, 0))
- return;
- }
- }
-
- if (fallback != 0xFFFFFFFF) {
- HBRUSH hbr = CreateSolidBrush(fallback);
- FillRect(hdc, rc, hbr);
- DeleteObject(hbr);
- }
-}
-
-void CJabberInfoFrame::PaintCompact(HDC hdc)
-{
- RECT rc; GetClientRect(m_hwnd, &rc);
- char *glyphs[] = { "Main,ID=ProtoInfo", "Main,ID=EventArea", "Main,ID=StatusBar", nullptr };
- PaintSkinGlyph(hdc, &rc, glyphs, m_clBack);
-
- HFONT hfntSave = (HFONT)SelectObject(hdc, m_hfntTitle);
- SetBkMode(hdc, TRANSPARENT);
- SetTextColor(hdc, m_clTitle);
-
- int cx_icon = GetSystemMetrics(SM_CXSMICON);
- int cy_icon = GetSystemMetrics(SM_CYSMICON);
-
- int cx = rc.right - cx_icon - SZ_FRAMEPADDING;
- for (auto &it : m_pItems.rev_iter()) {
- SetRect(&it->m_rcItem, 0, 0, 0, 0);
- if (!it->m_bShow) continue;
- if (!it->m_bCompact) continue;
-
- int depth = 0;
- for (char *p = it->m_pszName; p = strchr(p + 1, '/'); ++depth);
-
- if (depth == 0) {
- if (it->m_hIcolibIcon) {
- HICON hIcon = IcoLib_GetIconByHandle(it->m_hIcolibIcon);
- if (hIcon) {
- DrawIconEx(hdc, SZ_FRAMEPADDING, (rc.bottom - cy_icon) / 2, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL);
- IcoLib_ReleaseIcon(hIcon);
- }
- }
-
- RECT rcText; SetRect(&rcText, cx_icon + SZ_FRAMEPADDING + SZ_ICONSPACING, 0, rc.right - SZ_FRAMEPADDING, rc.bottom);
- DrawText(hdc, it->m_pszText, -1, &rcText, DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS);
- }
- else {
- if (it->m_hIcolibIcon) {
- HICON hIcon = IcoLib_GetIconByHandle(it->m_hIcolibIcon);
- if (hIcon) {
- SetRect(&it->m_rcItem, cx, (rc.bottom - cy_icon) / 2, cx + cx_icon, (rc.bottom - cy_icon) / 2 + cy_icon);
- DrawIconEx(hdc, cx, (rc.bottom - cy_icon) / 2, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL);
- cx -= cx_icon;
-
- IcoLib_ReleaseIcon(hIcon);
-
- SetToolTip(it->m_tooltipId, &it->m_rcItem, it->m_pszText);
- }
- }
- }
- }
-
- SelectObject(hdc, hfntSave);
-}
-
-void CJabberInfoFrame::PaintNormal(HDC hdc)
-{
- RECT rc; GetClientRect(m_hwnd, &rc);
- char *glyphs[] = { "Main,ID=ProtoInfo", "Main,ID=EventArea", "Main,ID=StatusBar", nullptr };
- PaintSkinGlyph(hdc, &rc, glyphs, m_clBack);
-
- HFONT hfntSave = (HFONT)SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
- SetBkMode(hdc, TRANSPARENT);
-
- int cx_icon = GetSystemMetrics(SM_CXSMICON);
- int cy_icon = GetSystemMetrics(SM_CYSMICON);
- int line_height = cy_icon + SZ_LINEPADDING;
- int cy = SZ_FRAMEPADDING;
-
- for (auto &it : m_pItems) {
- if (!it->m_bShow) {
- SetRect(&it->m_rcItem, 0, 0, 0, 0);
- continue;
- }
-
- int cx = SZ_FRAMEPADDING;
- int depth = 0;
- for (char *p = it->m_pszName; p = strchr(p + 1, '/'); cx += cx_icon) ++depth;
-
- SetRect(&it->m_rcItem, cx, cy, rc.right - SZ_FRAMEPADDING, cy + line_height);
-
- if (it->m_hIcolibIcon) {
- HICON hIcon = IcoLib_GetIconByHandle(it->m_hIcolibIcon);
- if (hIcon) {
- DrawIconEx(hdc, cx, cy + (line_height - cy_icon) / 2, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL);
- cx += cx_icon + SZ_ICONSPACING;
-
- IcoLib_ReleaseIcon(hIcon);
- }
- }
-
- SelectObject(hdc, depth ? m_hfntText : m_hfntTitle);
- SetTextColor(hdc, depth ? m_clText : m_clTitle);
-
- RECT rcText; SetRect(&rcText, cx, cy, rc.right - SZ_FRAMEPADDING, cy + line_height);
- DrawText(hdc, it->m_pszText, -1, &rcText, DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS);
-
- RemoveTooltip(it->m_tooltipId);
-
- cy += line_height + SZ_LINESPACING;
- }
-
- SelectObject(hdc, hfntSave);
-}
-
-void CJabberInfoFrame::CreateInfoItem(char *pszName, bool bCompact, LPARAM pUserData)
-{
- if (m_pItems.find((CJabberInfoFrameItem*)&pszName))
- return;
-
- CJabberInfoFrameItem *newItem = new CJabberInfoFrameItem(pszName, bCompact, pUserData);
- newItem->m_tooltipId = m_nextTooltipId++;
- m_pItems.insert(newItem);
- UpdateSize();
-}
-
-void CJabberInfoFrame::SetInfoItemCallback(char *pszName, void (CJabberProto::*onEvent)(CJabberInfoFrame_Event *))
-{
- if (CJabberInfoFrameItem *pItem = m_pItems.find((CJabberInfoFrameItem*)&pszName))
- pItem->m_onEvent = onEvent;
-}
-
-void CJabberInfoFrame::UpdateInfoItem(char *pszName, HANDLE hIcolibIcon, wchar_t *pszText)
-{
- if (CJabberInfoFrameItem *pItem = m_pItems.find((CJabberInfoFrameItem*)&pszName))
- pItem->SetInfo(hIcolibIcon, pszText);
- if (m_hwnd)
- RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE);
-}
-
-void CJabberInfoFrame::ShowInfoItem(char *pszName, bool bShow)
-{
- bool bUpdate = false;
- size_t length = mir_strlen(pszName);
- for (auto &it : m_pItems)
- if ((it->m_bShow != bShow) && !strncmp(it->m_pszName, pszName, length)) {
- it->m_bShow = bShow;
- m_hiddenItemCount += bShow ? -1 : 1;
- bUpdate = true;
- }
-
- if (bUpdate)
- UpdateSize();
-}
-
-void CJabberInfoFrame::RemoveInfoItem(char *pszName)
-{
- bool bUpdate = false;
- size_t length = mir_strlen(pszName);
-
- for (auto &p : m_pItems.rev_iter()) {
- if (!strncmp(p->m_pszName, pszName, length)) {
- if (!p->m_bShow)
- --m_hiddenItemCount;
- RemoveTooltip(p->m_tooltipId);
- m_pItems.removeItem(&p);
- bUpdate = true;
- }
- }
-
- if (bUpdate)
- UpdateSize();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-void CJabberProto::InitInfoFrame()
-{
- if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
- return;
-
- if (!m_bDisableFrame)
- m_pInfoFrame = new CJabberInfoFrame(this);
- else {
- delete m_pInfoFrame;
- m_pInfoFrame = nullptr;
- }
-}
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 5498a1068a..7a90d3a683 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -257,7 +257,6 @@ bool CJabberProto::OnRosterPushRequest(const TiXmlElement*, CJabberIqInfo *pInfo }
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH);
- RebuildInfoFrame();
return true;
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 685cda10f4..cc2d4883d0 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -118,7 +118,6 @@ void CJabberProto::OnIqResultServerDiscoInfo(const TiXmlElement *iqNode, CJabber }
EnableMenuItems(true);
- RebuildInfoFrame();
continue;
}
@@ -551,7 +550,6 @@ void CJabberProto::OnIqResultGetRoster(const TiXmlElement *iqNode, CJabberIqInfo UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH);
OnProcessLoginRq(m_ThreadInfo, JABBER_LOGIN_ROSTER);
- RebuildInfoFrame();
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 1763df74b3..00313c3d5d 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -677,16 +677,13 @@ class CDlgOptAdvanced : public CJabberDlgBase CCtrlEdit m_txtDirect;
CCtrlTreeOpts m_options;
- bool m_oldFrameValue;
-
public:
CDlgOptAdvanced(CJabberProto *proto) :
CJabberDlgBase(proto, IDD_OPT_JABBER2),
m_chkDirect(this, IDC_DIRECT),
m_chkDirectManual(this, IDC_DIRECT_MANUAL),
m_txtDirect(this, IDC_DIRECT_ADDR),
- m_options(this, IDC_OPTTREE),
- m_oldFrameValue(proto->m_bDisableFrame)
+ m_options(this, IDC_OPTTREE)
{
CreateLink(m_chkDirect, proto->m_bBsDirect);
CreateLink(m_chkDirectManual, proto->m_bBsDirectManual);
@@ -719,7 +716,6 @@ public: m_options.AddOption(LPGENW("Other"), LPGENW("Automatically add contact when accept authorization"), m_proto->m_bAutoAdd);
m_options.AddOption(LPGENW("Other"), LPGENW("Automatically accept authorization requests"), m_proto->m_bAutoAcceptAuthorization);
m_options.AddOption(LPGENW("Other"), LPGENW("Fix incorrect timestamps in incoming messages"), m_proto->m_bFixIncorrectTimestamps);
- m_options.AddOption(LPGENW("Other"), LPGENW("Disable frame"), m_proto->m_bDisableFrame);
m_options.AddOption(LPGENW("Other"), LPGENW("Enable XMPP link processing (requires AssocMgr)"), m_proto->m_bProcessXMPPLinks);
m_options.AddOption(LPGENW("Other"), LPGENW("Embrace picture URLs with [img]"), m_proto->m_bEmbraceUrls);
m_options.AddOption(LPGENW("Other"), LPGENW("Ignore server roster (groups and nick names)"), m_proto->m_bIgnoreRoster);
@@ -741,11 +737,6 @@ public: bool OnApply() override
{
- if (m_proto->m_bDisableFrame != m_oldFrameValue) {
- m_proto->InitInfoFrame(); // create or destroy a frame
- m_oldFrameValue = m_proto->m_bDisableFrame;
- }
-
BOOL bChecked = m_proto->m_bShowTransport;
LISTFOREACH(index, m_proto, LIST_ROSTER)
{
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 80f0ccc3af..d11ab271d6 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -91,7 +91,6 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : m_bBsDirectManual(this, "BsDirectManual", false),
m_bBsProxyManual(this, "BsProxyManual", false),
m_bDisable3920auth(this, "Disable3920auth", false),
- m_bDisableFrame(this, "DisableFrame", true),
m_bEnableAvatars(this, "EnableAvatars", true),
m_bEnableCarbons(this, "EnableCarbons", true),
m_bEnableChatStates(this, "EnableChatStates", true),
@@ -251,8 +250,6 @@ CJabberProto::~CJabberProto() if (m_hPopupClass)
Popup_UnregisterClass(m_hPopupClass);
- delete m_pInfoFrame;
-
DestroyHookableEvent(m_hEventNudge);
DestroyHookableEvent(m_hEventXStatusIconChanged);
DestroyHookableEvent(m_hEventXStatusChanged);
@@ -289,7 +286,6 @@ void CJabberProto::OnModulesLoaded() XStatusInit();
m_pepServices.InitGui();
- InitInfoFrame();
InitPopups();
GlobalMenuInit();
@@ -1041,7 +1037,6 @@ int CJabberProto::SetStatus(int iNewStatus) m_StrmMgmt.SendAck();
m_ThreadInfo->send("</stream:stream>");
m_ThreadInfo->shutdown();
- RebuildInfoFrame();
}
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
@@ -1051,8 +1046,6 @@ int CJabberProto::SetStatus(int iNewStatus) m_iStatus = ID_STATUS_CONNECTING;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
ForkThread((MyThreadFunc)&CJabberProto::ServerThread, nullptr);
-
- RebuildInfoFrame();
}
else if (m_bJabberOnline)
SetServerStatus(iNewStatus);
@@ -1201,23 +1194,3 @@ int CJabberProto::UserIsTyping(MCONTACT hContact, int type) return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// InfoFrame events
-
-void CJabberProto::InfoFrame_OnSetup(CJabberInfoFrame_Event*)
-{
- OnMenuOptions(0, 0);
-}
-
-void CJabberProto::InfoFrame_OnTransport(CJabberInfoFrame_Event *evt)
-{
- if (evt->m_event == CJabberInfoFrame_Event::CLICK) {
- MCONTACT hContact = (MCONTACT)evt->m_pUserData;
- HMENU hContactMenu = Menu_BuildContactMenu(hContact);
- POINT pt;
- GetCursorPos(&pt);
- int res = TrackPopupMenu(hContactMenu, TPM_RETURNCMD, pt.x, pt.y, 0, g_clistApi.hwndContactList, nullptr);
- Clist_MenuProcessCommand(res, MPCF_CONTACTMENU, hContact);
- }
-}
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index dce3110087..ce8a4c0881 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -193,7 +193,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface CMOption<bool> m_bBsDirectManual;
CMOption<bool> m_bBsProxyManual;
CMOption<bool> m_bDisable3920auth;
- CMOption<bool> m_bDisableFrame;
CMOption<bool> m_bEnableAvatars;
CMOption<bool> m_bEnableCarbons;
CMOption<bool> m_bEnableChatStates;
@@ -295,9 +294,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface HANDLE m_hThreadConsole;
UINT m_dwConsoleThreadId;
- // proto frame
- CJabberInfoFrame *m_pInfoFrame;
-
+ // lists
LIST<JABBER_LIST_ITEM> m_lstRoster;
mir_cs m_csLists;
BOOL m_bListInitialised;
@@ -755,9 +752,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void __cdecl SendMessageAckThread(void* hContact);
MCONTACT AddToListByJID(const char *newJid, uint32_t flags);
-
- void InfoFrame_OnSetup(CJabberInfoFrame_Event *evt);
- void InfoFrame_OnTransport(CJabberInfoFrame_Event *evt);
//---- jabber_rc.cpp -----------------------------------------------------------------
@@ -866,10 +860,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void SendVisibleInvisiblePresence(bool invisible);
void SendPresenceTo(int status, const char* to, const TiXmlElement *extra = nullptr, const char *msg = nullptr);
void SendPresence(int iStatus, bool bSendToAll);
-
- void RebuildInfoFrame(void);
- void InitInfoFrame(void);
-
+
// returns buf or nullptr on error
char* GetClientJID(MCONTACT hContact, char *dest, size_t destLen);
char* GetClientJID(const char *jid, char *dest, size_t destLen);
@@ -925,9 +916,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void SetContactTune(MCONTACT hContact, const wchar_t *szArtist, const wchar_t *szLength, const wchar_t *szSource, const wchar_t *szTitle, const wchar_t *szTrack);
- void InfoFrame_OnUserMood(CJabberInfoFrame_Event *evt);
- void InfoFrame_OnUserActivity(CJabberInfoFrame_Event *evt);
-
CPepServiceList m_pepServices;
private:
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index f3e1439c89..4308c04e18 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -491,7 +491,6 @@ recvRest: m_bJabberOnline = false;
info.zlibUninit();
EnableMenuItems(false);
- RebuildInfoFrame();
if (m_hwndJabberChangePassword)
// Since this is a different thread, simulate the click on the cancel button instead
SendMessage(m_hwndJabberChangePassword, WM_COMMAND, MAKEWORD(IDCANCEL, 0), 0);
@@ -1726,7 +1725,6 @@ void CJabberProto::OnProcessPresence(const TiXmlElement *node, ThreadData *info) }
}
}
- RebuildInfoFrame();
}
else {
debugLogA("%s (%s) requests authorization", szNick.get(), from);
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 2a0cbb4327..9da3058bf4 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -702,71 +702,6 @@ void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param setByte(param, (id + 1) % recentCount);
}
-/////////////////////////////////////////////////////////////////////////////////////////
-// jabber frame maintenance code
-
-static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param)
-{
- CJabberProto *ppro = (CJabberProto *)param;
- if (!ppro->m_pInfoFrame)
- return;
-
- ppro->m_pInfoFrame->LockUpdates();
- if (!ppro->m_bJabberOnline) {
- ppro->m_pInfoFrame->RemoveInfoItem("$/PEP");
- ppro->m_pInfoFrame->RemoveInfoItem("$/Transports");
- ppro->m_pInfoFrame->UpdateInfoItem("$/JID", Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS), TranslateT("Offline"));
- }
- else {
- ppro->m_pInfoFrame->UpdateInfoItem("$/JID", Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS), Utf2T(ppro->m_szJabberJID));
-
- if (!ppro->m_bPepSupported)
- ppro->m_pInfoFrame->RemoveInfoItem("$/PEP");
- else {
- ppro->m_pInfoFrame->RemoveInfoItem("$/PEP/");
- ppro->m_pInfoFrame->CreateInfoItem("$/PEP", false);
- ppro->m_pInfoFrame->UpdateInfoItem("$/PEP", g_plugin.getIconHandle(IDI_PL_LIST_ANY), TranslateT("Advanced Status"));
-
- ppro->m_pInfoFrame->CreateInfoItem("$/PEP/mood", true);
- ppro->m_pInfoFrame->SetInfoItemCallback("$/PEP/mood", &CJabberProto::InfoFrame_OnUserMood);
- ppro->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set mood..."));
-
- ppro->m_pInfoFrame->CreateInfoItem("$/PEP/activity", true);
- ppro->m_pInfoFrame->SetInfoItemCallback("$/PEP/activity", &CJabberProto::InfoFrame_OnUserActivity);
- ppro->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set activity..."));
- }
-
- ppro->m_pInfoFrame->RemoveInfoItem("$/Transports/");
- ppro->m_pInfoFrame->CreateInfoItem("$/Transports", false);
- ppro->m_pInfoFrame->UpdateInfoItem("$/Transports", g_plugin.getIconHandle(IDI_TRANSPORT), TranslateT("Transports"));
-
- JABBER_LIST_ITEM *item = nullptr;
- LISTFOREACH(i, ppro, LIST_ROSTER)
- {
- if ((item = ppro->ListGetItemPtrFromIndex(i)) != nullptr) {
- if (strchr(item->jid, '@') == nullptr && strchr(item->jid, '/') == nullptr && item->subscription != SUB_NONE) {
- MCONTACT hContact = ppro->HContactFromJID(item->jid);
- if (hContact == 0)
- continue;
-
- char name[128];
- mir_snprintf(name, "$/Transports/%s", item->jid);
- ppro->m_pInfoFrame->CreateInfoItem(name, true, hContact);
- ppro->m_pInfoFrame->UpdateInfoItem(name, g_plugin.getIconHandle(IDI_TRANSPORTL), (wchar_t *)item->jid);
- ppro->m_pInfoFrame->SetInfoItemCallback(name, &CJabberProto::InfoFrame_OnTransport);
- }
- }
- }
- }
- ppro->m_pInfoFrame->Update();
-}
-
-void CJabberProto::RebuildInfoFrame()
-{
- if (!m_bShutdown)
- CallFunctionAsync(sttRebuildInfoFrameApcProc, this);
-}
-
////////////////////////////////////////////////////////////////////////
// time2str & str2time
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 0666e288db..b67347f7e7 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -706,9 +706,6 @@ void CPepMood::UpdateMenuView() }
UpdateMenuItem(hIcon, title);
-
- if (m_proto->m_pInfoFrame)
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", hIcon, title);
}
void ClearMoodIcons()
@@ -1088,8 +1085,6 @@ void CPepActivity::UpdateMenuView() }
UpdateMenuItem(hIcon, title);
- if (m_proto->m_pInfoFrame)
- m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", hIcon, title);
}
///////////////////////////////////////////////////////////////////////////////
@@ -1260,19 +1255,6 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam) }
/////////////////////////////////////////////////////////////////////////////////////////
-// process InfoFrame clicks
-
-void CJabberProto::InfoFrame_OnUserMood(CJabberInfoFrame_Event*)
-{
- ((CPepGuiService *)m_pepServices.Find(JABBER_FEAT_USER_MOOD))->LaunchSetGui();
-}
-
-void CJabberProto::InfoFrame_OnUserActivity(CJabberInfoFrame_Event*)
-{
- ((CPepGuiService *)m_pepServices.Find(JABBER_FEAT_USER_ACTIVITY))->LaunchSetGui();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// builds xstatus menu
void CJabberProto::XStatusInit()
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index 61218888f5..bef8ca3332 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -488,71 +488,6 @@ struct JABBER_MUC_JIDLIST_INFO : public MZeroedObject typedef struct TTreeList_ItemInfo *HTREELISTITEM;
enum { TLM_TREE, TLM_REPORT };
-//---- proto frame ------------------------------------------------
-
-class CJabberInfoFrameItem;
-
-struct CJabberInfoFrame_Event
-{
- enum { CLICK, DESTROY } m_event;
- const char *m_pszName;
- LPARAM m_pUserData;
-};
-
-class CJabberInfoFrame : public MZeroedObject
-{
-public:
- CJabberInfoFrame(CJabberProto *proto);
- ~CJabberInfoFrame();
-
- void CreateInfoItem(char *pszName, bool bCompact=false, LPARAM pUserData=0);
- void SetInfoItemCallback(char *pszName, void (CJabberProto::*onEvent)(CJabberInfoFrame_Event *));
- void UpdateInfoItem(char *pszName, HANDLE hIcolibItem, wchar_t *pszText);
- void ShowInfoItem(char *pszName, bool bShow);
- void RemoveInfoItem(char *pszName);
-
- void LockUpdates();
- void Update();
-
-private:
- CJabberProto *m_proto;
- HWND m_hwnd;
- int m_frameId;
- bool m_compact;
- OBJLIST<CJabberInfoFrameItem> m_pItems;
- int m_hiddenItemCount;
- int m_clickedItem;
- bool m_bLocked;
- int m_nextTooltipId;
- HWND m_hwndToolTip;
-
- HANDLE m_hhkFontsChanged;
- HFONT m_hfntTitle, m_hfntText;
- COLORREF m_clTitle, m_clText, m_clBack;
-
- static void InitClass();
- static LRESULT CALLBACK GlobalWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- LRESULT WndProc(UINT msg, WPARAM wParam, LPARAM lParam);
-
- void ReloadFonts();
- void UpdateSize();
-
- void RemoveTooltip(int id);
- void SetToolTip(int id, RECT *rc, wchar_t *pszText);
-
- void PaintSkinGlyph(HDC hdc, RECT *rc, char **glyphs, COLORREF fallback);
- void PaintCompact(HDC hdc);
- void PaintNormal(HDC hdc);
-
- enum
- {
- SZ_FRAMEPADDING = 2, // padding inside frame
- SZ_LINEPADDING = 0, // line height will be incremented by this value
- SZ_LINESPACING = 0, // between lines
- SZ_ICONSPACING = 2, // between icon and text
- };
-};
-
#include "jabber_list.h"
#include "jabber_proto.h"
|