Skip to content

Add a way to plug in additional savedata types into Messenger #980

@iphydf

Description

@iphydf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priorityenhancementNew feature for the user, not a new feature for build scriptmessengerMessenger

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions