Infinityd.SessionProxy

g GObject.GInterface GObject.GInterface Infinity.CommunicationObject Infinity.CommunicationObject GObject.GInterface->Infinity.CommunicationObject Infinity.SessionProxy Infinity.SessionProxy GObject.GInterface->Infinity.SessionProxy GObject.Object GObject.Object Infinityd.SessionProxy Infinityd.SessionProxy GObject.Object->Infinityd.SessionProxy Infinity.CommunicationObject->Infinityd.SessionProxy Infinity.SessionProxy->Infinityd.SessionProxy

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Infinity.CommunicationObject (3), Infinity.SessionProxy (1)

Structs:

GObject.ObjectClass (5)

has_subscriptions ()

is_idle ()

is_subscribed (connection)

subscribe_to (connection, seq_id, synchronize)

unsubscribe (connection)

Virtual Methods

Inherited:

GObject.Object (7), Infinity.CommunicationObject (3), Infinity.SessionProxy (1)

do_add_subscription (connection, seq_id)

do_remove_subscription (connection)

Properties

Inherited:

Infinity.SessionProxy (1)

Name

Type

Flags

Short Description

idle

bool

r

The session is considered idle when are no subscriptions and no synchronizations

io

Infinity.Io

r/w/co

The Infinity.Io object for scheduling events

subscription-group

Infinity.CommunicationHostedGroup

r/w/co

The communication manager group of subscribed connections

Signals

Inherited:

GObject.Object (1)

Name

Short Description

add-subscription

Emitted every time a connection is subscribed to the session.

reject-user-join

This signal is emitted before every remote user join.

remove-subscription

Emitted every time a connection is unsubscribed to the session, or a subscription is removed because the session is closed.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Infinityd.SessionProxy(**kwargs)
Bases:

GObject.Object, Infinity.CommunicationObject, Infinity.SessionProxy

Abstract:

No

Structure:

Infinityd.SessionProxyClass

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

has_subscriptions()
Returns:

Whether there are subscribed connections.

Return type:

bool

Returns whether there are subscribed connections to the session.

is_idle()
Returns:

Whether the session is idle.

Return type:

bool

Returns whether the session is idle. The session is considered idle when there are no subscriptions and no synchronizations (in either direction).

is_subscribed(connection)
Parameters:

connection (Infinity.XmlConnection) – The connection to check for being subscribed.

Returns:

Whether connection is subscribed.

Return type:

bool

Returns True when connection is subscribed to the session and False otherwise.

subscribe_to(connection, seq_id, synchronize)
Parameters:

Subscribes connection to self's session. The first thing that will be done is a synchronization (see Infinity.Session.synchronize_to()). Then, all changes to the session are propagated to connection.

seq_id should be a unique number for connection, and the same number must be passed on the client side to the #InfcSessionProxy object. Normally Infinityd.Directory and #InfcBrowser take care of choosing an appropriate sequence identifier.

Normally, you want to set synchronize to True in which case the whole session state will be synchronized to connection (within the subscription group). However, if for whatever reason the remote site already has a copy of the session, then you may set synchronize to False to skip synchronization. This happens for example for newly created documents, or when the remote site synchronized the local site and wants to be initially subscribed.

If self's session is not in Infinity.SessionStatus.RUNNING status, but in Infinity.SessionStatus.SYNCHRONIZING, then connection must be the connection that synchronizes the session and synchronize needs to be set to False. This causes the synchronizing connection to initially be subscribed. This needs to be called directly after having created the session proxy (i.e. without returning to the main loop before) so that the synchronization connection is added to the subscription group for synchronization.

Otherwise a subscription can only be initiated if self's session is in state Infinity.SessionStatus.RUNNING.

unsubscribe(connection)
Parameters:

connection (Infinity.XmlConnection) – The Infinity.XmlConnection to unsubscribe.

Unsubscribes a subscribed connection from self's session. This will prevent all users joined via connection to continue modifying the session’s buffer, and it will cancel ongoing synchronization to connection, if not yet finished.

do_add_subscription(connection, seq_id) virtual
Parameters:
do_remove_subscription(connection) virtual
Parameters:

connection (Infinity.XmlConnection) –

Signal Details

Infinityd.SessionProxy.signals.add_subscription(session_proxy, connection, seq_id)
Signal Name:

add-subscription

Flags:

RUN_LAST

Parameters:

Emitted every time a connection is subscribed to the session.

Infinityd.SessionProxy.signals.reject_user_join()
Signal Name:

reject-user-join

Flags:

RUN_LAST

This signal is emitted before every remote user join. The signal handler can return True in which case the Infinityd.SessionProxy does not allow the user join with Infinity.RequestError.NOT_AUTHORIZED error. If there is more than one signal handler, then if one of them returns True the user join is rejected.

The user_properties parameter is a GLib.Array of GObject.Parameter values. It contains the construct properties for the Infinity.User object that would be created if the user join is not rejected. It must not be modified, but it can be used to make the decision whether to reject the user join or not dependent on the parameters, such as allowing the user join only if the user has a predefined name. The function Infinity.Session.lookup_user_property() can be used to look up a named parameter in the array.

Infinityd.SessionProxy.signals.remove_subscription(session_proxy, connection)
Signal Name:

remove-subscription

Flags:

RUN_LAST

Parameters:

Emitted every time a connection is unsubscribed to the session, or a subscription is removed because the session is closed.

Property Details

Infinityd.SessionProxy.props.idle
Name:

idle

Type:

bool

Default Value:

True

Flags:

READABLE

The session is considered idle when are no subscriptions and no synchronizations

Infinityd.SessionProxy.props.io
Name:

io

Type:

Infinity.Io

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Infinity.Io object for scheduling events

Infinityd.SessionProxy.props.subscription_group
Name:

subscription-group

Type:

Infinity.CommunicationHostedGroup

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The communication manager group of subscribed connections