Skip to content

Commit

Permalink
Merge pull request #3375 from dilyanpalauzov/principal_search_display…
Browse files Browse the repository at this point in the history
…name

http_dav.c:principal_search() utilize DAV:displayname from the annotations
  • Loading branch information
ksmurchison authored Oct 11, 2024
2 parents db4250e + c1ffe11 commit b2a07df
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 b2a07df

Please sign in to comment.