Re: reading the sharedseen inside mboxlist.c
Ken Murchison <[email protected]> Tue, 15 Apr 2025 11:26:28 -0400
| Newsgroups | gmane.mail.imap.cyrus |
|---|---|
| Organization | Fastmail US LLC |
| Message-ID | <[email protected]> |
Hi Gabriele,
The easiest thing to do would be to open the parent mailbox and check
the options field:
if (parent->i.options & OPT_IMAP_SHAREDSEEN) {
}
On 4/15/25 11:07 AM, Gabriele Bulfon wrote:
> Hi,
> I'm trying to modify mboxlist.c to check for the sharedseen flag of a
> folder during subfolder creation, so to set it to true automatically
> when the parent is true.
> I'm having trouble reading the attrib, I made this function:
>
> static int _mbe_has_sharedseen(const mbentry_t *mbentry, const char
> *entry)
> {
> syslog(LOG_DEBUG, "TEST: _mbe_has_sharedseen [name: '%s', uniqueid:
> '%s', entry: '%s']", mbentry->name, mbentry->uniqueid, entry);
> struct buf attrib = BUF_INITIALIZER;
> int res = 0;
>
> char *dbname = mboxname_to_dbname(mbentry->name);
> syslog(LOG_DEBUG, "TEST: _mbe_has_sharedseen [dbname: '%s']", dbname);
> annotatemore_lookup_mbe(mbentry, entry, "", &attrib);
> // annotatemore_lookup(dbname, entry, "", &attrib);
>
> if (buf_len(&attrib)) {
> syslog(LOG_DEBUG, "TEST: attrib.len ok");
> strarray_t *val = strarray_split(buf_cstring(&attrib), NULL, 0);
> syslog(LOG_DEBUG, "TEST: after strarray_splite ['%s']", val);
> if (strarray_contains_case(val, "true")) {
> syslog(LOG_DEBUG, "TEST: value is true");
> res = 1;
> }
> strarray_free(val);
> }
>
> buf_free(&attrib);
> free(dbname);
>
> return res;
> }
>
> and call it like this:
>
> _mbe_has_sharedseen(p_mbentry, "/shared" IMAP_ANNOT_NS "sharedseen")
>
> but it's alway returning false, as if annotatemore_lookup_mbe produces
> alwats a "buf_len(&attrib)" of 0.
> What's wrong with my call to annotatemore_lookup_mbe?
>
> Thanks for any help,
>
>
> Gabriele
>
> *Sonicle S.r.l. *: http://www.sonicle.com <https://www.sonicle.com/>
> *Music: *http://www.gabrielebulfon.com
> *eXoplanets : *https://gabrielebulfon.bandcamp.com/album/exoplanets
> *Cyrus <https://cyrus.topicbox.com/latest>* / Info / see discussions
> <https://cyrus.topicbox.com/groups/info> + participants
> <https://cyrus.topicbox.com/groups/info/members> + delivery options
> <https://cyrus.topicbox.com/groups/info/subscription> Permalink
> <https://cyrus.topicbox.com/groups/info/T150d344237b2338e-M84feeda33cdb389c6626beb1>
>
--
Kenneth Murchison
Senior Software Developer
Fastmail US LLC
IETF MailMaint Chair
------------------------------------------
Cyrus: Info
Permalink: https://cyrus.topicbox.com/groups/info/T150d344237b2338e-M712c1772f4d3272029376fbd
Delivery options: https://cyrus.topicbox.com/groups/info/subscription