libinfinity-0.6 Reference Manual: Result of an asynchronous request

## Result of an asynchronous request Result of an asynchronous request — Request results for the infinote requests |

## Stability Level

Unstable, unless otherwise indicated

## Functions

InfRequestResult * | inf_request_result_new ()
InfRequestResult * | inf_request_result_copy ()
void | inf_request_result_free ()
gconstpointer | inf_request_result_get ()
InfRequestResult * | inf_request_result_make_add_node ()
void | inf_request_result_get_add_node ()
InfRequestResult * | inf_request_result_make_remove_node ()
void | inf_request_result_get_remove_node ()
InfRequestResult * | inf_request_result_make_explore_node ()
void | inf_request_result_get_explore_node ()
InfRequestResult * | inf_request_result_make_save_session ()
void | inf_request_result_get_save_session ()
InfRequestResult * | inf_request_result_make_subscribe_session ()
void | inf_request_result_get_subscribe_session ()
InfRequestResult * | inf_request_result_make_subscribe_chat ()
void | inf_request_result_get_subscribe_chat ()
InfRequestResult * | inf_request_result_make_query_acl_account_list ()
void | inf_request_result_get_query_acl_account_list ()
InfRequestResult * | inf_request_result_make_lookup_acl_accounts ()
void | inf_request_result_get_lookup_acl_accounts ()
InfRequestResult * | inf_request_result_make_create_acl_account ()
void | inf_request_result_get_create_acl_account ()
InfRequestResult * | inf_request_result_make_remove_acl_account ()
void | inf_request_result_get_remove_acl_account ()
InfRequestResult * | inf_request_result_make_query_acl ()
void | inf_request_result_get_query_acl ()
InfRequestResult * | inf_request_result_make_set_acl ()
void | inf_request_result_get_set_acl ()
InfRequestResult * | inf_request_result_make_join_user ()
void | inf_request_result_get_join_user ()

## Types and Values

| InfRequestResult

## Object Hierarchy

        GBoxed
        ╰── InfRequestResult

## Includes

    #include <libinfinity/common/inf-request-result.h>

## Description

These functions allow to create InfRequestResult objects and to extract the resulting values from them. In general, all objects in a InfRequestResult are not referenced and must point to an existing reference which is guaranteed to live as long as the InfRequestResult object stays alive. This is typically the case for the primary use case of InfRequestResult, which is to serve as a common parameter for the “finished” signal.

## Functions

### inf_request_result_new ()

    InfRequestResult *
    inf_request_result_new (gpointer data,
                            gsize len);

This function creates a new InfRequestResult with the given data. The function takes ownership of the data which must have been allocated with `g_malloc()`. The memory segment at `data` must not hold any object references or require deinitialization in a way other than with `g_free()`.

Under normal circumstances, this function should not be used, and instead one of the inf_request_result_make_*() functions should be used.

#### Parameters

data | The data representing the result of the request. |
len | The length of the data. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_copy ()

    InfRequestResult *
    inf_request_result_copy (const InfRequestResult *result);

Creates a copy of `result` .

#### Parameters

result | A InfRequestResult. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_free ()

    void
    inf_request_result_free (InfRequestResult *result);

Releases all resources associated with `result` .

#### Parameters

result | A InfRequestResult. |

### inf_request_result_get ()

    gconstpointer
    inf_request_result_get (const InfRequestResult *result,
                            gsize *length);

Returns the data of `result` , as given to `inf_request_result_new()`. The length of the data is stored in `length` . Normally this function does not need to be used and one of the inf_request_result_get_*() functions should be used instead.

#### Parameters

result | A InfRequestResult. |
length | An output parameter for the length of the result data, or `NULL`. |

#### Returns

A pointer to the request data.

### inf_request_result_make_add_node ()

    InfRequestResult *
    inf_request_result_make_add_node (InfBrowser *browser,
                                      const InfBrowserIter *iter,
                                      const InfBrowserIter *new_node);

Creates a new InfRequestResult for an "add-node" request, see `inf_browser_add_note()` or `inf_browser_add_subdirectory()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` .

#### Parameters

browser | A InfBrowser. |
iter | An iterator pointing to the node to which a node has been added. |
new_node | An iterator pointing to the new node. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_add_node ()

    void
    inf_request_result_get_add_node (const InfRequestResult *result,
                                     InfBrowser **browser,
                                     const InfBrowserIter **iter,
                                     const InfBrowserIter **new_node);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_add_node()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
iter | Output value for the node to which a node has been added, or `NULL`. |
new_node | Output value for the new node, or `NULL`. |

### inf_request_result_make_remove_node ()

    InfRequestResult *
    inf_request_result_make_remove_node (InfBrowser *browser,
                                         const InfBrowserIter *iter);

Creates a new InfRequestResult for an "remove-node" request, see `inf_browser_remove_node()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` .

#### Parameters

browser | A InfBrowser. |
iter | An iterator pointing to the node to which was removed. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_remove_node ()

    void
    inf_request_result_get_remove_node (const InfRequestResult *result,
                                        InfBrowser **browser,
                                        const InfBrowserIter **iter);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_remove_node()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
iter | Output value for the node that has been removed, or `NULL`. |

### inf_request_result_make_explore_node ()

    InfRequestResult *
    inf_request_result_make_explore_node (InfBrowser *browser,
                                          const InfBrowserIter *iter);

Creates a new InfRequestResult for an "explore-node" request, see `inf_browser_explore()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` .

#### Parameters

browser | A InfBrowser. |
iter | An iterator pointing to the node to which was explored. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_explore_node ()

    void
    inf_request_result_get_explore_node (const InfRequestResult *result,
                                         InfBrowser **browser,
                                         const InfBrowserIter **iter);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_explore_node()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
iter | Output value for the node that has been explored, or `NULL`. |

### inf_request_result_make_save_session ()

    InfRequestResult *
    inf_request_result_make_save_session (InfBrowser *browser,
                                          const InfBrowserIter *iter);

Creates a new InfRequestResult for a "save-session" request, see `infc_browser_iter_save_session()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` .

#### Parameters

browser | A InfBrowser. |
iter | An iterator pointing to the node to which was saved. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_save_session ()

    void
    inf_request_result_get_save_session (const InfRequestResult *result,
                                         InfBrowser **browser,
                                         const InfBrowserIter **iter);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_save_session()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
iter | Output value for the node that has been saved, or `NULL`. |

### inf_request_result_make_subscribe_session ()

    InfRequestResult *
    inf_request_result_make_subscribe_session
                                   (InfBrowser *browser,
                                    const InfBrowserIter *iter,
                                    InfSessionProxy *proxy);

Creates a new InfRequestResult for a "subscribe-session" request, see `inf_browser_subscribe()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` and `proxy` .

#### Parameters

browser | A InfBrowser. |
iter | An iterator pointing to the node to which a subscription was made. |
proxy | The InfSessionProxy for the subscription. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_subscribe_session ()

    void
    inf_request_result_get_subscribe_session
                                   (const InfRequestResult *result,
                                    InfBrowser **browser,
                                    const InfBrowserIter **iter,
                                    InfSessionProxy **proxy);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_subscribe_session()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
iter | Output value for the node that has been subscribed to, or `NULL`. |
proxy | Output value for the subscribed session's proxy, or `NULL`. |

### inf_request_result_make_subscribe_chat ()

    InfRequestResult *
    inf_request_result_make_subscribe_chat
                                   (InfBrowser *browser,
                                    InfSessionProxy *proxy);

Creates a new InfRequestResult for a "subscribe-chat" request, see `infc_browser_subscribe_chat()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` and `proxy` .

#### Parameters

browser | A InfBrowser. |
proxy | The InfSessionProxy for the subscribed session. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_subscribe_chat ()

    void
    inf_request_result_get_subscribe_chat (const InfRequestResult *result,
                                           InfBrowser **browser,
                                           InfSessionProxy **proxy);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_subscribe_chat()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
proxy | Output value for the subscribed session's proxy, or `NULL`. |

### inf_request_result_make_query_acl_account_list ()

    InfRequestResult *
    inf_request_result_make_query_acl_account_list
                                   (InfBrowser *browser,
                                    const InfAclAccount *accounts,
                                    guint n_accounts,
                                    gboolean does_notifications);

Creates a new InfRequestResult for a "query-acl-account-list" request, see `inf_browser_query_acl_account_list()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` .

#### Parameters

browser | A InfBrowser. |
accounts | The list of accounts. |
n_accounts | The number of items in the account list. |
does_notifications | Whether the server notifies the clients about added or removed accounts. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_query_acl_account_list ()

    void
    inf_request_result_get_query_acl_account_list
                                   (const InfRequestResult *result,
                                    InfBrowser **browser,
                                    const InfAclAccount **accounts,
                                    guint *n_accounts,
                                    gboolean *does_notifications);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_query_acl_account_list()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
accounts | Output value for the list of accounts, or `NULL`. |
n_accounts | Output value for the size of the account list, or `NULL`. |
does_notifications | Output value for the flag whether the server notifies the client about added or removed accounts, or `NULL`. |

### inf_request_result_make_lookup_acl_accounts ()

    InfRequestResult *
    inf_request_result_make_lookup_acl_accounts
                                   (InfBrowser *browser,
                                    const InfAclAccount *accounts,
                                    guint n_accounts);

Creates a new InfRequestResult for a "lookup-acl-accounts" request, see `inf_browser_lookup_acl_accounts()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` .

#### Parameters

browser | A InfBrowser. |
accounts | The list of accounts. |
n_accounts | The number of entries in the account list. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_lookup_acl_accounts ()

    void
    inf_request_result_get_lookup_acl_accounts
                                   (const InfRequestResult *result,
                                    InfBrowser **browser,
                                    const InfAclAccount **accounts,
                                    guint *n_accounts);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_lookup_acl_accounts()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
accounts | Output value for the list of accounts, or `NULL`. |
n_accounts | Output value for the size of the account list, or `NULL`. |

### inf_request_result_make_create_acl_account ()

    InfRequestResult *
    inf_request_result_make_create_acl_account
                                   (InfBrowser *browser,
                                    const InfAclAccount *account,
                                    InfCertificateChain *certificate);

Creates a new InfRequestResult for a "create-acl-account" request, see `inf_browser_create_acl_account()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` .

#### Parameters

browser | A InfBrowser. |
account | The created InfAclAccount. |
certificate | The certificate which can be used to log into `account` . |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_create_acl_account ()

    void
    inf_request_result_get_create_acl_account
                                   (const InfRequestResult *result,
                                    InfBrowser **browser,
                                    const InfAclAccount **account,
                                    InfCertificateChain **certificate);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_create_acl_account()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
account | Output value for the created InfAclAccount, or `NULL`. |
certificate | Output value for the certificate which can be used to log into the account, or `NULL`. |

### inf_request_result_make_remove_acl_account ()

    InfRequestResult *
    inf_request_result_make_remove_acl_account
                                   (InfBrowser *browser,
                                    const InfAclAccount *account);

Creates a new InfRequestResult for a "remove-acl-account" request, see `inf_browser_remove_acl_account()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` .

#### Parameters

browser | A InfBrowser. |
account | The removed InfAclAccount. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_remove_acl_account ()

    void
    inf_request_result_get_remove_acl_account
                                   (const InfRequestResult *result,
                                    InfBrowser **browser,
                                    const InfAclAccount **account);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_remove_acl_account()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
account | Output value for the removed InfAclAccount, or `NULL`. |

### inf_request_result_make_query_acl ()

    InfRequestResult *
    inf_request_result_make_query_acl (InfBrowser *browser,
                                       const InfBrowserIter *iter,
                                       const InfAclSheetSet *sheet_set);

Creates a new InfRequestResult for a "query-acl" request, see `inf_browser_query_acl()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` and `proxy` .

#### Parameters

browser | A InfBrowser. |
iter | An iterator pointing to the node whose ACL was queried. |
sheet_set | The sheet set for the queried node. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_query_acl ()

    void
    inf_request_result_get_query_acl (const InfRequestResult *result,
                                      InfBrowser **browser,
                                      const InfBrowserIter **iter,
                                      const InfAclSheetSet **sheet_set);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_query_acl()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
iter | Output value for the node whose ACL was queried. |
sheet_set | Output value for the node's ACL sheets. |

### inf_request_result_make_set_acl ()

    InfRequestResult *
    inf_request_result_make_set_acl (InfBrowser *browser,
                                     const InfBrowserIter *iter);

Creates a new InfRequestResult for a "set-acl" request, see `inf_browser_set_acl()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `browser` and `proxy` .

#### Parameters

browser | A InfBrowser. |
iter | An iterator pointing to the node whose ACL was set. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_set_acl ()

    void
    inf_request_result_get_set_acl (const InfRequestResult *result,
                                    InfBrowser **browser,
                                    const InfBrowserIter **iter);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_set_acl()`.

#### Parameters

result | A InfRequestResult: |
browser | Output value of the browser that made the request, or `NULL`. |
iter | Output value for the node whose ACL was set. |

### inf_request_result_make_join_user ()

    InfRequestResult *
    inf_request_result_make_join_user (InfSessionProxy *proxy,
                                       InfUser *user);

Creates a new InfRequestResult for a "join-user" request, see `inf_session_proxy_join_user()`. The InfRequestResult object is only valid as long as the caller maintains a reference to `proxy` .

#### Parameters

proxy | A InfSessionProxy. |
user | The joined user. |

#### Returns

A new InfRequestResult. Free with `inf_request_result_free()`.

### inf_request_result_get_join_user ()

    void
    inf_request_result_get_join_user (const InfRequestResult *result,
                                      InfSessionProxy **proxy,
                                      InfUser **user);

Decomposes `result` into its components. The object must have been created with `inf_request_result_make_join_user()`.

#### Parameters

result | A InfRequestResult: |
proxy | Output value of the session proxy that made the request, or `NULL`. |
user | Output value for the joined user. |

## Types and Values

### InfRequestResult

    typedef struct _InfRequestResult InfRequestResult;

InfRequestResult is an opaque data type. You should only access it via the public API functions.