CamelMedium: Camel Reference Manual

## CamelMedium CamelMedium |

## Functions

void | camel_medium_add_header ()
void | camel_medium_set_header ()
void | camel_medium_remove_header ()
gconstpointer | camel_medium_get_header ()
GArray * | camel_medium_get_headers ()
void | camel_medium_free_headers ()
CamelDataWrapper * | camel_medium_get_content ()
void | camel_medium_set_content ()

## Properties

CamelDataWrapper * | content | Read / Write

## Types and Values

struct | CamelMedium
| CamelMediumHeader

## Object Hierarchy

        GObject
        ╰── CamelDataWrapper
            ╰── CamelMedium
                ╰── CamelMimePart

## Description

## Functions

### camel_medium_add_header ()

    void
    camel_medium_add_header (CamelMedium *medium,
                             const gchar *name,
                             gconstpointer value);

Adds a header to a CamelMedium.

#### Parameters

medium | a CamelMedium object |
name | name of the header |
value | value of the header |

### camel_medium_set_header ()

    void
    camel_medium_set_header (CamelMedium *medium,
                             const gchar *name,
                             gconstpointer value);

Sets the value of a header. Any other occurances of the header will be removed. Setting a `NULL` header can be used to remove the header also.

#### Parameters

medium | a CamelMedium object |
name | name of the header |
value | value of the header |

### camel_medium_remove_header ()

    void
    camel_medium_remove_header (CamelMedium *medium,
                                const gchar *name);

Removes the named header from the medium. All occurances of the header are removed.

#### Parameters

medium | a CamelMedium |
name | the name of the header |

### camel_medium_get_header ()

    gconstpointer
    camel_medium_get_header (CamelMedium *medium,
                             const gchar *name);

Gets the value of the named header in the medium, or `NULL` if it is unset. The caller should not modify or free the data.

If the header occurs more than once, only retrieve the first instance of the header. For multi-occuring headers, use :`get_headers()`.

#### Parameters

medium | a CamelMedium |
name | the name of the header |

#### Returns

the value of the named header, or `NULL`.

[transfer none][nullable]

### camel_medium_get_headers ()

    GArray *
    camel_medium_get_headers (CamelMedium *medium);

Gets an array of all header name/value pairs (as CamelMediumHeader structures). The values will be decoded to UTF-8 for any headers that are recognized by Camel. The caller should not modify the returned data.

#### Parameters

medium | a CamelMedium object |

#### Returns

the array of headers, which must be freed with `camel_medium_free_headers()`.

[element-type CamelMediumHeader][transfer full]

### camel_medium_free_headers ()

    void
    camel_medium_free_headers (CamelMedium *medium,
                               GArray *headers);

Frees `headers` .

#### Parameters

medium | a CamelMedium object |
headers | an array of headers returned from `camel_medium_get_headers()`. | [element-type CamelMediumHeader]

### camel_medium_get_content ()

    CamelDataWrapper *
    camel_medium_get_content (CamelMedium *medium);

Gets a data wrapper that represents the content of the medium, without its headers.

#### Parameters

medium | a CamelMedium object |

#### Returns

a CamelDataWrapper containing `medium` 's content. Can return NULL.

[transfer none][nullable]

### camel_medium_set_content ()

    void
    camel_medium_set_content (CamelMedium *medium,
                              CamelDataWrapper *content);

Sets the content of `medium` to be `content` .

#### Parameters

medium | a CamelMedium object |
content | a CamelDataWrapper object |

## Types and Values

### struct CamelMedium

    struct CamelMedium;

### CamelMediumHeader

    typedef struct {
    	const gchar *name;
    	const gchar *value;
    } CamelMediumHeader;

## Property Details

### The `“content”` property

      “content”                  CamelDataWrapper *

Flags: Read / Write