## CamelInternetAddress

CamelInternetAddress

## Synopsis

    struct              CamelInternetAddress;
    CamelInternetAddress* camel_internet_address_new        (void);
    int                 camel_internet_address_add          (CamelInternetAddress *addr,
                                                             const char *name,
                                                             const char *address);
    gboolean            camel_internet_address_get          (const CamelInternetAddress *addr,
                                                             int index,
                                                             const char **namep,
                                                             const char **addressp);
    int                 camel_internet_address_find_name    (CamelInternetAddress *addr,
                                                             const char *name,
                                                             const char **addressp);
    int                 camel_internet_address_find_address (CamelInternetAddress *addr,
                                                             const char *address,
                                                             const char **namep);
    char*               camel_internet_address_encode_address
                                                            (int *len,
                                                             const char *name,
                                                             const char *addr);
    char*               camel_internet_address_format_address
                                                            (const char *real,
                                                             const char *addr);

## Description

## Details

### struct CamelInternetAddress

    struct CamelInternetAddress {
    	CamelAddress parent;

    	struct _CamelInternetAddressPrivate *priv;
    };

### camel_internet_address_new ()

    CamelInternetAddress* camel_internet_address_new        (void);

Create a new CamelInternetAddress object.

Returns : | a new CamelInternetAddress object

### camel_internet_address_add ()

    int                 camel_internet_address_add          (CamelInternetAddress *addr,
                                                             const char *name,
                                                             const char *address);

Add a new internet address to `addr`.

`addr` : | a CamelInternetAddress object
`name` : | name associated with the new address
`address` : | routing address associated with the new address
Returns : | the index of added entry

### camel_internet_address_get ()

    gboolean            camel_internet_address_get          (const CamelInternetAddress *addr,
                                                             int index,
                                                             const char **namep,
                                                             const char **addressp);

Get the address at `index`.

`addr` : | a CamelInternetAddress object
`index` : | address's array index
`namep` : | holder for the returned name, or `NULL`, if not required.
`addressp` : | holder for the returned address, or `NULL`, if not required.
Returns : | %TRUE if such an address exists, or `FALSE` otherwise

### camel_internet_address_find_name ()

    int                 camel_internet_address_find_name    (CamelInternetAddress *addr,
                                                             const char *name,
                                                             const char **addressp);

Find address by real name.

`addr` : | a CamelInternetAddress object
`name` : | name to lookup
`addressp` : | holder for address part, or `NULL`, if not required.
Returns : | the index of the address matching the name, or `-1` if no match was found

### camel_internet_address_find_address ()

    int                 camel_internet_address_find_address (CamelInternetAddress *addr,
                                                             const char *address,
                                                             const char **namep);

Find an address by address.

`addr` : | a CamelInternetAddress object
`address` : | address to lookup
`namep` : | holder for the matching name, or `NULL`, if not required.
Returns : | the index of the address, or `-1` if not found

### camel_internet_address_encode_address ()

    char*               camel_internet_address_encode_address
                                                            (int *len,
                                                             const char *name,
                                                             const char *addr);

Encode a single address ready for internet usage. Header folding as per rfc822 is also performed, based on the length *`len`. If `len` is `NULL`, then no folding will occur.

Note: The value at *`in` will be updated based on any linewrapping done

`len` : | the length of the line the address is being appended to
`name` : | the unencoded real name associated with the address
`addr` : | the routing address
Returns : | the encoded address

### camel_internet_address_format_address ()

    char*               camel_internet_address_format_address
                                                            (const char *real,
                                                             const char *addr);

Function to format a single address, suitable for display.

`real` : |
`addr` : | an rfc822 routing address
Returns : | a nicely formatted string containing the rfc822 address