summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-06-24 11:33:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-06-24 11:33:25 +0300
commit2c369e66feacfb3b934b1ec28fcecd179d796ba1 (patch)
tree4882960dfa1b0c2fddb8c1b4f01e2ddf537f4962 /protocols/JabberG
parentf5333c257d4b23bb5f37ab3380dd69191f71429c (diff)
Jabber: user name to be encoded to avoid spaces
Diffstat (limited to 'protocols/JabberG')
-rwxr-xr-xprotocols/JabberG/src/jabber_iqid.cpp2
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp7
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_util.cpp7
-rwxr-xr-xprotocols/JabberG/src/stdafx.h1
5 files changed, 10 insertions, 9 deletions
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 690e936ad8..5f8736b31e 100755
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -239,7 +239,7 @@ void CJabberProto::OnIqResultGetAuth(const TiXmlElement *iqNode, CJabberIqInfo*)
if (!mir_strcmp(type, "result")) {
XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResultSetAuth, JABBER_IQ_TYPE_SET));
auto *query = iq << XQUERY("jabber:iq:auth");
- query << XCHILD("username", m_ThreadInfo->conn.username);
+ query << XCHILD("username", EncodeJid(m_ThreadInfo->conn.username));
if (XmlFirstChild(queryNode, "digest") != nullptr && m_ThreadInfo->szStreamId) {
JabberShaStrBuf buf;
char text[200];
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 92acc5ca6d..ee67312f4a 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -799,13 +799,6 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
if (!hDialogsList)
hDialogsList = WindowList_Create();
WindowList_Add(hDialogsList, event->hwndWindow, event->hContact);
-
- ptrA jid(getUStringA(event->hContact, "jid"));
- if (jid != nullptr) {
- JABBER_LIST_ITEM *pItem = ListGetItemPtr(LIST_ROSTER, jid);
- // if (pItem)
- // RetrieveMessageArchive(event->hContact, pItem);
- }
}
else if (event->uType == MSG_WINDOW_EVT_CLOSING) {
if (hDialogsList)
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index e911d7f33d..1a631ad89a 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -561,7 +561,7 @@ void CJabberProto::PerformIqAuth(ThreadData *info)
{
if (!info->bIsReg) {
info->send(XmlNodeIq(AddIQ(&CJabberProto::OnIqResultGetAuth, JABBER_IQ_TYPE_GET))
- << XQUERY("jabber:iq:auth") << XCHILD("username", info->conn.username));
+ << XQUERY("jabber:iq:auth") << XCHILD("username", EncodeJid(info->conn.username)));
}
else PerformRegistration(info);
}
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index aa64fb68e7..a23247b435 100755
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -76,6 +76,13 @@ CMStringA MakeJid(const char *jid, const char *resource)
return ret;
}
+CMStringA EncodeJid(const char *jid)
+{
+ CMStringA ret(jid);
+ ret.Replace(" ", "\20");
+ return ret;
+}
+
void CJabberProto::UpdateItem(JABBER_LIST_ITEM *pItem, const char *name)
{
if (!m_bIgnoreRoster || db_get_wsm(pItem->hContact, "CList", "MyHandle").IsEmpty()) {
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index e744ff7075..a6f1d58f99 100755
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -740,6 +740,7 @@ struct TStringPairs
typedef char JabberShaStrBuf[2*MIR_SHA1_HASH_SIZE + 1];
+CMStringA EncodeJid(const char *jid);
CMStringA MakeJid(const char *jid, const char *resource);
char* JabberNickFromJID(const char *jid);