-
Notifications
You must be signed in to change notification settings - Fork 299
Description
Needed for persistent conferences, so group.c can save its state when we call tox_save.
Currently, the saving code is ad-hoc in Messenger.c and a bit in DHT.c. The loading code is mostly ad-hoc, with one iterator function in state.c that helps with iterating over sections in the save data.
We should split the code up such that the structural code (writing section headers, cookies, length) is in state.c, while the section-specific logic is in section-specific functions in Messenger.c and DHT.c. The section numbers should be associated with a size/save/load triple of function pointers that are used for the section-specific serialisation. Alternatively, only a save/load pair where save
would be called twice, once to calculate the size, and once to actually write the section.
The task here is to design and implement an extensible load/save module (state.c) that allows a layer on top of Messenger (e.g. group
) to register additional section types with associated load/save functions.