bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2005-2018 Dovecot authors, see the included COPYING file */
bd4e36a8cd7257cca7d1434c49a1e343ed7c5100Timo Sirainenint mailbox_guid_cache_find(struct mailbox_list *list,
4c0aff96fc7e6d779be43458f96cbf015849a3deTimo Sirainen if (!hash_table_is_created(list->guid_cache) ||
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen rec = hash_table_lookup(list->guid_cache, guid_p);
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen rec = hash_table_lookup(list->guid_cache, guid_p);
4c0aff96fc7e6d779be43458f96cbf015849a3deTimo Sirainen if (rec == NULL && list->guid_cache_updated) {
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen rec = hash_table_lookup(list->guid_cache, guid_p);
bd4e36a8cd7257cca7d1434c49a1e343ed7c5100Timo Sirainenvoid mailbox_guid_cache_refresh(struct mailbox_list *list)
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen if (!hash_table_is_created(list->guid_cache)) {
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen hash_table_create(&list->guid_cache, list->guid_cache_pool, 0,
bd4e36a8cd7257cca7d1434c49a1e343ed7c5100Timo Sirainen while ((info = mailbox_list_iter_next(ctx)) != NULL) {
bd4e36a8cd7257cca7d1434c49a1e343ed7c5100Timo Sirainen (MAILBOX_NOSELECT | MAILBOX_NONEXISTENT)) != 0)
bd4e36a8cd7257cca7d1434c49a1e343ed7c5100Timo Sirainen if (mailbox_get_metadata(box, MAILBOX_METADATA_GUID,
bf7dc750b95039981c0e9d728f313d50cf38a156Martti Rannanjärvi info->vname, mailbox_get_last_internal_error(box, NULL));
2a6c02a5e7e5cdf4980befbfaf372603ce338a25Timo Sirainen } else if ((rec = hash_table_lookup(list->guid_cache,
2a6c02a5e7e5cdf4980befbfaf372603ce338a25Timo Sirainen i_warning("Mailbox %s has duplicate GUID with %s: %s",
bd4e36a8cd7257cca7d1434c49a1e343ed7c5100Timo Sirainen memcpy(rec->guid, metadata.guid, sizeof(rec->guid));
402e999a878e0cc41a0afb830fea0a93afc75f0dTimo Sirainen rec->vname = p_strdup(list->guid_cache_pool, info->vname);