index-thread-links.c revision afb00cdb7ceb2ebe754d9c6b229c663a6de3b736
40N/A/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ 40N/A /* not found, create */ 40N/A /* make non-existing node uniquely identifiable */ 40N/A /* keep message-ids cached */ 70N/A /* add UID to node */ 70N/A /* duplicate, keep the original. if the original ever 70N/A gets expunged, rebuild. */ /* no valid message-id */ /* loops to itself - ignore */ /* child is an ancestor of parent. Adding child -> parent_node would introduce a loop. If any messages referencing the path between parent_node's parent and child_node get expunged, we have to rebuild the tree because the loop might break. #1: a -> b (a.ref=1, b.ref=1) #2: b -> a (a.ref=2, b.ref=2) #3: c -> a -> b (a.ref=3, b.ref=3, c.ref=1) Expunging #3 wouldn't break the loop, but expunging #1 /* earlier lookup_idx() failed */ /* The same link already exists */ /* Set parent_node as child_node's parent */ /* Conflicting parent already exists, keep the original */ /* If this message gets expunged, the parent is changed. */ /* Message doesn't exist, so it was one of the node's children that created the original reference. If that reference gets dropped, the parent is changed. We could catch this in one of several ways: a) Link to parent node gets unreferenced b) Link to this node gets unreferenced c) Any of the child nodes gets expunged b) is probably the least likely to happen, /* link the last ID to us */ /* Message is expunged. Instead of failing the entire THREAD command, just treat the header as non-existing. */ for (i = 0; i <
count; i++) {
/* no valid IDs in References:, use In-Reply-To: instead */ /* conflicting parent, remove it. */ /* If this message gets expunged, we have to revert back to /* duplicate Message-ID probably */ /* couldn't find the message-id */ /* there's only one key with this crc32 value, so it must be what we're looking for */ "unexpected refcount=0");
/* we don't have a root anymore */ /* tmp_mail may be changed below, so we have to duplicate the /* no valid IDs in References:, use In-Reply-To: instead */ /* get the node again, the pointer may have changed */