From 2d19ad0db4b41a800e1753922c0d09d136473812 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 23 Jan 2020 22:54:47 +0100 Subject: Add option to notify about version request Cannot be configured for now. Can be set via `adv.notify.discoversion` in the `notification` section. Will notify about version requests via XEP-0092 and XEP-0232. Client version can still be seen via caps (capabilities). See `stanza_attach_caps()`. --- src/config/preferences.c | 3 +++ src/config/preferences.h | 1 + src/xmpp/iq.c | 8 ++++++++ 3 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/config/preferences.c b/src/config/preferences.c index f80eae29..2b2c7191 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -1740,6 +1740,7 @@ _get_group(preference_t pref) case PREF_NOTIFY_MENTION_WHOLE_WORD: case PREF_TRAY: case PREF_TRAY_READ: + case PREF_ADV_NOTIFY_DISCO_OR_VERSION: return PREF_GROUP_NOTIFICATIONS; case PREF_CHLOG: case PREF_GRLOG: @@ -1804,6 +1805,8 @@ _get_key(preference_t pref) return "tray"; case PREF_TRAY_READ: return "tray.read"; + case PREF_ADV_NOTIFY_DISCO_OR_VERSION: + return "adv.notify.discoversion"; case PREF_INTYPE: return "intype"; case PREF_HISTORY: diff --git a/src/config/preferences.h b/src/config/preferences.h index 3f21aee9..f0d49e60 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -57,6 +57,7 @@ typedef enum { PREF_FLASH, PREF_TRAY, PREF_TRAY_READ, + PREF_ADV_NOTIFY_DISCO_OR_VERSION, PREF_INTYPE, PREF_HISTORY, PREF_CARBONS, diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 0e4dd151..b2fed28c 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -1564,6 +1564,10 @@ _version_get_handler(xmpp_stanza_t *const stanza) } if (from) { + if (prefs_get_boolean(PREF_ADV_NOTIFY_DISCO_OR_VERSION)) { + cons_show("Received IQ version request (XEP-0092) from %s", from); + } + xmpp_stanza_t *response = xmpp_iq_new(ctx, STANZA_TYPE_RESULT, id); xmpp_stanza_set_to(response, from); @@ -1709,6 +1713,10 @@ _disco_info_get_handler(xmpp_stanza_t *const stanza) } if (from) { + if (prefs_get_boolean(PREF_ADV_NOTIFY_DISCO_OR_VERSION)) { + cons_show("Received IQ disco info request (XEP-0232) from %s", from); + } + xmpp_stanza_t *response = xmpp_iq_new(ctx, STANZA_TYPE_RESULT, xmpp_stanza_get_id(stanza)); xmpp_stanza_set_to(response, from); -- cgit 1.4.1-2-gfad0