Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http_jmap.c: add "urn:ietf:params:jmap:core:backendInfo" capability #4856

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions imap/jmap_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 18 additions & 0 deletions imap/jmap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <string.h>
#include <syslog.h>
#include <sys/utsname.h>

#include "acl.h"
#include "append.h"
Expand Down Expand Up @@ -183,6 +184,23 @@ HIDDEN void jmap_core_init(jmap_settings_t *settings)
settings->limits[MAX_OBJECTS_IN_SET],
"collationAlgorithms", json_array()));

if (config_serverinfo == IMAP_ENUM_SERVERINFO_ON) {
struct utsname buf;

uname(&buf);
json_object_set_new(settings->server_capabilities,
JMAP_URN_CORE_INFO,
json_pack("{s:{s:s s:s} s:n s:{s:s s:s} s:n}",
"product",
"name", "Cyrus JMAP",
"version", CYRUS_VERSION,
"backend",
"environment",
"name", buf.sysname,
"version", buf.release,
"capabilitiesOverrides"));
}

jmap_method_t *mp;
for (mp = jmap_core_methods_standard; mp->name; mp++) {
hash_insert(mp->name, mp, &settings->methods);
Expand Down
Loading