E2kAutoconfig

## E2kAutoconfig E2kAutoconfig — Account autoconfiguration |

## Synopsis

                        E2kAutoconfig;
    enum                E2kExchangeVersion;
    enum                E2kAutoconfigAuthPref;
    enum                E2kAutoconfigResult;
    E2kAutoconfig *     e2k_autoconfig_new                  (const gchar *owa_uri,
                                                             const gchar *username,
                                                             const gchar *password,
                                                             E2kAutoconfigAuthPref auth_pref);
    void                e2k_autoconfig_free                 (E2kAutoconfig *ac);
    void                e2k_autoconfig_set_owa_uri          (E2kAutoconfig *ac,
                                                             const gchar *owa_uri);
    void                e2k_autoconfig_set_gc_server        (E2kAutoconfig *ac,
                                                             const gchar *gc_server,
                                                             gint gal_limit,
                                                             E2kAutoconfigGalAuthPref gal_auth);
    void                e2k_autoconfig_set_username         (E2kAutoconfig *ac,
                                                             const gchar *username);
    void                e2k_autoconfig_set_password         (E2kAutoconfig *ac,
                                                             const gchar *password);
    E2kContext *        e2k_autoconfig_get_context          (E2kAutoconfig *ac,
                                                             E2kOperation *op,
                                                             E2kAutoconfigResult *result);
    E2kAutoconfigResult  e2k_autoconfig_check_exchange      (E2kAutoconfig *ac,
                                                             E2kOperation *op);
    E2kGlobalCatalog *  e2k_autoconfig_get_global_catalog   (E2kAutoconfig *ac,
                                                             E2kOperation *op);
    E2kAutoconfigResult  e2k_autoconfig_check_global_catalog
                                                            (E2kAutoconfig *ac,
                                                             E2kOperation *op);
    const gchar *       e2k_autoconfig_lookup_option        (const gchar *option);

## Description

The `E2kAutoconfig` object handles trying to automatically configure a user’s account without requiring the user to have to know arcane details about the organization of the company’s Exchange servers.

## Details

### E2kAutoconfig

    typedef struct {
    	/* Input data. (gc_server is optional) */
    	gchar *owa_uri, *gc_server;
    	gchar *username, *password;
    	gint gal_limit;
    	E2kAutoconfigGalAuthPref gal_auth;

    	/* Output data */
    	E2kExchangeVersion version;
    	gchar *display_name, *email;
    	gchar *account_uri, *exchange_server;
    	gchar *timezone;

    	/* Private-ish members */
    	gchar *nt_domain, *w2k_domain;
    	gchar *home_uri, *exchange_dn;
    	gchar *pf_server;
    	E2kAutoconfigAuthPref auth_pref;
    	gboolean require_ntlm, use_ntlm;
    	gboolean saw_basic, saw_ntlm;
    	gboolean nt_domain_defaulted, gc_server_autodetected;
    } E2kAutoconfig;

### enum E2kExchangeVersion

    typedef enum {
    	E2K_EXCHANGE_UNKNOWN,
    	E2K_EXCHANGE_2000,
    	E2K_EXCHANGE_2003,

    	E2K_EXCHANGE_FUTURE
    } E2kExchangeVersion;

### enum E2kAutoconfigAuthPref

    typedef enum {
    	E2K_AUTOCONFIG_USE_BASIC,
    	E2K_AUTOCONFIG_USE_NTLM,
    	E2K_AUTOCONFIG_USE_EITHER
    } E2kAutoconfigAuthPref;

### enum E2kAutoconfigResult

    typedef enum {
    	E2K_AUTOCONFIG_OK,
    	E2K_AUTOCONFIG_REDIRECT,
    	E2K_AUTOCONFIG_TRY_SSL,
    	E2K_AUTOCONFIG_AUTH_ERROR,
    	E2K_AUTOCONFIG_AUTH_ERROR_TRY_DOMAIN,
    	E2K_AUTOCONFIG_AUTH_ERROR_TRY_BASIC,
    	E2K_AUTOCONFIG_AUTH_ERROR_TRY_NTLM,
    	E2K_AUTOCONFIG_EXCHANGE_5_5,
    	E2K_AUTOCONFIG_NOT_EXCHANGE,
    	E2K_AUTOCONFIG_NO_OWA,
    	E2K_AUTOCONFIG_NO_MAILBOX,
    	E2K_AUTOCONFIG_CANT_BPROPFIND,
    	E2K_AUTOCONFIG_CANT_RESOLVE,
    	E2K_AUTOCONFIG_CANT_CONNECT,
    	E2K_AUTOCONFIG_CANCELLED,
    	E2K_AUTOCONFIG_FAILED
    } E2kAutoconfigResult;

### e2k_autoconfig_new ()

    E2kAutoconfig *     e2k_autoconfig_new                  (const gchar *owa_uri,
                                                             const gchar *username,
                                                             const gchar *password,
                                                             E2kAutoconfigAuthPref auth_pref);

Creates an autoconfig context, based on information stored in the config file or provided as arguments.

`owa_uri` : | the OWA URI, or `NULL` to (try to) use a default
`username` : | the username (or DOMAIN\username), or `NULL` to use a default
`password` : | the password, or `NULL` if not yet known
`auth_pref` : | information about what auth type to use
Returns : | an autoconfig context

### e2k_autoconfig_free ()

    void                e2k_autoconfig_free                 (E2kAutoconfig *ac);

Frees `ac`.

`ac` : | an autoconfig context

### e2k_autoconfig_set_owa_uri ()

    void                e2k_autoconfig_set_owa_uri          (E2kAutoconfig *ac,
                                                             const gchar *owa_uri);

Sets `ac`'s owa_uri field to `owa_uri` (or the default if `owa_uri` is `NULL`), and resets any fields whose values had been set based on the old value of owa_uri.

`ac` : | an autoconfig context
`owa_uri` : | the new OWA URI, or `NULL`

### e2k_autoconfig_set_gc_server ()

    void                e2k_autoconfig_set_gc_server        (E2kAutoconfig *ac,
                                                             const gchar *gc_server,
                                                             gint gal_limit,
                                                             E2kAutoconfigGalAuthPref gal_auth);

Sets `ac`'s gc_server field to `gc_server` (or the default if `gc_server` is `NULL`) and the gal_limit field to `gal_limit`, and resets any fields whose values had been set based on the old value of gc_server.

`ac` : | an autoconfig context
`gc_server` : | the new GC server, or `NULL`
`gal_limit` : | GAL search size limit, or -1 for no limit
`gal_auth` : | Preferred authentication method for gal

### e2k_autoconfig_set_username ()

    void                e2k_autoconfig_set_username         (E2kAutoconfig *ac,
                                                             const gchar *username);

Sets `ac`'s username field to `username` (or the default if `username` is `NULL`), and resets any fields whose values had been set based on the old value of username.

`ac` : | an autoconfig context
`username` : | the new username (or DOMAIN\username), or `NULL`

### e2k_autoconfig_set_password ()

    void                e2k_autoconfig_set_password         (E2kAutoconfig *ac,
                                                             const gchar *password);

Sets or clears `ac`'s password field.

`ac` : | an autoconfig context
`password` : | the new password, or `NULL` to clear

### e2k_autoconfig_get_context ()

    E2kContext *        e2k_autoconfig_get_context          (E2kAutoconfig *ac,
                                                             E2kOperation *op,
                                                             E2kAutoconfigResult *result);

### e2k_autoconfig_check_exchange ()

    E2kAutoconfigResult  e2k_autoconfig_check_exchange      (E2kAutoconfig *ac,
                                                             E2kOperation *op);

### e2k_autoconfig_get_global_catalog ()

    E2kGlobalCatalog *  e2k_autoconfig_get_global_catalog   (E2kAutoconfig *ac,
                                                             E2kOperation *op);

Tries to connect to the global catalog associated with `ac` (trying to figure it out from the domain name if the server name is not yet known).

`ac` : | an autoconfig context
`op` : | an E2kOperation, for cancellation
Returns : | the global catalog, or `NULL` if the GC server name wasn't provided and couldn't be autodetected.

### e2k_autoconfig_check_global_catalog ()

    E2kAutoconfigResult  e2k_autoconfig_check_global_catalog
                                                            (E2kAutoconfig *ac,
                                                             E2kOperation *op);

### e2k_autoconfig_lookup_option ()

    const gchar *       e2k_autoconfig_lookup_option        (const gchar *option);

Looks up an autoconfiguration hint in the config file (if present)

`option` : | option name to look up
Returns : | the string value of the option, or `NULL` if it is unset.

## See Also

E2kContext, E2kGlobalCatalog