diff options
-rw-r--r-- | include/m_userinfo.h | 1 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/userinfo.cpp | 4 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/userinfo.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 6 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_userinfo.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_vcard.cpp | 4 | ||||
-rw-r--r-- | src/core/stduserinfo/src/userinfo.cpp | 80 |
7 files changed, 53 insertions, 50 deletions
diff --git a/include/m_userinfo.h b/include/m_userinfo.h index a0976e90a5..d33e05a075 100644 --- a/include/m_userinfo.h +++ b/include/m_userinfo.h @@ -51,6 +51,7 @@ struct USERINFOPAGE HPLUGIN pPlugin;
uint32_t flags; // ODPF_*, look at m_options.h
CUserInfoPageDlg *pDialog;
+ const char *szProto; // for viewing our own pages
// used in UInfoEx only
int position;
diff --git a/protocols/Gadu-Gadu/src/userinfo.cpp b/protocols/Gadu-Gadu/src/userinfo.cpp index 92c031e12b..0fa91a5c99 100644 --- a/protocols/Gadu-Gadu/src/userinfo.cpp +++ b/protocols/Gadu-Gadu/src/userinfo.cpp @@ -313,11 +313,11 @@ int GaduProto::details_init(WPARAM wParam, LPARAM hContact) }
USERINFOPAGE uip = {};
- uip.flags = ODPF_DONTTRANSLATE | ODPF_UNICODE | ODPF_ICON;
+ uip.flags = ODPF_DONTTRANSLATE | ODPF_UNICODE;
uip.position = -1900000000;
uip.pDialog = new GaduUserInfoDlg(this, idDialog);
uip.szTitle.w = m_tszUserName;
- uip.dwInitParam = LPARAM(g_plugin.getIconHandle(IDI_GG));
+ uip.szProto = m_szModuleName;
g_plugin.addUserInfo(wParam, &uip);
// Start search for user data
diff --git a/protocols/ICQ-WIM/src/userinfo.cpp b/protocols/ICQ-WIM/src/userinfo.cpp index b909c2ea5e..fd4349b852 100644 --- a/protocols/ICQ-WIM/src/userinfo.cpp +++ b/protocols/ICQ-WIM/src/userinfo.cpp @@ -83,10 +83,10 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM hContact) return 0;
USERINFOPAGE uip = {};
- uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE | ODPF_ICON;
- uip.dwInitParam = (LPARAM)Skin_GetProtoIcon(m_szModuleName, ID_STATUS_ONLINE);
+ uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE;
uip.szTitle.w = L"ICQ";
uip.szGroup.w = m_tszUserName;
+ uip.szProto = m_szModuleName;
uip.position = -1900000000;
uip.pDialog = new IcqUserInfoDlg(this);
g_plugin.addUserInfo(wParam, &uip);
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 90e6031efa..e41da8181e 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -1105,9 +1105,9 @@ void CJabberProto::OnIqResultGetVcard(const TiXmlElement *iqNode, CJabberIqInfo* ResolveTransportNicks((p != nullptr) ? p + 1 : jid);
}
else {
- if (hContact != 0)
- ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1);
- else {
+ ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1);
+
+ if (hContact == 0) {
CMStringA oldHash(getMStringA("VCardHash"));
if (oldHash != szNodeHash) {
setString("VCardHash", szNodeHash);
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index d2f11f2fa3..d606c55d4b 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -963,9 +963,9 @@ int CJabberProto::OnUserInfoInit(WPARAM wParam, LPARAM hContact) if (szProto != nullptr && !mir_strcmp(szProto, m_szModuleName)) {
USERINFOPAGE uip = {};
uip.dwInitParam = (LPARAM)this;
- uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_ICON;
+ uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB;
uip.szGroup.w = m_tszUserName;
- uip.dwInitParam = (LPARAM)Skin_GetProtoIcon(m_szModuleName, ID_STATUS_ONLINE);
+ uip.szProto = m_szModuleName;
uip.pDialog = new JabberUserInfoDlg(this);
uip.position = -2000000000;
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 2ac2c8af6b..4e510462cd 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -1033,9 +1033,9 @@ void CJabberProto::OnUserInfoInit_VCard(WPARAM wParam, LPARAM) m_szPhotoFileName[0] = 0;
USERINFOPAGE uip = {};
- uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_ICON;
+ uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB;
uip.szGroup.w = m_tszUserName;
- uip.dwInitParam = (LPARAM)Skin_GetProtoIcon(m_szModuleName, ID_STATUS_ONLINE);
+ uip.szProto = m_szModuleName;
uip.pDialog = new JabberVcardPersonalDlg(this);
uip.szTitle.w = LPGENW("General");
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 7b072fe285..f3c28024b0 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -36,6 +36,7 @@ struct DetailsPageData : public MNonCopyable, public MZeroedObject int changed;
uint32_t dwFlags;
wchar_t *pwszTitle, *pwszGroup;
+ const char *szProto;
INT_PTR lParam;
~DetailsPageData()
@@ -82,9 +83,9 @@ static int PageSortProc(const DetailsPageData *item1, const DetailsPageData *ite return mir_wstrcmp(s1, s2);
}
-static int UserInfoContactDelete(WPARAM wParam, LPARAM)
+static int UserInfoContactDelete(WPARAM hContact, LPARAM)
{
- HWND hwnd = WindowList_Find(hWindowList, wParam);
+ HWND hwnd = WindowList_Find(hWindowList, hContact);
if (hwnd != nullptr)
DestroyWindow(hwnd);
return 0;
@@ -131,8 +132,17 @@ class CUserInfoDlg : public CDlgBase for (auto &it : items) {
int iImage = 1;
- if ((it->dwFlags & ODPF_ICON) && it->lParam) {
- HICON hIcon = IcoLib_GetIconByHandle((HANDLE)it->lParam);
+
+ HANDLE hIcolib = nullptr;
+ if ((it->dwFlags & ODPF_ICON) && it->lParam)
+ hIcolib = (HANDLE)it->lParam;
+ else if (it->szProto)
+ hIcolib = Skin_GetProtoIcon(it->szProto, ID_STATUS_ONLINE);
+ else if (hContact)
+ it->szProto = Proto_GetBaseAccountName(hContact);
+
+ if (hIcolib) {
+ HICON hIcon = IcoLib_GetIconByHandle(hIcolib);
if (hIcon) {
iImage = ImageList_AddIcon(m_imageList, hIcon);
IcoLib_ReleaseIcon(hIcon);
@@ -216,10 +226,7 @@ class CUserInfoDlg : public CDlgBase void CheckOnline()
{
- if (m_hContact == 0)
- return;
-
- char *szProto = Proto_GetBaseAccountName(m_hContact);
+ auto *szProto = (m_pCurrent) ? m_pCurrent->szProto : nullptr;
if (szProto == nullptr || m_bIsMeta)
btnUpdate.Disable();
else {
@@ -230,22 +237,6 @@ class CUserInfoDlg : public CDlgBase }
}
- void CreateDetailsPageWindow(DetailsPageData *ppg)
- {
- auto *pDlg = ppg->pDialog;
- if (pDlg == nullptr)
- return;
-
- pDlg->SetParent(m_hwnd);
- pDlg->SetContact(ppg->hContact);
- pDlg->Create();
- ppg->hwnd = pDlg->GetHwnd();
-
- ::ThemeDialogBackground(ppg->hwnd);
-
- pDlg->OnRefresh();
- }
-
void ResizeCurrent()
{
RECT rc;
@@ -380,6 +371,12 @@ public: return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
}
+ void OnChange() override
+ {
+ if (m_pCurrent)
+ m_pCurrent->changed = 1;
+ }
+
void OnDestroy() override
{
SaveLocation();
@@ -404,11 +401,6 @@ public: PSHNOTIFY pshn;
switch (uMsg) {
- case PSM_CHANGED:
- if (m_pCurrent)
- m_pCurrent->changed = 1;
- return TRUE;
-
case PSM_FORCECHANGED:
pshn.hdr.code = PSN_INFOCHANGED;
pshn.hdr.idFrom = 0;
@@ -488,7 +480,6 @@ public: ResizeCurrent();
return res;
-
}
void onSelChanging(CCtrlTreeView *)
@@ -509,16 +500,27 @@ public: if (m_pCurrent && m_pCurrent->hwnd != NULL)
ShowWindow(m_pCurrent->hwnd, SW_HIDE);
- LPNMTREEVIEW pnmtv = ev->nmtv;
- TVITEM tvi = pnmtv->itemNew;
- m_pCurrent = (DetailsPageData*)tvi.lParam;
+ if (m_pCurrent = (DetailsPageData *)ev->nmtv->itemNew.lParam) {
+ if (m_pCurrent->hwnd == nullptr) {
+ auto *pDlg = m_pCurrent->pDialog;
+ if (pDlg == nullptr)
+ return;
- if (m_pCurrent) {
- if (m_pCurrent->hwnd == NULL)
- CreateDetailsPageWindow(m_pCurrent);
+ pDlg->SetParent(m_hwnd);
+ pDlg->SetContact(m_pCurrent->hContact);
+ pDlg->Create();
+
+ m_pCurrent->hwnd = pDlg->GetHwnd();
+ ::ThemeDialogBackground(m_pCurrent->hwnd);
+
+ pDlg->OnRefresh();
+ }
ResizeCurrent();
ShowWindow(m_pCurrent->hwnd, SW_SHOWNA);
+
+ if (!m_hContact)
+ CheckOnline();
}
}
@@ -544,13 +546,12 @@ public: m_infosUpdated = NULL;
}
- if (m_hContact != NULL) {
- if (!ProtoChainSend(m_hContact, PSS_GETINFO, 0, 0)) {
+ if (auto *szProto = (m_pCurrent) ? m_pCurrent->szProto : nullptr)
+ if (!CallProtoService(szProto, PSS_GETINFO, 0, 0)) {
btnUpdate.Disable();
ShowWindow(GetDlgItem(m_hwnd, IDC_UPDATING), SW_SHOW);
updateTimer.Start(100);
}
- }
}
void onTimer(CTimer *)
@@ -576,6 +577,7 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) auto *pNew = new DetailsPageData();
pNew->pPlugin = uip->pPlugin;
pNew->pDialog = uip->pDialog;
+ pNew->szProto = uip->szProto;
if (uip->flags & ODPF_UNICODE) {
pNew->pwszTitle = (uip->szTitle.w == nullptr) ? nullptr : mir_wstrdup(uip->szTitle.w);
|