## InfCommunicationManager

InfCommunicationManager — Handling multiple communication sessions

## Stability Level

Unstable, unless otherwise indicated

## Functions

InfCommunicationManager * | inf_communication_manager_new ()
InfCommunicationHostedGroup * | inf_communication_manager_open_group ()
InfCommunicationJoinedGroup * | inf_communication_manager_join_group ()
void | inf_communication_manager_add_factory ()
InfCommunicationFactory * | inf_communication_manager_get_factory_for ()

## Types and Values

struct | InfCommunicationManager
struct | InfCommunicationManagerClass

## Object Hierarchy

        GObject
        ╰── InfCommunicationManager

## Includes

    #include <libinfinity/communication/inf-communication-manager.h>

## Description

InfCommunicationManager manages multiple communication sessions represented by InfCommunicationGroup. A InfCommunicationGroup provides an easy way to send messages between group members, possibly sharing connections with other groups handled by the same InfCommunicationManager.

## Functions

### inf_communication_manager_new ()

    InfCommunicationManager *
    inf_communication_manager_new (void);

Creates a new InfCommunicationManager.

[constructor]

#### Returns

A new InfCommunicationManager.

[transfer full]

### inf_communication_manager_open_group ()

    InfCommunicationHostedGroup *
    inf_communication_manager_open_group (InfCommunicationManager *manager,
                                          const gchar *group_name,
                                          const gchar * const*methods);

Opens a new communication group published by the local host. `group_name` is an identifier for the group via which other hosts can join the group using `inf_communication_manager_join_group()`. It needs to be unique among all groups opened by the local host.

`methods` specifies what communication methods the group should use, in order of priority. If a method is not supported for a given network, then the next one in the array is tried. If none is supported, then the "central" method will be used, which is guaranteed to be supported for all networks.

#### Parameters

manager | A InfCommunicationManager. |
group_name | A name for the new group. |
methods | Methods to support, or `NULL`. | [allow-none][array zero-terminated=1]

#### Returns

A InfCommunicationHostedGroup. Free with `g_object_unref()` to leave the group.

[transfer full]

### inf_communication_manager_join_group ()

    InfCommunicationJoinedGroup *
    inf_communication_manager_join_group (InfCommunicationManager *manager,
                                          const gchar *group_name,
                                          InfXmlConnection *publisher_conn,
                                          const gchar *method);

Joins a communication group published by a remote host. `publisher_conn` needs to be a to the publishing host with status `INF_XML_CONNECTION_OPEN` or `INF_XML_CONNECTION_OPENING`. `group_name` specifies the name of the group to join.

`method` specifies the communication method to use. It must match the communication method the publisher has chosen for `publisher_conn` 's network (see `inf_communication_group_get_method_for_network()`). The function returns `NULL` if `method` is not supported (which means `inf_communication_manager_get_factory_for()` for `publisher_conn` 's network and `method` returns `NULL`).

#### Parameters

manager | A InfCommunicationManager. |
group_name | The group to join. |
publisher_conn | A InfXmlConnection to the publishing host. |
method | The communication method to use. |

#### Returns

A new InfCommunicationJoinedGroup, or `NULL`. Free with `g_object_unref()` to leave the group.

[transfer full][allow-none]

### inf_communication_manager_add_factory ()

    void
    inf_communication_manager_add_factory (InfCommunicationManager *manager,
                                           InfCommunicationFactory *factory);

Adds a new InfCommunicationFactory to `manager` . This makes `manager` support all method/network combinations that `factory` supports. If multiple added factories support the same combination, the one which was added first will be used to instantiate the InfCommunicationMethod.

#### Parameters

manager | A InfCommunicationManager. |
factory | The InfCommunicationFactory to add. |

### inf_communication_manager_get_factory_for ()

    InfCommunicationFactory *
    inf_communication_manager_get_factory_for
                                   (InfCommunicationManager *manager,
                                    const gchar *network,
                                    const gchar *method_name);

Returns the InfCommunicationFactory that `manager` will use to instantiate a InfCommunicationMethod for `method_name` on `network` , or `NULL` if the network/method combination is not supported.

#### Parameters

manager | A InfCommunicationManager. |
network | A network identifier. |
method_name | A method name. |

#### Returns

A InfCommunicationFactory, or `NULL`.

[transfer none][allow-none]

## Types and Values

### struct InfCommunicationManager

    struct InfCommunicationManager;

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

### struct InfCommunicationManagerClass

    struct InfCommunicationManagerClass {
    };

This structure does not contain any public fields.