Storage of chat sessions on the file system

Storage of chat sessions on the file system — Utility functions to deal with storing InfChatSessions in filesystem storage

Stability Level

Unstable, unless otherwise indicated

Functions

Types and Values

Includes

#include <libinfinity/server/infd-chat-filesystem-storage.h>

Description

The functions in this section are utility functions that can be used when implementing a InfdNotePlugin to handle InfChatSessions. These functions implement reading and writing the content of an InfChatSession to an XML file in the storage.

Functions

infd_chat_filesystem_format_read ()

gboolean
infd_chat_filesystem_format_read (InfdFilesystemStorage *storage,
                                  const gchar *path,
                                  InfChatBuffer *buffer,
                                  GError **error);

Reads a chat session from path in storage . The file is expected to have been saved with infd_chat_filesystem_format_write() before. The buffer parameter should be an empty InfChatBuffer, and the document will be written into this buffer. If the function succeeds, the buffer can be used to create an InfChatSession with inf_chat_session_new(). If the function fails, FALSE is returned and error is set.

Parameters

storage

A InfdFilesystemStorage.

 

path

Storage path to retrieve the session from.

 

buffer

An empty InfTextBuffer to use as the new session's buffer.

 

error

Location to store error information, if any, or NULL.

 

Returns

TRUE on success or FALSE on error.


infd_chat_filesystem_format_write ()

gboolean
infd_chat_filesystem_format_write (InfdFilesystemStorage *storage,
                                   const gchar *path,
                                   InfChatBuffer *buffer,
                                   GError **error);

Writes the given buffer into the filesystem storage at path . If successful, the session can then be read back with infd_chat_filesystem_format_read(). If the function fails, FALSE is returned and error is set.

Parameters

storage

A InfdFilesystemStorage.

 

path

Storage path where to write the session to.

 

buffer

The InfChatBuffer to write.

 

error

Location to store error information, if any, or NULL.

 

Returns

TRUE on success or FALSE on error.

Types and Values

enum InfdChatFilesystemFormatError

Errors that can occur when reading a InfChatSession from a InfdFilesystemStorage.

Members

INFD_CHAT_FILESYSTEM_FORMAT_ERROR_NOT_A_CHAT_SESSION

The file to be read is not a serialized chat session.

 

See Also

InfChatSession, InfdFilesystemStorage