summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_thread.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-02-15 17:21:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-02-15 17:21:20 +0300
commit1513340956911f3e3efc252bc1a0bae046dc8d3e (patch)
tree440259d88935aad26ea8245d3e29fe22cbbb950a /protocols/JabberG/src/jabber_thread.cpp
parent87cd5608a92fb2dda0694076ec99704c6ca7fd67 (diff)
Jabber: partial support for XEP-0231: Bits of Binary
Diffstat (limited to 'protocols/JabberG/src/jabber_thread.cpp')
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp60
1 files changed, 12 insertions, 48 deletions
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 5d65e472e6..dda7597d6a 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -46,16 +46,6 @@ static ThreadData *g_pRegInfo; // pointer to registration thread
int iqIdRegGetReg;
int iqIdRegSetReg;
-// XML Console
-#define JCPF_IN 0x01UL
-#define JCPF_OUT 0x02UL
-#define JCPF_ERROR 0x04UL
-
-static VOID CALLBACK JabberDummyApcFunc(DWORD_PTR)
-{
- return;
-}
-
struct JabberPasswordDlgParam
{
CJabberProto *pro;
@@ -103,7 +93,8 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
param->saveOnlinePassword = TRUE;
}
}
- // Fall through
+ __fallthrough;
+
case IDCANCEL:
param->dlgResult = LOWORD(wParam);
SetEvent(param->hEventPasswdDlg);
@@ -116,7 +107,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
return FALSE;
}
-static VOID CALLBACK JabberPasswordCreateDialogApcProc(void* param)
+static VOID CALLBACK JabberPasswordCreateDialogApcProc(void *param)
{
CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_PASSWORD), nullptr, JabberPasswordDlgProc, (LPARAM)param);
}
@@ -1180,11 +1171,6 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
item = ListGetItemPtr(LIST_VCARD_TEMP, from);
time_t msgTime = 0;
- bool isChatRoomInvitation = false;
- const char *inviteRoomJid = nullptr;
- const char *inviteFromJid = nullptr;
- const char *inviteReason = nullptr;
- const char *invitePassword = nullptr;
// check chatstates availability
if (pFromResource && XmlGetChildByTag(node, "active", "xmlns", JABBER_FEAT_CHATSTATES))
@@ -1330,13 +1316,12 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
else if (!mir_strcmp(pszXmlns, JABBER_FEAT_MUC_USER)) {
auto *inviteNode = XmlFirstChild(xNode, "invite");
if (inviteNode != nullptr) {
- inviteFromJid = XmlGetAttr(inviteNode, "from");
- inviteReason = XmlGetChildText(inviteNode, "reason");
- inviteRoomJid = from;
+ auto *inviteReason = XmlGetChildText(inviteNode, "reason");
if (inviteReason == nullptr)
inviteReason = szMessage;
- isChatRoomInvitation = true;
- invitePassword = XmlGetChildText(xNode, "password");
+ if (!m_bIgnoreMUCInvites)
+ GroupchatProcessInvite(XmlGetAttr(inviteNode, "from"), from, inviteReason, XmlGetChildText(xNode, "password"));
+ return;
}
}
else if (!mir_strcmp(pszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) && item != nullptr && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) {
@@ -1361,35 +1346,14 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
}
}
}
- else if (!isChatRoomInvitation && !mir_strcmp(pszXmlns, JABBER_FEAT_DIRECT_MUC_INVITE)) {
- inviteRoomJid = XmlGetAttr(xNode, "jid");
- inviteFromJid = from;
- if (inviteReason == nullptr)
- inviteReason = xNode->GetText();
+ else if (!mir_strcmp(pszXmlns, JABBER_FEAT_DIRECT_MUC_INVITE)) {
+ auto *inviteReason = xNode->GetText();
if (!inviteReason)
inviteReason = szMessage;
- isChatRoomInvitation = true;
- }
- }
-
- if (isChatRoomInvitation) {
- if (inviteRoomJid != nullptr) {
- if (m_bIgnoreMUCInvites) {
- // FIXME: temporary disabled due to MUC inconsistence on server side
- /*
- XmlNode m("message"); XmlAddAttr(m, "to", from);
- XmlNode xNode = XmlAddChild(m, "x");
- XmlAddAttr(xNode, "xmlns", JABBER_FEAT_MUC_USER);
- XmlNode declineNode = XmlAddChild(xNode, "decline");
- XmlAddAttr(declineNode, "from", inviteRoomJid);
- XmlNode reasonNode = XmlAddChild(declineNode, "reason", "The user has chosen to not accept chat invites");
- info->send(m);
- */
- }
- else GroupchatProcessInvite(inviteRoomJid, inviteFromJid, inviteReason, invitePassword);
+ if (!m_bIgnoreMUCInvites)
+ GroupchatProcessInvite(XmlGetAttr(xNode, "jid"), from, inviteReason, nullptr);
+ return;
}
- debugLogA("chat room invitation processed, returning");
- return;
}
// all service info was already processed