diff options
author | George Hazan <ghazan@miranda.im> | 2022-11-17 18:38:47 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-11-17 18:38:47 +0300 |
commit | 6d4ab3925c39c234cefd6b6145eb98c169693681 (patch) | |
tree | 99d37f497b0f1867d9161e58b92201648db75a7c /protocols/WhatsApp/src/wanode.cpp | |
parent | ec6ddc5feabf87a067ea22bea943befb169a8684 (diff) |
WhatsApp: fix for reading own keys
Diffstat (limited to 'protocols/WhatsApp/src/wanode.cpp')
-rw-r--r-- | protocols/WhatsApp/src/wanode.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/protocols/WhatsApp/src/wanode.cpp b/protocols/WhatsApp/src/wanode.cpp index 8d5a2ef7f0..f48ceaebd9 100644 --- a/protocols/WhatsApp/src/wanode.cpp +++ b/protocols/WhatsApp/src/wanode.cpp @@ -576,17 +576,23 @@ void WAWriter::writeString(const char *str) auto *pszDelimiter = strchr(str, '@'); if (pszDelimiter) { - writeByte(JID_PAIR); + WAJid jid(str); + if (jid.device || jid.agent) { + writeByte(AD_JID); + writeByte(jid.agent); + writeByte(jid.device); + writeString(jid.user); + } + else { + writeByte(JID_PAIR); - if (pszDelimiter == str) // empty jid - writeByte(LIST_EMPTY); - else - writeString(CMStringA(str, int(pszDelimiter - str))); + if (jid.user.IsEmpty()) // empty user + writeByte(LIST_EMPTY); + else + writeString(jid.user); - if (pszDelimiter[1] == 0) // empty jid - writeByte(LIST_EMPTY); - else - writeString(pszDelimiter + 1); + writeString(jid.server); + } } else { CMStringA buf(str); |