Skip to content

Commit

Permalink
http_dav.c:principal_search() utilize DAV:displayname from the annota…
Browse files Browse the repository at this point in the history
…titons

When calling REPORT principal-property-search and the search criterion is displayname,
take the displayname from the annotatitonsDB, if available.
  • Loading branch information
dilyanpalauzov committed Sep 17, 2024
1 parent 3668eea commit c1ffe11
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions changes/next/dispayname_on_principal-property-search_report
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Description:

The DAV:principal-property-search REPORT honours the previously set DAV:displayname property on matches

Config changes:

None

Upgrade instructions:

None
5 changes: 3 additions & 2 deletions imap/http_dav.c
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@ HIDDEN void dav_get_principalname(const char *userid, struct buf *buf)
buf_reset(buf);

if (userid) {
const char *annotname = DAV_ANNOT_NS "<" XML_NS_DAV ">displayname";
static const char annotname[] = DAV_ANNOT_NS "<" XML_NS_DAV ">displayname";
char *mailboxname = caldav_mboxname(userid, NULL);
int r = annotatemore_lookupmask(mailboxname, annotname, userid, buf);

Expand Down Expand Up @@ -7987,7 +7987,8 @@ static int principal_search(const char *userid, void *rock)

for (prop = search_crit->props; prop; prop = prop->next) {
if (!strcmp(prop->s, "displayname")) {
if (!xmlStrcasestr(BAD_CAST userid,
dav_get_principalname(userid, &fctx->buf);
if (!xmlStrcasestr(BAD_CAST buf_cstring(&fctx->buf),
search_crit->match)) return 0;
}
else if (!strcmp(prop->s, "calendar-user-address-set")) {
Expand Down

0 comments on commit c1ffe11

Please sign in to comment.