InfTextSession

InfTextSession

Synopsis

enum                InfTextSessionError;
                    InfTextSession;
InfTextSession *    inf_text_session_new                (InfCommunicationManager *manager,
                                                         InfTextBuffer *buffer,
                                                         InfIo *io,
                                                         InfSessionStatus status,
                                                         InfCommunicationGroup *sync_group,
                                                         InfXmlConnection *sync_connection);
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);
void                inf_text_session_set_user_color     (InfTextSession *session,
                                                         InfTextUser *user,
                                                         gdouble hue);
void                inf_text_session_flush_requests_for_user
                                                        (InfTextSession *session,
                                                         InfTextUser *user);

Object Hierarchy

  GObject
   +----InfSession
         +----InfAdoptedSession
               +----InfTextSession

Implemented Interfaces

InfTextSession implements InfCommunicationObject.

Properties

  "caret-update-interval"    guint                 : Read / Write / Construct

Description

Details

enum InfTextSessionError

typedef enum {
  INF_TEXT_SESSION_ERROR_INVALID_HUE,

  INF_TEXT_SESSION_ERROR_FAILED
} InfTextSessionError;


InfTextSession

typedef struct _InfTextSession InfTextSession;


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().

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.

sync_connection :

A connection to synchronize the session from. Ignored if status is INF_SESSION_RUNNING.

Returns :

A new InfTextSession.

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.

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.

sync_connection :

A connection to synchronize the session from. Ignored if status is INF_SESSION_RUNNING.

Returns :

A new InfTextSession.

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.

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.

session :

A InfTextSession.

user :

The InfTextUser for which to flush messages.

Property Details

The "caret-update-interval" property

  "caret-update-interval"    guint                 : Read / Write / Construct

Minimum number of milliseconds between caret update broadcasts.

Default value: 500