summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_omemo.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-06-10 14:47:38 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-06-10 14:47:42 +0300
commit5d151da574c4567b1ba1ee6f4e21043866c4ee00 (patch)
tree5debc3146a56f84b143cf80c5262c0636f3b5065 /protocols/JabberG/src/jabber_omemo.cpp
parent8db28d5f04f7b40e483f61ff486d4dbd0b85c056 (diff)
Jabber: duplicate code removed
Diffstat (limited to 'protocols/JabberG/src/jabber_omemo.cpp')
-rw-r--r--protocols/JabberG/src/jabber_omemo.cpp42
1 files changed, 9 insertions, 33 deletions
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp
index e87414d68f..28026fe7c0 100644
--- a/protocols/JabberG/src/jabber_omemo.cpp
+++ b/protocols/JabberG/src/jabber_omemo.cpp
@@ -1392,40 +1392,16 @@ bool CJabberProto::OmemoHandleMessage(XmppMsg *msg, const TiXmlElement *node, co
char protocol[7], hexkey[89], suburl[5001];
int ret = sscanf(result.GetBuffer(), "%6[^:]://%5000[^#]#%88s", protocol, suburl, hexkey);
protocol[6] = hexkey[88] = suburl[5000] = 0;
- if (ret == 3 && !strcmp(protocol, "aesgcm") && strlen(hexkey) == 88) {
- CMStringA szName;
- const char *b = strrchr(suburl, '/') + 1;
- while (*b != 0 && *b != '#' && *b != '?')
- szName.AppendChar(*b++);
-
- ptrW pwszName(mir_utf8decodeW(szName.c_str()));
-
- JSONNode root;
- root << WCHAR_PARAM("f", pwszName) << CHAR_PARAM("u", result.GetBuffer());
-
- DBEVENTINFO dbei = {};
- dbei.szModule = Proto_GetBaseAccountName(hContact);
- dbei.iTimestamp = msgTime;
- dbei.eventType = EVENTTYPE_FILE;
- if (trusted)
- dbei.flags = DBEF_SECURE;
- if (isCarbon)
- dbei.flags = DBEF_SENT;
-
- std::string text = root.write();
- dbei.cbBlob = (int)text.size() + 1;
- dbei.pBlob = (char *)text.c_str();
- db_event_add(hContact, &dbei);
- }
- else {
- msg->msgTime = msgTime;
+
+ if (trusted == FP_TOFU)
+ msg->dbei.flags |= DBEF_SECURE;
+ if (trusted == FP_VERIFIED)
+ msg->dbei.flags |= DBEF_STRONG;
+
+ if (ret == 3 && !strcmp(protocol, "aesgcm") && strlen(hexkey) == 88)
+ FileProcessHttpDownload(msg->dbei, result, nullptr);
+ else
msg->szMessage = result;
-
- if (trusted)
- msg->dbei.flags |= DBEF_STRONG;
- if (isCarbon)
- msg->dbei.flags |= DBEF_SENT;
- }
return true;
}