Infinityd.Directory

g GObject.GInterface GObject.GInterface Infinity.Browser Infinity.Browser GObject.GInterface->Infinity.Browser Infinity.CommunicationObject Infinity.CommunicationObject GObject.GInterface->Infinity.CommunicationObject GObject.Object GObject.Object Infinityd.Directory Infinityd.Directory GObject.Object->Infinityd.Directory Infinity.Browser->Infinityd.Directory Infinity.CommunicationObject->Infinityd.Directory

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Infinity.Browser (42), Infinity.CommunicationObject (3)

Structs:

GObject.ObjectClass (5)

class

new (io, storage, comm_manager)

add_connection (connection)

add_plugin (plugin)

enable_chat (enable)

foreach_connection (func, *user_data)

get_chat_session ()

get_communication_manager ()

get_io ()

get_storage ()

get_support_mask ()

iter_save_session (iter)

lookup_plugin (note_type)

remove_plugin (plugin)

set_acl_account_for_connection (connection, account_id)

set_certificate (key, cert)

Virtual Methods

Inherited:

GObject.Object (7), Infinity.Browser (38), Infinity.CommunicationObject (3)

do_connection_added (connection)

do_connection_removed (connection)

Properties

Inherited:

Infinity.Browser (1)

Name

Type

Flags

Short Description

account-storage

Infinityd.AccountStorage

r/w/c

The account storage backend, to read available user accounts from

certificate

Infinity.CertificateChain

r/w

The certificate chain of the server

chat-session

Infinityd.SessionProxy

r

The server’s chat session

communication-manager

Infinity.CommunicationManager

r/w/co

The communication manager for the directory

io

Infinity.Io

r/w/co

IO object to watch sockets and schedule timeouts

private-key

int

r/w

The private key of the server with which belongs to its certificate

storage

Infinityd.Storage

r/w/c

The storage backend to use

Signals

Inherited:

GObject.Object (1), Infinity.Browser (10)

Name

Short Description

connection-added

This signal is emitted when a connection that is served by the Infinityd.Directory was added.

connection-removed

This signal is emitted when a connection stopes being served by directory.

Fields

Inherited:

GObject.Object (1), Infinity.Browser (10)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Infinityd.Directory(**kwargs)
Bases:

GObject.Object, Infinity.Browser, Infinity.CommunicationObject

Abstract:

No

Structure:

Infinityd.DirectoryClass

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

classmethod new(io, storage, comm_manager)
Parameters:
Returns:

A new Infinityd.Directory.

Return type:

Infinityd.Directory

Creates a new Infinityd.Directory. If storage is None then the directory keeps all content in memory. This can make sense for ad-hoc sessions where no central document storage is required.

add_connection(connection)
Parameters:

connection (Infinity.XmlConnection) – A Infinity.XmlConnection.

Returns:

Whether the connection was added to the directory.

Return type:

bool

Adds connection to the connections of self. The directory will then receive requests from connection. If the directory’s method manager does not contain a “central” method for connection’s network, then the connection will not be added and the function returns False.

The connection is removed again automatically if it is closed.

add_plugin(plugin)
Parameters:

plugin (Infinityd.NotePlugin) – A Infinityd.NotePlugin.

Returns:

Whether the plugin was added successfully.

Return type:

bool

Adds plugin to self. This allows the directory to create sessions of the plugin’s type. Only one plugin of each type can be added to the directory. The plugin’s storage_type must match the storage of self. If the directory’s storage is None, then the plugin’s storage type does not matter, and the plugin’s session_read and session_write functions will not be used (and can therefore be None).

enable_chat(enable)
Parameters:

enable (bool) – Whether to enable or disable the chat.

If enable is True, this enables the chat on the server. This allows clients subscribing to the chat via infc_browser_subscribe_chat(). If enable is False the chat is disabled which means closing an existing chat session if any and no longer allowing subscription to the chat. The chat is initially disabled.

foreach_connection(func, *user_data)
Parameters:

Calls func for each connection in self that has previously been added to the directory. It is allowed to add and remove connections while this function is being called.

get_chat_session()
Returns:

A Infinityd.SessionProxy, or None if the chat is disabled.

Return type:

Infinityd.SessionProxy or None

Returns a Infinityd.SessionProxy for the chat session, if any. If the chat is enabled (see Infinityd.Directory.enable_chat()) this returns a Infinityd.SessionProxy that can be used to join local users to the chat, or to get chat contents (by getting the Infinity.ChatBuffer from the proxy’s Infinity.ChatSession). If the chat is disabled the function returns None.

get_communication_manager()
Returns:

An Infinity.CommunicationManager.

Return type:

Infinity.CommunicationManager

Returns the connection manager of the directory.

get_io()
Returns:

A Infinity.Io.

Return type:

Infinity.Io

Returns the IO object in use by the directory.

get_storage()
Returns:

An Infinityd.Storage.

Return type:

Infinityd.Storage or None

Returns the storage backend in use by the directory.

get_support_mask()
Returns:

A pointer to a Infinity.AclMask that will be filled.

Return type:

mask: Infinity.AclMask

This function writes all operations supported by self to mask. If an operation is unsupported by the server, the corresponding field in the mask will not be set.

iter_save_session(iter)
Parameters:

iter (Infinity.BrowserIter) – A Infinity.BrowserIter pointing to a note in self.

Raises:

GLib.Error

Returns:

True if the operation succeeded, False otherwise.

Return type:

bool

Attempts to store the session the node iter points to represents into the background storage.

lookup_plugin(note_type)
Parameters:

note_type (str) – A note type for which to lookup the plugin.

Returns:

A Infinityd.NotePlugin, or None.

Return type:

Infinityd.NotePlugin or None

Returns the Infinityd.NotePlugin that handles the given note type, or None in case no corresponding plugin was added.

remove_plugin(plugin)
Parameters:

plugin (Infinityd.NotePlugin) – The plugin to remove.

Removes a note plugin from the directory. If there are any sessions running using this plugin, they are unsubscribed from the directory.

set_acl_account_for_connection(connection, account_id)
Parameters:
  • connection (Infinity.XmlConnection) – A connection added to self.

  • account_id (int) – A #InfAclAccountId representing a valid account in self.

Raises:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

This function changes the account that the given connection is logged into. The connection must have been added to the directory before with Infinityd.Directory.add_connection(). In order to remove a login, account_id should be set to the default account.

The function might fail if there is no account that corresponds to account, or if the account storage reports an error when looking up the account.

set_certificate(key, cert)
Parameters:

Sets the private key and certificate chain of the directory. The directory does not use these for certificate authentication with added connections. Connections should already be authenticated, for example with the means of Infinity.XmppConnection.

At the moment, the directory certificate is used to sign incoming certificate requests. Selected clients can request a certificate signed with the server’s certificates, see Infinity.Browser.create_acl_account(). If the server certificate is set with this function, the request is handled properly. If no certificate is set with this function, such a request is rejected.

do_connection_added(connection) virtual
Parameters:

connection (Infinity.XmlConnection) –

do_connection_removed(connection) virtual
Parameters:

connection (Infinity.XmlConnection) –

Signal Details

Infinityd.Directory.signals.connection_added(directory, connection)
Signal Name:

connection-added

Flags:

RUN_LAST

Parameters:

This signal is emitted when a connection that is served by the Infinityd.Directory was added. The only way this can happen is by a call to Infinityd.Directory.add_connection(). This can be done automatically by an Infinityd.ServerPool instance, however.

Infinityd.Directory.signals.connection_removed(directory, connection)
Signal Name:

connection-removed

Flags:

RUN_LAST

Parameters:

This signal is emitted when a connection stopes being served by directory. Usually this happens only when the connection is closed.

Property Details

Infinityd.Directory.props.account_storage
Name:

account-storage

Type:

Infinityd.AccountStorage

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

The account storage backend, to read available user accounts from

Infinityd.Directory.props.certificate
Name:

certificate

Type:

Infinity.CertificateChain

Default Value:

None

Flags:

READABLE, WRITABLE

The certificate chain of the server

Infinityd.Directory.props.chat_session
Name:

chat-session

Type:

Infinityd.SessionProxy

Default Value:

None

Flags:

READABLE

The server’s chat session

Infinityd.Directory.props.communication_manager
Name:

communication-manager

Type:

Infinity.CommunicationManager

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The communication manager for the directory

Infinityd.Directory.props.io
Name:

io

Type:

Infinity.Io

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

IO object to watch sockets and schedule timeouts

Infinityd.Directory.props.private_key
Name:

private-key

Type:

int

Default Value:

None

Flags:

READABLE, WRITABLE

The private key of the server with which belongs to its certificate

Infinityd.Directory.props.storage
Name:

storage

Type:

Infinityd.Storage

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

The storage backend to use