From 0eed72c23ea6bcd30f835de99bb6c220e2cec1ad Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 6 Feb 2020 19:47:17 +0300 Subject: Jabber: bye-bye, XEP-0022, you became completely obsolete these days... sic transit gloria mundi --- protocols/JabberG/src/jabber_caps.cpp | 1 - protocols/JabberG/src/jabber_caps.h | 5 ++-- protocols/JabberG/src/jabber_notes.cpp | 4 --- protocols/JabberG/src/jabber_proto.cpp | 21 +------------- protocols/JabberG/src/jabber_thread.cpp | 49 --------------------------------- 5 files changed, 3 insertions(+), 77 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 69a6e750b8..8ee625bf42 100755 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -48,7 +48,6 @@ const JabberFeatCapPair g_JabberFeatCapPairs[] = { JABBER_FEAT_ENTITY_TIME, JABBER_CAPS_ENTITY_TIME, LPGEN("Can report local time of the user") }, { JABBER_FEAT_PING, JABBER_CAPS_PING, LPGEN("Can send and receive ping requests") }, { JABBER_FEAT_DATA_FORMS, JABBER_CAPS_DATA_FORMS, LPGEN("Supports data forms") }, - { JABBER_FEAT_MESSAGE_EVENTS, JABBER_CAPS_MESSAGE_EVENTS, LPGEN("Can request and respond to events relating to the delivery, display, and composition of messages") }, { JABBER_FEAT_VCARD_TEMP, JABBER_CAPS_VCARD_TEMP, LPGEN("Supports vCard") }, { JABBER_FEAT_XHTML, JABBER_CAPS_XHTML, LPGEN("Supports XHTML formatting of chat messages") }, { JABBER_FEAT_AGENTS, JABBER_CAPS_AGENTS, LPGEN("Supports Jabber Browsing") }, diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h index 511347028f..873739064b 100755 --- a/protocols/JabberG/src/jabber_caps.h +++ b/protocols/JabberG/src/jabber_caps.h @@ -96,8 +96,7 @@ typedef unsigned __int64 JabberCapsBits; #define JABBER_FEAT_DATA_FORMS "jabber:x:data" #define JABBER_CAPS_DATA_FORMS ((JabberCapsBits)1<<16) -#define JABBER_FEAT_MESSAGE_EVENTS "jabber:x:event" -#define JABBER_CAPS_MESSAGE_EVENTS ((JabberCapsBits)1<<17) +//!!!!!!!! Vacancy #define JABBER_FEAT_VCARD_TEMP "vcard-temp" #define JABBER_CAPS_VCARD_TEMP ((JabberCapsBits)1<<18) @@ -207,7 +206,7 @@ typedef unsigned __int64 JabberCapsBits; #define JABBER_CAPS_MIRANDA_NODE "http://miranda-ng.org/caps" #define JABBER_CAPS_MIRANDA_PARTIAL (JABBER_CAPS_DISCO_INFO | JABBER_CAPS_DISCO_ITEMS | JABBER_CAPS_MUC | JABBER_CAPS_ENTITY_CAPS | JABBER_CAPS_SI | JABBER_CAPS_SI_FT | \ JABBER_CAPS_BYTESTREAMS | JABBER_CAPS_IBB | JABBER_CAPS_OOB | JABBER_CAPS_CHATSTATES | JABBER_CAPS_AGENTS | JABBER_CAPS_BROWSE | \ - JABBER_CAPS_VERSION | JABBER_CAPS_LAST_ACTIVITY | JABBER_CAPS_DATA_FORMS | JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_VCARD_TEMP | \ + JABBER_CAPS_VERSION | JABBER_CAPS_LAST_ACTIVITY | JABBER_CAPS_DATA_FORMS | JABBER_CAPS_VCARD_TEMP | \ JABBER_CAPS_ENTITY_TIME | JABBER_CAPS_PING | JABBER_CAPS_PRIVACY_LISTS | JABBER_CAPS_MESSAGE_RECEIPTS | JABBER_CAPS_PRIVATE_STORAGE | \ JABBER_CAPS_ROSTER_EXCHANGE | JABBER_CAPS_DIRECT_MUC_INVITE) diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 3b4c7ab699..8f1a4eef1e 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -691,10 +691,6 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok) // message receipts XEP priority if (jcb & JABBER_CAPS_MESSAGE_RECEIPTS) m << XCHILDNS("request", JABBER_FEAT_MESSAGE_RECEIPTS); - else if (jcb & JABBER_CAPS_MESSAGE_EVENTS) { - TiXmlElement *x = m << XCHILDNS("x", JABBER_FEAT_MESSAGE_EVENTS); - x << XCHILD("delivered"); x << XCHILD("offline"); - } else nMsgId = -1; diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 513a9dfd8f..63744c93ac 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -1009,7 +1009,7 @@ int CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const char *psz // if message delivery check disabled by entity caps manager (jcb & JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY) || // if client knows nothing about delivery - !(jcb & (JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_MESSAGE_RECEIPTS)) || + !(jcb & JABBER_CAPS_MESSAGE_RECEIPTS) || // if message sent to groupchat !mir_strcmp(msgType, "groupchat") || // if message delivery check disabled in settings @@ -1029,10 +1029,6 @@ int CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const char *psz // message receipts XEP priority if (jcb & JABBER_CAPS_MESSAGE_RECEIPTS) m << XCHILDNS("request", JABBER_FEAT_MESSAGE_RECEIPTS); - else if (jcb & JABBER_CAPS_MESSAGE_EVENTS) { - TiXmlElement *x = m << XCHILDNS("x", JABBER_FEAT_MESSAGE_EVENTS); - x << XCHILD("delivered"); x << XCHILD("offline"); - } m_ThreadInfo->send(m); } @@ -1256,21 +1252,6 @@ int CJabberProto::UserIsTyping(MCONTACT hContact, int type) break; } } - else if (jcb & JABBER_CAPS_MESSAGE_EVENTS) { - TiXmlElement *x = m << XCHILDNS("x", JABBER_FEAT_MESSAGE_EVENTS); - if (item->messageEventIdStr != nullptr) - x << XCHILD("id", item->messageEventIdStr); - - switch (type) { - case PROTOTYPE_SELFTYPING_OFF: - m_ThreadInfo->send(m); - break; - case PROTOTYPE_SELFTYPING_ON: - x << XCHILD("composing"); - m_ThreadInfo->send(m); - break; - } - } return 0; } diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index df54338e93..82a56adbbf 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1160,7 +1160,6 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info) const char *inviteFromJid = nullptr; const char *inviteReason = nullptr; const char *invitePassword = nullptr; - bool isDelivered = false; // check chatstates availability if (pFromResource && XmlGetChildByTag(node, "active", "xmlns", JABBER_FEAT_CHATSTATES)) @@ -1284,54 +1283,6 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info) if (ptszTimeStamp != nullptr) msgTime = JabberIsoToUnixTime(ptszTimeStamp); } - else if (!mir_strcmp(pszXmlns, JABBER_FEAT_MESSAGE_EVENTS)) { - - // set events support only if we discovered caps and if events not already set - JabberCapsBits jcbCaps = GetResourceCapabilities(from); - if (jcbCaps & JABBER_RESOURCE_CAPS_ERROR) - jcbCaps = JABBER_RESOURCE_CAPS_NONE; - // FIXME: disabled due to expired XEP-0022 and problems with bombus delivery checks - // if (jcbCaps && pFromResource && (!(jcbCaps & JABBER_CAPS_MESSAGE_EVENTS))) - // pFromResource->m_jcbManualDiscoveredCaps |= (JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY); - - if (bodyNode == nullptr) { - auto *idNode = XmlFirstChild(xNode, "id"); - if (XmlFirstChild(xNode, "delivered") != nullptr || XmlFirstChild(xNode, "offline") != nullptr) { - int id = -1; - if (idNode != nullptr) - id = JabberGetPacketID(idNode->GetText()); - - if (id != -1) - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)id, 0); - } - - if (hContact && XmlFirstChild(xNode, "composing") != nullptr) - CallService(MS_PROTO_CONTACTISTYPING, hContact, 60); - - // Maybe a cancel to the previous composing - auto *child = XmlFirstChild(xNode, 0); - if (hContact && (!child || (child && idNode != nullptr))) - CallService(MS_PROTO_CONTACTISTYPING, hContact, PROTOTYPE_CONTACTTYPING_OFF); - } - else { - // Check whether any event is requested - if (!isDelivered && XmlFirstChild(xNode, "delivered")) { - isDelivered = true; - - XmlNode m("message"); m << XATTR("to", from); - TiXmlElement *x = m << XCHILDNS("x", JABBER_FEAT_MESSAGE_EVENTS); - x << XCHILD("delivered"); - x << XCHILD("id", idStr); - info->send(m); - } - - if (item != nullptr && XmlFirstChild(xNode, "composing") != nullptr) { - if (item->messageEventIdStr) - mir_free(item->messageEventIdStr); - item->messageEventIdStr = (idStr == nullptr) ? nullptr : mir_strdup(idStr); - } - } - } else if (!mir_strcmp(pszXmlns, JABBER_FEAT_OOB2)) { auto *url = XmlGetChildText(xNode, "url"); if (url != nullptr) { -- cgit v1.2.3