## InfTextSession InfTextSession |

## Functions

InfTextSession * | inf_text_session_new ()
InfTextSession * | inf_text_session_new_with_user_table ()
void | inf_text_session_set_user_color ()
void | inf_text_session_flush_requests_for_user ()
InfRequest * | inf_text_session_join_user ()

## Properties

guint | caret-update-interval | Read / Write / Construct

## Types and Values

enum | InfTextSessionError
enum | InfTextOperationError
struct | InfTextSession
struct | InfTextSessionClass

## Object Hierarchy

        GObject
        ╰── InfSession
            ╰── InfAdoptedSession
                ╰── InfTextSession

## Implemented Interfaces

InfTextSession implements InfCommunicationObject.

## Description

## Functions

### inf_text_session_new ()

    InfTextSession *
    inf_text_session_new (InfCommunicationManager *manager,
                          InfTextBuffer *buffer,
                          InfIo *io,
                          InfSessionStatus status,
                          InfCommunicationGroup *sync_group,
                          InfXmlConnection *sync_connection);

Creates a new InfTextSession. The communication manager is used to send and receive requests from subscription and synchronization. `buffer` will be set to be initially empty if the session is initially synchronized (see below). `io` is required to trigger timeouts.

If `status` is `INF_SESSION_PRESYNC` or `INF_SESSION_SYNCHRONIZING`, then the session will initially be sychronized, meaning the initial content is retrieved from `sync_connection` . If you are subscribed to the session, set the subscription group via `inf_session_set_subscription_group()`.

[constructor]

#### Parameters

manager | A InfCommunicationManager. |
buffer | An initial InfTextBuffer. |
io | A InfIo object. |
status | The initial status of the session. |
sync_group | A group in which the session is synchronized. Ignored if `status` is `INF_SESSION_RUNNING`. | [allow-none]
sync_connection | A connection to synchronize the session from. Ignored if `status` is `INF_SESSION_RUNNING`. | [allow-none]

#### Returns

A new InfTextSession.

[transfer full]

### inf_text_session_new_with_user_table ()

    InfTextSession *
    inf_text_session_new_with_user_table (InfCommunicationManager *manager,
                                          InfTextBuffer *buffer,
                                          InfIo *io,
                                          InfUserTable *user_table,
                                          InfSessionStatus status,
                                          InfCommunicationGroup *sync_group,
                                          InfXmlConnection *sync_connection);

Creates a new InfTextSession. The connection manager is used to send and receive requests from subscription and synchronization. `buffer` will be set to be initially empty if the session is initially synchronized (see below). `io` is required to trigger timeouts.

If `status` is `INF_SESSION_PRESYNC` or `INF_SESSION_SYNCHRONIZING`, then the session will initially be sychronized, meaning the initial content is retrieved from `sync_connection` . If you are subscribed to the session, set the subscription group via `inf_session_set_subscription_group()`.

`user_table` is used as an initial user table. The user table should only contain unavailable users, if any, that may rejoin during the session. If there was an available user in the user table, it would probably belong to another session, but different sessions cannot share the same user object.

[constructor]

#### Parameters

manager | A InfCommunicationManager. |
buffer | An initial InfTextBuffer. |
io | A InfIo object. |
user_table | A InfUserTable. |
status | The initial status for the session. |
sync_group | A group in which the session is synchronized. Ignored if `status` is `INF_SESSION_RUNNING`. | [allow-none]
sync_connection | A connection to synchronize the session from. Ignored if `status` is `INF_SESSION_RUNNING`. | [allow-none]

#### Returns

A new InfTextSession.

[transfer full]

### inf_text_session_set_user_color ()

    void
    inf_text_session_set_user_color (InfTextSession *session,
                                     InfTextUser *user,
                                     gdouble hue);

Changes the user color of `user` . `user` must have the `INF_USER_LOCAL` flag set.

#### Parameters

session | A InfTextSession. |
user | A local InfTextUser from `session` 's user table. |
hue | New hue value for `user` 's color. Ranges from 0.0 (red) to 1.0 (red). |

### inf_text_session_flush_requests_for_user ()

    void
    inf_text_session_flush_requests_for_user
                                   (InfTextSession *session,
                                    InfTextUser *user);

This function sends all pending requests for `user` immediately. Requests that modify the buffer are not queued normally, but cursor movement requests are delayed in case are issued frequently, to save bandwidth.

The main purpose of this function is to send all pending requests before changing a user's status to inactive or unavailable since inactive users are automatically activated as soon as they issue a request.

TODO: We should probably detect this automatically, without requiring people to call this function, i.e. flush requests for local users just before they become inactive.

`user` must have the `INF_USER_LOCAL` flag set.

#### Parameters

session | A InfTextSession. |
user | The InfTextUser for which to flush messages. |

### inf_text_session_join_user ()

    InfRequest *
    inf_text_session_join_user (InfSessionProxy *proxy,
                                const gchar *name,
                                InfUserStatus status,
                                gdouble hue,
                                guint caret_position,
                                int selection_length,
                                InfRequestFunc func,
                                gpointer user_data);

This functions creates a user join request for an InfTextSession. This is a shortcut for `inf_session_proxy_join_user()`.

#### Parameters

proxy | A InfSessionProxy with a InfTextSession session. |
name | The name of the user to join. |
status | The initial status of the user to join. Must not be `INF_USER_UNAVAILABLE` . |
hue | The user color of the user to join. |
caret_position | The initial position of the new user's cursor. |
selection_length | The initial length of the new user's selection. |
func | Function to call after completion of the request, or `NULL`. | [scope async]
user_data | Additional data to pass to `func` . |

#### Returns

A InfRequest, or `NULL`.

[transfer full]

## Types and Values

### enum InfTextSessionError

#### Members

INF_TEXT_SESSION_ERROR_INVALID_HUE |  |
INF_TEXT_SESSION_ERROR_FAILED |  |

### enum InfTextOperationError

Error codes that can occur when applying a InfTextInsertOperation, InfTextDeleteOperation or InfTextMoveOperation to the buffer.

#### Members

INF_TEXT_OPERATION_ERROR_INVALID_INSERT | A InfTextInsertOperation attempted to insert text after the end of the buffer. |
INF_TEXT_OPERATION_ERROR_INVALID_DELETE | A InfTextDeleteOperation attempted to delete text from after the end of the buffer. |
INF_TEXT_OPERATION_ERROR_INVALID_MOVE | A InfTextMoveOperation attempted to move the cursor of a user behind the end of the buffer. |
INF_TEXT_OPERATION_ERROR_FAILED | No further specified error code. |

### struct InfTextSession

    struct InfTextSession;

### struct InfTextSessionClass

    struct InfTextSessionClass {
      InfAdoptedSessionClass parent_class;
    };

## Property Details

### The `“caret-update-interval”` property

      “caret-update-interval”    guint

Minimum number of milliseconds between caret update broadcasts.

Owner: InfTextSession

Flags: Read / Write / Construct

Default value: 500