## ESourceSecurity ESourceSecurity — ESource extension for security settings |

## Synopsis

    #include <libedataserver/libedataserver.h>

    #define             E_SOURCE_EXTENSION_SECURITY
    struct              ESourceSecurity;
    struct              ESourceSecurityClass;
    const gchar *       e_source_security_get_method        (ESourceSecurity *extension);
    gchar *             e_source_security_dup_method        (ESourceSecurity *extension);
    void                e_source_security_set_method        (ESourceSecurity *extension,
                                                             const gchar *method);
    gboolean            e_source_security_get_secure        (ESourceSecurity *extension);
    void                e_source_security_set_secure        (ESourceSecurity *extension,
                                                             gboolean secure);

## Description

The ESourceSecurity extension tracks settings for establishing a secure connection with a remote server.

Access the extension as follows:

    1
    2
    3
    4
    5
    #include <libedataserver/libedataserver.h>

    ESourceSecurity *extension;

    extension = e_source_get_extension (source, E_SOURCE_EXTENSION_SECURITY);

## Details

### E_SOURCE_EXTENSION_SECURITY

    #define E_SOURCE_EXTENSION_SECURITY "Security"

Pass this extension name to `e_source_get_extension()` to access ESourceSecurity. This is also used as a group name in key files.

Since 3.6

### struct ESourceSecurity

    struct ESourceSecurity {
    	ESourceExtension parent;
    	ESourceSecurityPrivate *priv;
    };

Contains only private data that should be read and manipulated using the functions below.

Since 3.6

### struct ESourceSecurityClass

    struct ESourceSecurityClass {
    	ESourceExtensionClass parent_class;
    };

### e_source_security_get_method ()

    const gchar *       e_source_security_get_method        (ESourceSecurity *extension);

Returns the method used to establish a secure network connection to a remote account. There are no pre-defined method names; backends are free to set this however they wish. If a secure connection is not desired, the convention is to set "method" to "none".

`extension` : | an ESourceSecurity
Returns : | the method used to establish a secure network connection

Since 3.6

### e_source_security_dup_method ()

    gchar *             e_source_security_dup_method        (ESourceSecurity *extension);

Thread-safe variation of `e_source_security_get_method()`. Use this function when accessing `extension` from multiple threads.

The returned string should be freed with `g_free()` when no longer needed.

`extension` : | an ESourceSecurity
Returns : | a newly-allocated copy of "method"

Since 3.6

### e_source_security_set_method ()

    void                e_source_security_set_method        (ESourceSecurity *extension,
                                                             const gchar *method);

Sets the method used to establish a secure network connection to a remote account. There are no pre-defined method names; backends are free to set this however they wish. If a secure connection is not desired, the convention is to set "method" to "none". In keeping with that convention, "method" will be set to "none" if `method` is `NULL` or an empty string.

`extension` : | an ESourceSecurity
`method` : | security method, or `NULL`. [allow-none]

Since 3.6

### e_source_security_get_secure ()

    gboolean            e_source_security_get_secure        (ESourceSecurity *extension);

This is a convenience function which returns whether a secure network connection is desired, regardless of the method used. This relies on the convention of setting "method" to "none" when a secure network connection is not desired.

`extension` : | an ESourceSecurity
Returns : | whether a secure network connection is desired

Since 3.6

### e_source_security_set_secure ()

    void                e_source_security_set_secure        (ESourceSecurity *extension,
                                                             gboolean secure);

This function provides a simpler way to set "method" when using a secure network connection is a yes or no option and the exact method name is unimportant. If `secure` is `FALSE`, the "method" property is set to "none". If `secure` is `TRUE`, the function assumes the backend will use Transport Layer Security and sets the "method" property to "tls".

`extension` : | an ESourceSecurity
`secure` : | whether a secure network connection is desired

Since 3.6