From a65bf615e5ab029903fa5cedd80a2d89b3deaa02 Mon Sep 17 00:00:00 2001 From: Ken Murchison Date: Wed, 20 Mar 2024 00:24:31 -0400 Subject: [PATCH] http_jmap.c: add "urn:ietf:params:jmap:core:backendInfo" capability --- imap/http_jmap.c | 19 +++++++++++++++++++ imap/jmap_api.h | 1 + 2 files changed, 20 insertions(+) diff --git a/imap/http_jmap.c b/imap/http_jmap.c index 97a2105145..75b488fc56 100644 --- a/imap/http_jmap.c +++ b/imap/http_jmap.c @@ -44,6 +44,7 @@ #include #include +#include #include "acl.h" #include "append.h" @@ -206,6 +207,24 @@ static void jmap_init(struct buf *serverinfo) "url", "wss:" JMAP_BASE_URL JMAP_WS_COL, "supportsPush", jmap_push_poll)); } + + if (config_serverinfo == IMAP_ENUM_SERVERINFO_ON) { + struct utsname buf; + + uname(&buf); + json_object_set_new(my_jmap_settings.server_capabilities, + JMAP_URN_CORE_INFO, + json_pack("{s:{s:s s:s} s:{s:s s:s} s:{s:s s:s}}", + "apiBackend", + "name", "Cyrus JMAP", + "version", CYRUS_VERSION, + "product", + "name", "Cyrus JMAP", + "version", CYRUS_VERSION, + "environment", + "name", buf.sysname, + "version", buf.release)); + } } static int jmap_auth(const char *userid __attribute__((unused))) diff --git a/imap/jmap_api.h b/imap/jmap_api.h index 4d52489a1d..01ef375e14 100644 --- a/imap/jmap_api.h +++ b/imap/jmap_api.h @@ -58,6 +58,7 @@ #include "strarray.h" #define JMAP_URN_CORE "urn:ietf:params:jmap:core" +#define JMAP_URN_CORE_INFO "urn:ietf:params:jmap:core:backendInfo" #define JMAP_URN_MAIL "urn:ietf:params:jmap:mail" #define JMAP_URN_SUBMISSION "urn:ietf:params:jmap:submission" #define JMAP_URN_VACATION "urn:ietf:params:jmap:vacationresponse"