summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-02-13 13:45:32 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-02-13 13:45:32 +0300
commit189f180fc3916adac86e9e5ead87d326305eefe3 (patch)
treed6969545275772da0e8dfc354528993af30d7012
parent7ce0cbd1578ef39496f1eacb5d04186695b1e2a6 (diff)
Jabber: more logs in ProcessMessage()
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp52
1 files changed, 37 insertions, 15 deletions
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index c3bd15f02b..5d65e472e6 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1053,8 +1053,10 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
return;
const char *from, *type = XmlGetAttr(node, "type");
- if ((from = XmlGetAttr(node, "from")) == nullptr)
+ if ((from = XmlGetAttr(node, "from")) == nullptr) {
+ debugLogA("no 'from' attribute, returning");
return;
+ }
const char *idStr = XmlGetAttr(node, "id");
pResourceStatus pFromResource(ResourceInfoFromJID(from));
@@ -1080,8 +1082,10 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
}
}
- if (m_messageManager.HandleMessagePermanent(node, info))
+ if (m_messageManager.HandleMessagePermanent(node, info)) {
+ debugLogA("permanent message handler succeeded, returning");
return;
+ }
// Handle carbons. The message MUST be coming from our bare JID.
const TiXmlElement *carbon = nullptr;
@@ -1095,14 +1099,18 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
}
if (carbon) {
// If carbons are disabled in options, we should ignore occasional carbons sent to us by server
- if (!m_bEnableCarbons)
+ if (!m_bEnableCarbons) {
+ debugLogA("carbons aren't enabled, returning");
return;
+ }
auto *xmlForwarded = XmlGetChildByTag(carbon, "forwarded", "xmlns", JABBER_XMLNS_FORWARD);
auto *xmlMessage = XmlFirstChild(xmlForwarded, "message");
// Carbons MUST have forwarded/message content
- if (xmlMessage == nullptr)
+ if (xmlMessage == nullptr) {
+ debugLogA("no 'forwarded' attribute in carbons, returning");
return;
+ }
// Unwrap the carbon in any case
node = xmlMessage;
@@ -1111,14 +1119,18 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
if (!carbonSent) {
// Received should just be treated like incoming messages, except maybe not flash the flasher. Simply unwrap.
from = XmlGetAttr(node, "from");
- if (from == nullptr)
+ if (from == nullptr) {
+ debugLogA("no 'from' attribute in carbons, returning");
return;
+ }
}
else {
// Sent should set SENT flag and invert from/to.
from = XmlGetAttr(node, "to");
- if (from == nullptr)
+ if (from == nullptr) {
+ debugLogA("no 'to' attribute in carbons, returning");
return;
+ }
}
}
}
@@ -1128,8 +1140,10 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
if (chatItem) {
auto *xCaptcha = XmlFirstChild(node, "captcha");
if (xCaptcha)
- if (ProcessCaptcha(xCaptcha, node, info))
+ if (ProcessCaptcha(xCaptcha, node, info)) {
+ debugLogA("captcha processing succeeded, returning");
return;
+ }
}
CMStringA szMessage;
@@ -1233,13 +1247,12 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
const char *szId = XmlGetAttr(n, "id");
const char *szMethod = XmlGetAttr(n, "method");
const char *szUrl = XmlGetAttr(n, "url");
- if (!szId || !szMethod || !szUrl)
- return;
-
- CJabberHttpAuthParams *pParams = (CJabberHttpAuthParams *)mir_alloc(sizeof(CJabberHttpAuthParams));
- if (!pParams)
+ if (!szId || !szMethod || !szUrl) {
+ debugLogA("missing attributes in confirm, returning");
return;
+ }
+ CJabberHttpAuthParams *pParams = (CJabberHttpAuthParams *)mir_calloc(sizeof(CJabberHttpAuthParams));
memset(pParams, 0, sizeof(CJabberHttpAuthParams));
pParams->m_nType = CJabberHttpAuthParams::MSG;
pParams->m_szFrom = mir_strdup(from);
@@ -1249,6 +1262,7 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
pParams->m_szUrl = mir_strdup(szUrl);
AddClistHttpAuthEvent(pParams);
+ debugLogA("http auth event added, returning");
return;
}
@@ -1260,6 +1274,7 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
if (jid) {
if (!OmemoHandleMessage(xNode, jid, msgTime))
OmemoPutMessageToIncommingQueue(xNode, jid, msgTime);
+ debugLogA("OMEMO processing finished, returning");
return; //we do not want any additional processing
}
}
@@ -1273,13 +1288,17 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
continue;
if (!mir_strcmp(pszXmlns, JABBER_FEAT_MIRANDA_NOTES)) {
- if (OnIncomingNote(from, XmlFirstChild(xNode, "note")))
+ if (OnIncomingNote(from, XmlFirstChild(xNode, "note"))) {
+ debugLogA("OMEMO: no 'note' attribute, returning");
return;
+ }
}
else if (!mir_strcmp(pszXmlns, "jabber:x:encrypted")) {
const char *ptszText = xNode->GetText();
- if (ptszText == nullptr)
+ if (ptszText == nullptr) {
+ debugLogA("OMEMO: no 'encrypted' attribute, returning");
return;
+ }
// XEP-0027 is not strict enough, different clients have different implementations
// additional validation is required
@@ -1369,12 +1388,15 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
}
else GroupchatProcessInvite(inviteRoomJid, inviteFromJid, inviteReason, invitePassword);
}
+ debugLogA("chat room invitation processed, returning");
return;
}
// all service info was already processed
- if (szMessage.IsEmpty())
+ if (szMessage.IsEmpty()) {
+ debugLogA("empty message, returning");
return;
+ }
szMessage += ExtractImage(node);
szMessage.Replace("\n", "\r\n");