Delta Chat Core C Interface
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dc_backup_provider_t Class Reference

Set up another device. More...

#include <deltachat.h>

Public Member Functions

char * dc_backup_provider_get_qr (const dc_backup_provider_t *backup_provider)
 Returns the QR code text that will offer the backup to other devices.
 
char * dc_backup_provider_get_qr_svg (const dc_backup_provider_t *backup_provider)
 Returns the QR code SVG image that will offer the backup to other devices.
 
dc_backup_provider_tdc_backup_provider_new (dc_context_t *context)
 Creates an object for sending a backup to another device.
 
void dc_backup_provider_unref (dc_backup_provider_t *backup_provider)
 Frees a dc_backup_provider_t object.
 
void dc_backup_provider_wait (dc_backup_provider_t *backup_provider)
 Waits for the sending to finish.
 

Detailed Description

Set up another device.

Member Function Documentation

◆ dc_backup_provider_get_qr()

char * dc_backup_provider_get_qr ( const dc_backup_provider_t * backup_provider)

Returns the QR code text that will offer the backup to other devices.

The QR code contains a ticket which will validate the backup and provide authentication for both the provider and the recipient.

The scanning device should call the scanned text to dc_check_qr(). If dc_check_qr() returns DC_QR_BACKUP, the backup transfer can be started using dc_get_backup().

Parameters
backup_providerThe backup provider object as created by dc_backup_provider_new().
Returns
The text that should be put in the QR code. On errors an empty string is returned, NULL is never returned. the returned string must be released using dc_str_unref() after usage.

◆ dc_backup_provider_get_qr_svg()

char * dc_backup_provider_get_qr_svg ( const dc_backup_provider_t * backup_provider)

Returns the QR code SVG image that will offer the backup to other devices.

This works like dc_backup_provider_qr() but returns the text of a rendered SVG image containing the QR code.

Parameters
backup_providerThe backup provider object as created by dc_backup_provider_new().
Returns
The QR code rendered as SVG. On errors an empty string is returned, NULL is never returned. the returned string must be released using dc_str_unref() after usage.

◆ dc_backup_provider_new()

dc_backup_provider_t * dc_backup_provider_new ( dc_context_t * context)

Creates an object for sending a backup to another device.

The backup is sent to through a peer-to-peer channel which is bootstrapped by a QR-code. The backup contains the entire state of the account including credentials. This can be used to setup a new device.

This is a blocking call as some preparations are made like e.g. exporting the database. Once this function returns, the backup is being offered to remote devices. To wait until one device received the backup, use dc_backup_provider_wait(). Alternatively abort the operation using dc_stop_ongoing_process().

During execution of the job DC_EVENT_IMEX_PROGRESS is sent out to indicate state and progress.

Parameters
contextThe context.
Returns
Opaque object for sending the backup. On errors, NULL is returned and dc_get_last_error() returns an error that should be shown to the user.

◆ dc_backup_provider_unref()

void dc_backup_provider_unref ( dc_backup_provider_t * backup_provider)

Frees a dc_backup_provider_t object.

If the provider has not yet finished, as indicated by dc_backup_provider_wait() or the DC_EVENT_IMEX_PROGRESS event with value of 0 (failed) or 1000 (succeeded), this will also abort any in-progress transfer. If this aborts the provider a DC_EVENT_IMEX_PROGRESS event with value 0 (failed) will be emitted.

Parameters
backup_providerThe backup provider object as created by dc_backup_provider_new().

◆ dc_backup_provider_wait()

void dc_backup_provider_wait ( dc_backup_provider_t * backup_provider)

Waits for the sending to finish.

This is a blocking call and should only be called once.

Parameters
backup_providerThe backup provider object as created by dc_backup_provider_new(). If NULL is given nothing is done.

The documentation for this class was generated from the following file: