Infinityd.Directory¶
- Subclasses:
None
Methods¶
- Inherited:
GObject.Object (37), Infinity.Browser (42), Infinity.CommunicationObject (3)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c |
The account storage backend, to read available user accounts from |
||
r/w |
The certificate chain of the server |
||
r |
The server’s chat session |
||
r/w/co |
The communication manager for the directory |
||
r/w/co |
IO object to watch sockets and schedule timeouts |
||
r/w |
The private key of the server with which belongs to its certificate |
||
r/w/c |
The storage backend to use |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
This signal is emitted when a connection that is served by the |
|
This signal is emitted when a connection stopes being served by directory. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Infinityd.Directory(**kwargs)¶
- Bases:
GObject.Object
,Infinity.Browser
,Infinity.CommunicationObject
- Abstract:
No
- Structure:
Infinityd.Directory
is an opaque data type. You should only access it via the public API functions.- classmethod new(io, storage, comm_manager)¶
- Parameters:
io (
Infinity.Io
) – IO object to watch connections and schedule timeouts.storage (
Infinityd.Storage
) – Storage backend that is used to read/write notes from permanent memory intoInfinity.Buffer
objects, orNone
.comm_manager (
Infinity.CommunicationManager
) – AInfinity.CommunicationManager
to register added connections to and which forwards incoming data to the directory or running sessions.
- Returns:
A new
Infinityd.Directory
.- Return type:
Creates a new
Infinityd.Directory
. If storage isNone
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
) – AInfinity.XmlConnection
.- Returns:
Whether the connection was added to the directory.
- Return type:
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
) – AInfinityd.NotePlugin
.- Returns:
Whether the plugin was added successfully.
- Return type:
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 beNone
).
- 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 isFalse
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:
func (
Infinityd.DirectoryForeachConnectionFunc
) – The function to call for each connection in self.user_data (
object
orNone
) – Additional data to pass to the callback function.
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
, orNone
if the chat is disabled.- Return type:
Returns a
Infinityd.SessionProxy
for the chat session, if any. If the chat is enabled (seeInfinityd.Directory.enable_chat
()) this returns aInfinityd.SessionProxy
that can be used to join local users to the chat, or to get chat contents (by getting theInfinity.ChatBuffer
from the proxy’sInfinity.ChatSession
). If the chat is disabled the function returnsNone
.
- get_communication_manager()¶
- Returns:
- Return type:
Returns the connection manager of the directory.
- get_io()¶
- Returns:
A
Infinity.Io
.- Return type:
Returns the IO object in use by the directory.
- get_storage()¶
- Returns:
- Return type:
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
) – AInfinity.BrowserIter
pointing to a note in self.- Raises:
- Returns:
- Return type:
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
, orNone
.- Return type:
Returns the
Infinityd.NotePlugin
that handles the given note type, orNone
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:
- Returns:
- Return type:
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:
key (
InfGnutls.X509PrivKey
) – The private key of the directory.cert (
Infinity.CertificateChain
) – The certificate chain of the directory.
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:
- Parameters:
directory (
Infinityd.Directory
) – The object which received the signalconnection (
Infinity.XmlConnection
) – TheInfinity.XmlConnection
that was added.
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 toInfinityd.Directory.add_connection
(). This can be done automatically by anInfinityd.ServerPool
instance, however.
- Infinityd.Directory.signals.connection_removed(directory, connection)¶
- Signal Name:
connection-removed
- Flags:
- Parameters:
directory (
Infinityd.Directory
) – The object which received the signalconnection (
Infinity.XmlConnection
) – TheInfinity.XmlConnection
that was removed.
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:
- Default Value:
- Flags:
The account storage backend, to read available user accounts from
- Infinityd.Directory.props.certificate¶
- Name:
certificate
- Type:
- Default Value:
- Flags:
The certificate chain of the server
- Infinityd.Directory.props.chat_session¶
- Name:
chat-session
- Type:
- Default Value:
- Flags:
The server’s chat session
- Infinityd.Directory.props.communication_manager¶
- Name:
communication-manager
- Type:
- Default Value:
- Flags:
The communication manager for the directory
- Infinityd.Directory.props.io¶
- Name:
io
- Type:
- Default Value:
- Flags:
IO object to watch sockets and schedule timeouts
- Infinityd.Directory.props.private_key¶
-
The private key of the server with which belongs to its certificate