Infinityd.SessionProxy¶
- Subclasses:
None
Methods¶
- Inherited:
GObject.Object (37), Infinity.CommunicationObject (3), Infinity.SessionProxy (1)
- Structs:
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
The session is considered idle when are no subscriptions and no synchronizations |
||
r/w/co |
The |
||
r/w/co |
The communication manager group of subscribed connections |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted every time a connection is subscribed to the session. |
|
This signal is emitted before every remote user join. |
|
Emitted every time a connection is unsubscribed to the session, or a subscription is removed because the session is closed. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Infinityd.SessionProxy(**kwargs)¶
- Bases:
GObject.Object
,Infinity.CommunicationObject
,Infinity.SessionProxy
- Abstract:
No
- Structure:
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:
Returns whether there are subscribed connections to the session.
- is_idle()¶
- Returns:
Whether the session is idle.
- Return type:
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:
Returns
True
when connection is subscribed to the session andFalse
otherwise.
- subscribe_to(connection, seq_id, synchronize)¶
- Parameters:
connection (
Infinity.XmlConnection
) – AInfinity.XmlConnection
that is not yet subscribed.seq_id (
int
) – The sequence identifier for connection.synchronize (
bool
) – IfTrue
, then synchronize the session to connection first.
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 toFalse
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 inInfinity.SessionStatus.SYNCHRONIZING
, then connection must be the connection that synchronizes the session and synchronize needs to be set toFalse
. 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
) – TheInfinity.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:
connection (
Infinity.XmlConnection
) –seq_id (
int
) –
- 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:
- Parameters:
session_proxy (
Infinityd.SessionProxy
) – The object which received the signalconnection (
Infinity.XmlConnection
) – The subscribedInfinity.XmlConnection
.seq_id (
int
) – The sequence identifier for connection as passed toInfinityd.SessionProxy.subscribe_to
().
Emitted every time a connection is subscribed to the session.
- Infinityd.SessionProxy.signals.reject_user_join()¶
- Signal Name:
reject-user-join
- Flags:
This signal is emitted before every remote user join. The signal handler can return
True
in which case theInfinityd.SessionProxy
does not allow the user join withInfinity.RequestError.NOT_AUTHORIZED
error. If there is more than one signal handler, then if one of them returnsTrue
the user join is rejected.The user_properties parameter is a
GLib.Array
ofGObject.Parameter
values. It contains the construct properties for theInfinity.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 functionInfinity.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:
- Parameters:
session_proxy (
Infinityd.SessionProxy
) – The object which received the signalconnection (
Infinity.XmlConnection
) – The unsubscribedInfinity.XmlConnection
.
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¶
-
The session is considered idle when are no subscriptions and no synchronizations
- Infinityd.SessionProxy.props.io¶
- Name:
io
- Type:
- Default Value:
- Flags:
The
Infinity.Io
object for scheduling events
- Infinityd.SessionProxy.props.subscription_group¶
- Name:
subscription-group
- Type:
- Default Value:
- Flags:
The communication manager group of subscribed connections