summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG')
-rwxr-xr-x[-rw-r--r--]protocols/JabberG/src/jabber_caps.cpp1
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.h6
-rwxr-xr-x[-rw-r--r--]protocols/JabberG/src/jabber_db_utils.h5
-rwxr-xr-x[-rw-r--r--]protocols/JabberG/src/jabber_opt.cpp18
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp15
5 files changed, 42 insertions, 3 deletions
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index 0a4e6b25a6..39ae14b61f 100644..100755
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -75,6 +75,7 @@ const JabberFeatCapPair g_JabberFeatCapPairs[] = {
{ JABBER_FEAT_JINGLE, JABBER_CAPS_JINGLE, LPGENW("Supports Jingle") },
{ JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGENW("Supports Roster Exchange") },
{ JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGENW("Supports direct chat invitations (XEP-0249)") },
+ { JABBER_FEAT_OMEMO_NOTIFY, JABBER_CAPS_OMEMO_NOTIFY, LPGENW("Receives information about OMEMO devices") },
{ NULL }
};
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h
index f5e5b2c26d..1e68f3fcce 100755
--- a/protocols/JabberG/src/jabber_caps.h
+++ b/protocols/JabberG/src/jabber_caps.h
@@ -111,7 +111,9 @@ typedef unsigned __int64 JabberCapsBits;
#define JABBER_FEAT_NEWGPG L"http://miranda-ng.org/caps/new_gpg"
#define JABBER_CAPS_NEWGPG ((JabberCapsBits)1<<43)
#define JABBER_FEAT_OMEMO L"eu.siacs.conversations.axolotl" //will become "urn:xmpp:omemo:0" once standard get accepted
-#define JABBER_CAPS_OMEMO ((JabberCapsBits)1<<63)
+#define JABBER_CAPS_OMEMO ((JabberCapsBits)1<<46)
+#define JABBER_FEAT_OMEMO_NOTIFY JABBER_FEAT_OMEMO L"+notify"
+#define JABBER_CAPS_OMEMO_NOTIFY ((JabberCapsBits)1<<47)
#define JABBER_CAPS_PLATFORMX86 ((JabberCapsBits)1<<44)
#define JABBER_CAPS_PLATFORMX64 ((JabberCapsBits)1<<45)
#define JABBER_FEAT_PRIVACY_LISTS L"jabber:iq:privacy"
@@ -154,7 +156,7 @@ typedef unsigned __int64 JabberCapsBits;
#define JABBER_FEAT_PUBSUB_EVENT L"http://jabber.org/protocol/pubsub#event"
#define JABBER_FEAT_PUBSUB_NODE_CONFIG L"http://jabber.org/protocol/pubsub#node_config"
-#define JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY ((JabberCapsBits)1<<62)
+#define JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY ((JabberCapsBits)1<<63)
#define JABBER_CAPS_OTHER_SPECIAL (JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY|JABBER_RESOURCE_CAPS_ERROR) // must contain all the caps not listed in g_JabberFeatCapPairs, to prevent using these bits for features registered through IJabberNetInterface::RegisterFeature()
#define JABBER_CAPS_MIRANDA_NODE L"http://miranda-ng.org/caps"
diff --git a/protocols/JabberG/src/jabber_db_utils.h b/protocols/JabberG/src/jabber_db_utils.h
index 6411f8b603..fd9a8ffa42 100644..100755
--- a/protocols/JabberG/src/jabber_db_utils.h
+++ b/protocols/JabberG/src/jabber_db_utils.h
@@ -84,6 +84,8 @@ struct CJabberOptions
CMOption<BYTE> ProcessXMPPLinks;
CMOption<BYTE> IgnoreRosterGroups;
+ CMOption<BYTE> UseOMEMO;
+
CJabberOptions(PROTO_INTERFACE *proto) :
BsDirect(proto, "BsDirect", TRUE),
AllowVersionRequests(proto, "AllowVersionRequests", TRUE),
@@ -138,7 +140,8 @@ struct CJabberOptions
ConnectionKeepAliveInterval(proto, "ConnectionKeepAliveInterval", 60000),
ConnectionKeepAliveTimeout(proto, "ConnectionKeepAliveTimeout", 50000),
ProcessXMPPLinks(proto, "ProcessXMPPLinks", FALSE),
- IgnoreRosterGroups(proto, "IgnoreRosterGroups", FALSE)
+ IgnoreRosterGroups(proto, "IgnoreRosterGroups", FALSE),
+ UseOMEMO(proto, "UseOMEMO", FALSE)
{}
};
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 3ad6032c0c..23452d205e 100644..100755
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -811,6 +811,7 @@ public:
m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Show information about operating system in version replies"), m_proto->m_options.ShowOSVersion);
m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Accept only in band incoming filetransfers (don't disclose own IP)"), m_proto->m_options.BsOnlyIBB);
m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Accept HTTP Authentication requests (XEP-0070)"), m_proto->m_options.AcceptHttpAuth);
+ m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Use OMEMO encryption for messages if possible (placeholder)"), m_proto->m_options.UseOMEMO);
}
void OnInitDialog()
@@ -847,6 +848,23 @@ public:
}
}
}
+ //dynamic caps
+ {
+ JabberCapsBits jcb = 0;
+ // set all bits occupied by g_JabberFeatCapPairs
+ for (int i = 0; g_JabberFeatCapPairs[i].szFeature; i++)
+ jcb |= g_JabberFeatCapPairs[i].jcbCap;
+
+ // set all bits already occupied by external plugins
+ for (int i = 0; i < m_proto->m_lstJabberFeatCapPairsDynamic.getCount(); i++)
+ jcb |= m_proto->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
+ if(m_proto->m_options.UseOMEMO)
+ jcb |= JABBER_CAPS_OMEMO_NOTIFY;
+ else
+ jcb &= ~JABBER_CAPS_OMEMO_NOTIFY;
+
+ m_proto->m_clientCapsManager.SetClientCaps(JABBER_CAPS_MIRANDA_NODE, szCoreVersion, jcb);
+ }
m_proto->SendPresence(m_proto->m_iStatus, true);
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index b7422a4896..0ddbbee5fe 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -127,6 +127,21 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) :
m_messageManager.FillPermanentHandlers();
m_adhocManager.FillDefaultNodes();
m_clientCapsManager.AddDefaultCaps();
+ if (m_options.UseOMEMO)
+ {
+ JabberCapsBits jcb = 0;
+ // set all bits occupied by g_JabberFeatCapPairs
+ for (int i = 0; g_JabberFeatCapPairs[i].szFeature; i++)
+ jcb |= g_JabberFeatCapPairs[i].jcbCap;
+
+ // set all bits already occupied by external plugins
+ for (int i = 0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
+ jcb |= m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
+
+ jcb |= JABBER_CAPS_OMEMO_NOTIFY;
+
+ m_clientCapsManager.SetClientCaps(JABBER_CAPS_MIRANDA_NODE, szCoreVersion, jcb);
+ }
IconsInit();
InitPopups();