From e183822028662cdd47d31c5f23fd9842c32cba6a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 14 Mar 2024 16:09:42 +0300 Subject: fixes #4278 (ICQ: add "about" field support in my own user info) --- protocols/ICQ-WIM/src/resource.h | 2 ++ protocols/ICQ-WIM/src/server.cpp | 1 + protocols/ICQ-WIM/src/userinfo.cpp | 37 ++++++++++++++++++++++++++++++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) (limited to 'protocols/ICQ-WIM/src') diff --git a/protocols/ICQ-WIM/src/resource.h b/protocols/ICQ-WIM/src/resource.h index 38a48a0d35..f4bfda4f5b 100644 --- a/protocols/ICQ-WIM/src/resource.h +++ b/protocols/ICQ-WIM/src/resource.h @@ -15,6 +15,7 @@ #define IDD_EDITGROUPS 111 #define IDD_FORWARD 112 #define IDI_FORWARD 113 +#define IDD_ABOUT 114 #define IDC_PASSWORD 1001 #define IDC_UIN 1002 #define IDC_UIN2 1003 @@ -25,6 +26,7 @@ #define IDC_SENDSMS 1008 #define IDC_CODE 1009 #define IDC_ONLINESINCE 1010 +#define IDC_ABOUT 1011 #define IDC_NICK 1012 #define IDC_LASTSEEN 1014 #define IDC_SAVEPASS 1015 diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index abba88aa22..506b0651fb 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -386,6 +386,7 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact, boo Contact::PutOnList(hContact); } + Json2string(hContact, buddy, "about", "About", bIsPartial); Json2string(hContact, buddy, "emailId", "Email", bIsPartial); Json2string(hContact, buddy, "cellNumber", "Cellular", bIsPartial); Json2string(hContact, buddy, "workNumber", "CompanyPhone", bIsPartial); diff --git a/protocols/ICQ-WIM/src/userinfo.cpp b/protocols/ICQ-WIM/src/userinfo.cpp index d41ab0f9f5..2563925ff5 100644 --- a/protocols/ICQ-WIM/src/userinfo.cpp +++ b/protocols/ICQ-WIM/src/userinfo.cpp @@ -74,6 +74,35 @@ struct IcqUserInfoDlg : public CUserInfoPageDlg } }; +struct IcqAboutDlg : public CUserInfoPageDlg +{ + CIcqProto *ppro; + + IcqAboutDlg(CIcqProto *_ppro) : + CUserInfoPageDlg(g_plugin, IDD_ABOUT), + ppro(_ppro) + {} + + bool IsEmpty() const override + { + return ppro->getMStringW(m_hContact, "About").IsEmpty(); + } + + bool OnRefresh() override + { + SetDlgItemTextW(m_hwnd, IDC_ABOUT, ppro->getMStringW(m_hContact, "About")); + return false; + } + + int Resizer(UTILRESIZECONTROL *urc) override + { + if (urc->wId == IDC_ABOUT) + return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT; + + return RD_ANCHORX_LEFT | RD_ANCHORY_TOP; + } +}; + int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM hContact) { if (hContact && mir_strcmp(Proto_GetBaseAccountName(hContact), m_szModuleName)) @@ -84,11 +113,17 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM hContact) USERINFOPAGE uip = {}; uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE; - uip.szTitle.w = L"ICQ"; uip.szGroup.w = m_tszUserName; uip.szProto = m_szModuleName; + + uip.szTitle.w = L"ICQ"; uip.position = -1900000000; uip.pDialog = new IcqUserInfoDlg(this); g_plugin.addUserInfo(wParam, &uip); + + uip.szTitle.w = TranslateT("About"); + uip.position = -1900000001; + uip.pDialog = new IcqAboutDlg(this); + g_plugin.addUserInfo(wParam, &uip); return 0; } -- cgit v1.2.3