summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-09-16 15:12:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-09-16 15:12:16 +0300
commit8f23785d669b571df8e6df4ae17cd1aca684b9b6 (patch)
tree64bb29ffbdcbbf4fe4f9abafb06e59ef9b161892 /protocols/JabberG
parent757fb8c1b1387b1fe5748bf480b1df6d5d2980e8 (diff)
fixes #2064 (Jabber: some MUC dialogs are displayed behind the chat window)
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp27
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp2
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp40
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.h4
-rwxr-xr-xprotocols/JabberG/src/stdafx.h1
5 files changed, 40 insertions, 34 deletions
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index d1ff8e9e93..8feab67e1b 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -712,7 +712,7 @@ public:
{
CSuper::OnInitDialog();
- SetDlgItemText(m_hwnd, IDC_HEADERBAR, CMStringW(FORMAT, TranslateT("Invite Users to\n%s"), m_room));
+ SetDlgItemText(m_hwnd, IDC_HEADERBAR, CMStringW(FORMAT, TranslateT("Invite Users to\n%s"), Utf2T(m_room).get()));
Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_GROUP));
SetWindowLongPtr(m_clc.GetHwnd(), GWL_STYLE,
@@ -794,9 +794,9 @@ void CJabberProto::AdminSetReason(const char *to, const char *ns, const char *sz
m_ThreadInfo->send(XmlNodeIq("set", SerialNext(), to) << XQUERY(ns) << XCHILD("item") << XATTR(szItem, itemVal) << XATTR(var, varVal) << XCHILD("reason", rsn));
}
-void CJabberProto::AdminGet(const char *to, const char *ns, const char *var, const char *varVal, JABBER_IQ_HANDLER foo)
+void CJabberProto::AdminGet(const char *to, const char *ns, const char *var, const char *varVal, JABBER_IQ_HANDLER foo, void *pInfo)
{
- m_ThreadInfo->send(XmlNodeIq(AddIQ(foo, JABBER_IQ_TYPE_GET, to))
+ m_ThreadInfo->send(XmlNodeIq(AddIQ(foo, JABBER_IQ_TYPE_GET, to, pInfo))
<< XQUERY(ns) << XCHILD("item") << XATTR(var, varVal));
}
@@ -1209,34 +1209,34 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
}
}
-static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* gch)
+static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK *gch)
{
CMStringW szBuffer, szTitle;
T2Utf roomJid(gch->ptszID);
switch (gch->dwData) {
case IDM_LST_PARTICIPANT:
- ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "role", "participant", &CJabberProto::OnIqResultMucGetVoiceList);
+ ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "role", "participant", &CJabberProto::OnIqResultMucGetVoiceList, gch->pDlg);
break;
case IDM_LST_MEMBER:
- ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "affiliation", "member", &CJabberProto::OnIqResultMucGetMemberList);
+ ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "affiliation", "member", &CJabberProto::OnIqResultMucGetMemberList, gch->pDlg);
break;
case IDM_LST_MODERATOR:
- ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "role", "moderator", &CJabberProto::OnIqResultMucGetModeratorList);
+ ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "role", "moderator", &CJabberProto::OnIqResultMucGetModeratorList, gch->pDlg);
break;
case IDM_LST_BAN:
- ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "affiliation", "outcast", &CJabberProto::OnIqResultMucGetBanList);
+ ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "affiliation", "outcast", &CJabberProto::OnIqResultMucGetBanList, gch->pDlg);
break;
case IDM_LST_ADMIN:
- ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "affiliation", "admin", &CJabberProto::OnIqResultMucGetAdminList);
+ ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "affiliation", "admin", &CJabberProto::OnIqResultMucGetAdminList, gch->pDlg);
break;
case IDM_LST_OWNER:
- ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "affiliation", "owner", &CJabberProto::OnIqResultMucGetOwnerList);
+ ppro->AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, "affiliation", "owner", &CJabberProto::OnIqResultMucGetOwnerList, gch->pDlg);
break;
case IDM_TOPIC:
@@ -1258,7 +1258,12 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
break;
case IDM_INVITE:
- (new CGroupchatInviteDlg(ppro, roomJid))->Show();
+ {
+ auto *pDlg = new CGroupchatInviteDlg(ppro, roomJid);
+ if (gch->pDlg)
+ pDlg->SetParent(gch->pDlg->GetHwnd());
+ pDlg->Show();
+ }
break;
case IDM_CONFIG:
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index ad8ffecd66..020e8b5e18 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -1138,7 +1138,7 @@ public:
CSuper::OnInitDialog();
wchar_t buf[256];
- mir_snwprintf(buf, TranslateT("Group chat invitation to\n%s"), m_roomJid.c_str());
+ mir_snwprintf(buf, TranslateT("Group chat invitation to\n%s"), Utf2T(m_roomJid).get());
SetDlgItemText(m_hwnd, IDC_HEADERBAR, buf);
SetDlgItemTextUtf(m_hwnd, IDC_FROM, m_from);
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index 5ed59063f4..a8e7073ba6 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -358,8 +358,8 @@ static void CALLBACK JabberMucJidListCreateDialogApcProc(void* param)
if (queryNode == nullptr)
return;
- CJabberProto *ppro = jidListInfo->ppro;
- CJabberMucJidListDlg *&pHwndJidList = ppro->GetMucDlg(jidListInfo->type);
+ auto *ppro = jidListInfo->ppro;
+ auto *&pHwndJidList = ppro->GetMucDlg(jidListInfo->type);
if (pHwndJidList != nullptr) {
SetForegroundWindow(pHwndJidList->GetHwnd());
@@ -367,11 +367,14 @@ static void CALLBACK JabberMucJidListCreateDialogApcProc(void* param)
}
else {
pHwndJidList = new CJabberMucJidListDlg(ppro, jidListInfo);
+ auto *pDlg = (CSrmmBaseDialog *)jidListInfo->pUserData;
+ if (pDlg)
+ pHwndJidList->SetParent(pDlg->GetHwnd());
pHwndJidList->Show();
}
}
-void CJabberProto::OnIqResultMucGetJidList(const TiXmlElement *iqNode, JABBER_MUC_JIDLIST_TYPE listType)
+void CJabberProto::OnIqResultMucGetJidList(const TiXmlElement *iqNode, JABBER_MUC_JIDLIST_TYPE listType, CJabberIqInfo *pInfo)
{
const char *type = XmlGetAttr(iqNode, "type");
if (type == nullptr)
@@ -383,6 +386,7 @@ void CJabberProto::OnIqResultMucGetJidList(const TiXmlElement *iqNode, JABBER_MU
jidListInfo->type = listType;
jidListInfo->ppro = this;
jidListInfo->roomJid = nullptr; // Set in the dialog procedure
+ jidListInfo->pUserData = pInfo->GetUserData();
if ((jidListInfo->iqNode = iqNode->DeepClone(&jidListInfo->doc)->ToElement()) != nullptr)
CallFunctionAsync(JabberMucJidListCreateDialogApcProc, jidListInfo);
else
@@ -414,51 +418,47 @@ CJabberMucJidListDlg*& CJabberProto::GetMucDlg(JABBER_MUC_JIDLIST_TYPE type)
return m_pDlgMucBanList;
case MUC_ADMINLIST:
return m_pDlgMucAdminList;
- case MUC_OWNERLIST:
+ default: // MUC_OWNERLIST
return m_pDlgMucOwnerList;
}
-
- // never happens. just to make compiler happy
- static CJabberMucJidListDlg *pStub = nullptr;
- return pStub;
}
/////////////////////////////////////////////////////////////////////////////////////////
-void CJabberProto::OnIqResultMucGetVoiceList(const TiXmlElement *iqNode, CJabberIqInfo *)
+void CJabberProto::OnIqResultMucGetVoiceList(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
{
debugLogA("<iq/> iqResultMucGetVoiceList");
- OnIqResultMucGetJidList(iqNode, MUC_VOICELIST);
+ OnIqResultMucGetJidList(iqNode, MUC_VOICELIST, pInfo);
}
-void CJabberProto::OnIqResultMucGetMemberList(const TiXmlElement *iqNode, CJabberIqInfo *)
+void CJabberProto::OnIqResultMucGetMemberList(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
{
debugLogA("<iq/> iqResultMucGetMemberList");
- OnIqResultMucGetJidList(iqNode, MUC_MEMBERLIST);
+ OnIqResultMucGetJidList(iqNode, MUC_MEMBERLIST, pInfo);
}
-void CJabberProto::OnIqResultMucGetModeratorList(const TiXmlElement *iqNode, CJabberIqInfo *)
+void CJabberProto::OnIqResultMucGetModeratorList(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
{
debugLogA("<iq/> iqResultMucGetModeratorList");
- OnIqResultMucGetJidList(iqNode, MUC_MODERATORLIST);
+ OnIqResultMucGetJidList(iqNode, MUC_MODERATORLIST, pInfo);
}
-void CJabberProto::OnIqResultMucGetBanList(const TiXmlElement *iqNode, CJabberIqInfo *)
+void CJabberProto::OnIqResultMucGetBanList(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
{
debugLogA("<iq/> iqResultMucGetBanList");
- OnIqResultMucGetJidList(iqNode, MUC_BANLIST);
+ OnIqResultMucGetJidList(iqNode, MUC_BANLIST, pInfo);
}
-void CJabberProto::OnIqResultMucGetAdminList(const TiXmlElement *iqNode, CJabberIqInfo *)
+void CJabberProto::OnIqResultMucGetAdminList(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
{
debugLogA("<iq/> iqResultMucGetAdminList");
- OnIqResultMucGetJidList(iqNode, MUC_ADMINLIST);
+ OnIqResultMucGetJidList(iqNode, MUC_ADMINLIST, pInfo);
}
-void CJabberProto::OnIqResultMucGetOwnerList(const TiXmlElement *iqNode, CJabberIqInfo *)
+void CJabberProto::OnIqResultMucGetOwnerList(const TiXmlElement *iqNode, CJabberIqInfo *pInfo)
{
debugLogA("<iq/> iqResultMucGetOwnerList");
- OnIqResultMucGetJidList(iqNode, MUC_OWNERLIST);
+ OnIqResultMucGetJidList(iqNode, MUC_OWNERLIST, pInfo);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 2065956f35..76996d45b3 100755
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -382,7 +382,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void GcQuit(JABBER_LIST_ITEM* jid, int code, const TiXmlElement *reason);
void AdminSet(const char *to, const char *ns, const char *szItem, const char *itemVal, const char *var, const char *varVal);
- void AdminGet(const char *to, const char *ns, const char *var, const char *varVal, JABBER_IQ_HANDLER foo);
+ void AdminGet(const char *to, const char *ns, const char *var, const char *varVal, JABBER_IQ_HANDLER foo, void *pInfo = nullptr);
void AdminSetReason(const char *to, const char *ns, const char *szItem, const char *itemVal, const char *var, const char *varVal, const char *rsn);
void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const char *str);
void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const char *str, const char *reason);
@@ -569,7 +569,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void SetMucConfig(CJabberFormDlg *pDlg, void *from);
void MucShutdown(void);
- void OnIqResultMucGetJidList(const TiXmlElement *iqNode, JABBER_MUC_JIDLIST_TYPE listType);
+ void OnIqResultMucGetJidList(const TiXmlElement *iqNode, JABBER_MUC_JIDLIST_TYPE listType, CJabberIqInfo*);
//---- jabber_message_handlers.cpp ---------------------------------------------------
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index d7710f32a6..e8a7c7d74c 100755
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -481,6 +481,7 @@ struct JABBER_MUC_JIDLIST_INFO : public MZeroedObject
TiXmlDocument doc;
TiXmlElement *iqNode;
CJabberProto *ppro;
+ void *pUserData;
wchar_t* type2str(void) const;
};