Skip to main content

Module vdir

Module vdir 

Source
Expand description

Address books and calendars on disk, as vdir: one folder per collection, one file per contact (.vcf) or per event (.ics), the collection’s name and colour in the files displayname and color. pimsync, vdirsyncer, khal and khard read the same folders (https://vdirsyncer.pimutils.org/en/stable/vdir.html).

What sync needs to remember, where each file sits on the server and its ETag, lives apart in the state folder: the data folders hold only your contacts and events.

Structs§

Collection
One address book or calendar.
ItemState
One item, as last agreed with the server.
Move 🔒
Moved 🔒
Items moved or made another here, whose old copy’s deletion on its server waits until the new one is there (the review of 22 October 2026, F6: a refused PUT after the DELETE lost the event on every other device).
MovedItem 🔒
Moves 🔒
Items being moved from one collection to another (an event to another calendar: move_item), each from → to written before the move and taken out after it, so that a move cut short (a crash, Android stopping Sioul) is finished at the next look (finish_moves): never twice, never lost.
State
What sync knows of a collection: where it is, how far it got, and each item.

Enums§

Kind

Constants§

LOCAL
The account of collections kept on this computer only.
OFF 🔒
The mark of an account switched off, in its folder of each kind.

Functions§

collections
Every collection of a kind, from every account, by account then name.
content_hash
A short hash of a file’s content, to tell whether it changed since sync.
crashed 🔒
Whether a move stops here, as a crash would (tests only).
create
A new collection made here: its folder, its name and colour, and a state that asks the next sync to create it on the server (MKCALENDAR or an extended MKCOL). components says what a calendar holds (“VTODO” for a task list). Returns it; an id already taken gets a number.
delete_collection
An empty collection deleted: at once when it was never sent, else hidden until the next sync deletes it on the server. One holding anything stays.
deletion_done
The old copy’s deletion done on its server: nothing waits for it any more.
deletion_waits_for
The new item an old one’s deletion on its server waits for, while the new one is not there yet (dav: its PUT first, then the DELETE): None once it is, or when nothing waits.
every_collection
Every collection kept here, those deleted and not yet gone from the server included.
finish_moves
Every move cut short, finished: the item there and still here, taken out here (written whole before the note said so), with what goes with it; not there, the move forgotten, the item kept here and what was made for it taken back; gone from here, the move done. Called before each move and each sync of contacts and calendars.
finish_moves_now 🔒
finish_moves, the journal’s lock held.
folder_id
“personal”, “contacts”, “Calendrier%20perso” → a folder name that holds on every system: letters, digits, - and _, the rest as _.
follow_switches
The marks of switched-off accounts made to follow the configuration, on this device: the mark is this device’s own, while the configuration travels; an account switched on again elsewhere (or here before, in a window that died) kept its mark here, and its calendars and address books, synced all the same, never showed (the phone of 21 October 2026). on: the accounts switched on; off: those switched off. Whether any mark changed.
holds_items
The items a collection holds here: events, tasks or contacts.
kinds_held 🔒
The kinds a calendar’s folder holds (“VEVENT”, “VTODO”), read again only when its list of files changed (its time and count), else as last read.
move_item
An item moved to another collection’s folder as to (21 October 2026): noted first, then written there, then taken out here, then the note gone; a step cut short is finished by finish_moves. Its sync sends the new item and the deletion, whatever their accounts (this device’s own calendar to a server’s: the event reaches your other devices).
moved_change 🔒
moved_here
Whether new is an item moved or made here whose old copy may still be on its server: never replaced by what the server holds under its UID.
moved_path 🔒
moves_load 🔒
moves_path 🔒
moves_save 🔒
new_is_there 🔒
Whether the new item of a move is on its server, or needs not be: gone since, kept on this device alone, or in the old one’s own collection.
new_name
A new item’s name: unique, and safe as a file name and in a URL.
note_moved 🔒
one_folder 🔒
Whether a name (an account’s, a collection’s) is one folder of its own: not “.”, “..”, nor a path (“../x”, “C:”), which would put files elsewhere.
prepare
A collection’s folder, made if needed, with its name and colour written for other tools.
rename_collection
A collection renamed here; the next sync tells the server.
replace_items
Items made another (a task made an appointment, an appointment a task, 21 October 2026): gone (the first, then what goes with it: a task’s time blocks) replaced by to, written as text, with made written just before it (a time block for the task an event becomes). The same steps as a move: noted, made then to written, gone taken out, the note gone. Cut short before to is whole, made is taken back and gone kept; after, gone is taken out (finish_moves): never both, never neither.
replace_locked 🔒
replace_items, the journal’s lock held.
set_account_off
An account’s calendars and address books out of the pages (off), or back.
settle_kinds 🔒
A calendar of this device’s own whose kinds were never written (made before 21 October 2026 without them, when “unsaid” meant both): what it holds says them, written once with it (its state, dav/local/): events alone, tasks alone, or both when it holds both or nothing. A server’s says its own at each sync (supported-calendar-component-set; unsaid, both, as RFC 4791 §5.2.3 has it).
state_path
Where sync keeps what it knows of a collection.
write_item
Writes an item next to its place, then moves it in.