Functions¶
Details¶
- Infinity.acl_account_array_free(accounts)¶
- Parameters:
accounts ([
Infinity.AclAccount
]) – An array ofInfinity.AclAccount
objects.
Releases all resources allocated by an array of
Infinity.AclAccount
s.
- Infinity.acl_account_from_xml(xml)¶
- Parameters:
xml (
libxml2.NodePtr
) – An XML node.- Raises:
- Returns:
A new
Infinity.AclAccount
on success, orNone
on failure. Free withInfinity.AclAccount.free
() when no longer needed.- Return type:
Attempts to deserialize an
Infinity.AclAccount
that was written to an XML node by the functionInfinity.AclAccount.to_xml
(). If an error occurs, such as mandatory fields being missing, the function returnsNone
and error is set.
- Infinity.acl_account_id_to_string(account)¶
- Parameters:
account (
int
) – A #InfAclAccountId.- Returns:
A string representation of the given account ID, or
None
if the account does not exist. The return value must not be freed.- Return type:
Translates the given account ID to a unique string identifier.
- Infinity.acl_sheet_perms_from_xml(xml)¶
- Parameters:
xml (
libxml2.NodePtr
) – The XML node to read from.- Raises:
- Returns:
True
if the operation was successful, orFalse
on error.- mask:
Output parameter to write the permission mask to.
- perms:
Output parameter to write the permissions to.
- Return type:
(
bool
, mask:Infinity.AclMask
, perms:Infinity.AclMask
)
This function extracts the permission mask and the permission flags from the XML node xml. The counterpart to this function is
Infinity.AclSheet.perms_to_xml
(). If an error occurs the function returnsFalse
and error is set.
- Infinity.acl_sheet_perms_to_xml(mask, perms, xml)¶
- Parameters:
mask (
Infinity.AclMask
) – Permission mask to write.perms (
Infinity.AclMask
) – Individiual permissions to write.xml (
libxml2.NodePtr
) – error: Location to store error information, if any.
This function writes the given permission mask and permission flags to the XML node xml. They can be converted back using the
Infinity.AclSheet.perms_from_xml
() function.
- Infinity.acl_sheet_set_from_xml(xml)¶
- Parameters:
xml (
libxml2.NodePtr
) – The XML node from which to read the sheet set.- Raises:
- Returns:
A
Infinity.AclSheetSet
, orNone
. Free withInfinity.AclSheetSet.free
() when no longer needed.- Return type:
Reads a sheet set from xml that has been written with
Infinity.AclSheetSet.to_xml
(). If an error occurs the function returnsNone
and error is set. If there is no ACL stored in xml, the function returnsNone
without setting error.
- Infinity.adopted_state_vector_error_quark()¶
- Returns:
A #GQuark for that domain.
- Return type:
The domain for
Infinity.AdoptedStateVectorError
errors.
- Infinity.adopted_state_vector_from_string(str)¶
- Parameters:
str (
str
) – A string representation of aInfinity.AdoptedStateVector
.- Raises:
- Returns:
A new
Infinity.AdoptedStateVector
, orNone
.- Return type:
Recreates the
Infinity.AdoptedStateVector
from its string representation. If an error occurs, the function returnsNone
and error is set.
- Infinity.adopted_state_vector_from_string_diff(str, orig)¶
- Parameters:
str (
str
) – A string representation of a diff between state vectors.orig (
Infinity.AdoptedStateVector
) – The state vector used to create str inInfinity.AdoptedStateVector.to_string_diff
().
- Raises:
- Returns:
The created state vector, or
None
on error. Free withInfinity.AdoptedStateVector.free
() when no longer needed.- Return type:
Recreates a vector from its string representation diff and the original vector. If an error returns, the function returns
None
and error is set.
- Infinity.authentication_detail_error_quark()¶
- Returns:
A GQuark.
- Return type:
Error domain for further information on authentication errors. Errors in this domain will be from the
Infinity.AuthenticationDetailError
enumeration. SeeGLib.Error
for information on error domains.
- Infinity.authentication_detail_strerror(code)¶
- Parameters:
code (
Infinity.AuthenticationDetailError
) – An error code from theInfinity.AuthenticationDetailError
enumeration.- Returns:
A static string that must not be freed.
- Return type:
Returns a human-readable string for the given error code.
- Infinity.cert_util_check_certificate_key(cert, key)¶
- Parameters:
cert (
InfGnutls.X509Crt
) – The certificate to be checked.key (
InfGnutls.X509PrivKey
) – The private key to be checked.
- Returns:
- Return type:
This function returns
True
if key is the private key belonging to cert, orFalse
otherwise.
- Infinity.cert_util_compare_fingerprint(cert1, cert2)¶
- Parameters:
cert1 (
InfGnutls.X509Crt
) – The first certificate to compare.cert2 (
InfGnutls.X509Crt
) – The second certificate to compare.
- Raises:
- Returns:
Whether the two certificates have identical fingerprints. Returns
False
on error.- Return type:
Checks whether the SHA-256 fingerprints of the two given certificates are identical or not. If a fingerprint cannot be obtained, the function returns
False
and error is set.
- Infinity.cert_util_get_activation_time(cert)¶
- Parameters:
cert (
InfGnutls.X509Crt
) – An initializedInfGnutls.X509Crt
.- Returns:
The activation time of the certificate, or
None
. Free withGLib.free
() after use.- Return type:
Returns the activation time of the certificate as a string in human-readable format. If the activation time cannot be read
None
is returned.
- Infinity.cert_util_get_dn(cert)¶
- Parameters:
cert (
InfGnutls.X509Crt
) – An initializedInfGnutls.X509Crt
.- Returns:
The DN of the certificate. Free with
GLib.free
() after use.- Return type:
Retrieves the full distinguished name (DN) from the certificate, allocating memory for the return value.
- Infinity.cert_util_get_dn_by_oid(cert, oid, index)¶
- Parameters:
cert (
InfGnutls.X509Crt
) – An initializedInfGnutls.X509Crt
.oid (
str
) – The name of the requested entry.index (
int
) – Index of the entry to retrieve.
- Returns:
The certificate entry, or
None
if it is not present. Free withGLib.free
() after use.- Return type:
Retrieves the given item from the certificate. This function is a thin wrapper around gnutls_x509_crt_get_dn_by_oid(), allocating memory for the return value. The function returns
None
if there is no such entry in the certificate.
- Infinity.cert_util_get_expiration_time(cert)¶
- Parameters:
cert (
InfGnutls.X509Crt
) – An initializedInfGnutls.X509Crt
.- Returns:
The expiration time of the certificate, or
None
. Free withGLib.free
() after use.- Return type:
Returns the expiration time of the certificate as a string in human-readable format. If the expiration time cannot be read
None
is returned.
- Infinity.cert_util_get_fingerprint(cert, algo)¶
- Parameters:
cert (
InfGnutls.X509Crt
) – An initializedInfGnutls.X509Crt
.algo (
int
) – The hashing algorithm to use.
- Returns:
The fingerprint of the certificate, or
None
. Free withGLib.free
() after use.- Return type:
Returns the fingerprint of the certificate hashed with the specified algorithm, in hexadecimal format. If the fingerprint cannot be read
None
is returned.
- Infinity.cert_util_get_hostname(cert)¶
- Parameters:
cert (
InfGnutls.X509Crt
) – An initializedInfGnutls.X509Crt
.- Returns:
The best guess for the certificate’s hostname, or
None
when it cannot be retrieved. Free withGLib.free
() after use.- Return type:
Attempts to read the hostname of a certificate. This is done by looking at the DNS name and IP address SANs. If both are not available, the common name of the certificate is returned.
- Infinity.cert_util_get_issuer_dn_by_oid(cert, oid, index)¶
- Parameters:
cert (
InfGnutls.X509Crt
) – An initializedInfGnutls.X509Crt
.oid (
str
) – The name of the requested entry.index (
int
) – Index of the entry to retrieve.
- Returns:
The certificate entry, or
None
if it is not present. Free withGLib.free
() after use.- Return type:
Retrieves the given item from the issuer of the certificate. This function is a thin wrapper around gnutls_x509_crt_get_issuer_dn_by_oid(), allocating memory for the return value. The functions returns
None
if there is no such entry in the certificate.
- Infinity.cert_util_get_serial_number(cert)¶
- Parameters:
cert (
InfGnutls.X509Crt
) – An initializedInfGnutls.X509Crt
.- Returns:
The serial number of the certificate, or
None
. Free withGLib.free
() after use.- Return type:
Read the serial number of a certificate and return it in hexadecimal format. If the serial number cannot be read
None
is returned.
- Infinity.cert_util_read_certificate(filename, current)¶
- Parameters:
filename (
str
) – A path to a X.509 certificate file.current ([
InfGnutls.X509Crt
] orNone
) – An array ofInfGnutls.X509Crt
objects, orNone
.
- Raises:
- Returns:
An array of the read certificates, or
None
on error.- Return type:
Loads X.509 certificates in PEM format from the file at filename. There can be any number of certificates in the file. If current is not
None
, the new certificates are appended to the array. Otherwise, a new array with the read certificates is returned.If an error occurs, the function returns
None
and error is set. If current is non-None
and the function succeeds, the return value is the same as current.
- Infinity.cert_util_write_certificate(certs, filename)¶
- Parameters:
certs ([
InfGnutls.X509Crt
]) – An array ofInfGnutls.X509Crt
objects.filename (
str
) – The path at which to store the certificates.
- Raises:
- Returns:
- Return type:
This function writes the certificates in the array certs to disk, in PEM format. If an error occurs the function returns
False
and error is set.
- Infinity.cert_util_write_certificate_mem(certs, n_certs)¶
- Parameters:
certs (
InfGnutls.X509Crt
) – An array ofInfGnutls.X509Crt
objects.n_certs (
int
) – Number of certificates in the error.
- Raises:
- Returns:
A string with PEM-encoded certificate data, or
None
on error. Free withGLib.free
().- Return type:
This function writes the certificates in the array certs into memory, in PEM format. If an error occurs the function returns
None
and error is set.
- Infinity.cert_util_write_certificate_with_key(key, certs, filename)¶
- Parameters:
key (
InfGnutls.X509PrivKey
) – An initializedInfGnutls.X509PrivKey
structure.certs ([
InfGnutls.X509Crt
]) – An array ofInfGnutls.X509Crt
objects.filename (
str
) – The path at which to store the certificates.
- Raises:
- Returns:
- Return type:
This function writes both the private key key as well as the certificates in the array certs to disk, in PEM format. If an error occurs the function returns
False
and error is set.
- Infinity.cert_util_write_dh_params(params, filename)¶
- Parameters:
params (
InfGnutls.DHParams
) – An initializedInfGnutls.DHParams
structure.filename (
str
) – The path at which so store params.
- Raises:
- Returns:
- Return type:
Writes the given Diffie-Hellman parameters to the given path on the filesystem. If an error occurs, error is set and
False
is returned.
- Infinity.cert_util_write_private_key(key, filename)¶
- Parameters:
key (
InfGnutls.X509PrivKey
) – An initializedInfGnutls.X509PrivKey
structure.filename (
str
) – The path at which so store the key.
- Raises:
- Returns:
- Return type:
Writes key to the location specified by filename on the filesystem. If an error occurs, the function returns
False
and error is set.
- Infinity.deinit()¶
This functions deinitializes the libinfinity library. Make sure that all objects the library provides have been freed before calling this function. If
Infinity.init
() has been called multiple times, thenInfinity.deinit
() needs to be called the same number of times to actually deinitialize the library.
- Infinity.directory_error_quark()¶
- Returns:
A GQuark.
- Return type:
Error domain for directory errors. Errors in this domain will be from the
Infinity.DirectoryError
enumeration. SeeGLib.Error
for information on error domains.
- Infinity.directory_strerror(code)¶
- Parameters:
code (
Infinity.DirectoryError
) – An error code from theInfinity.DirectoryError
enumeration.- Returns:
A static string that must not be freed.
- Return type:
Returns a human-readable string for the given error code.
- Infinity.file_util_create_directory(path, mode)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Attempts to create a directory at path, creating intermediate directories as necessary. The mode parameter is only used on Unix in which case it specifies the permissions to use for all newly created directories in the same way as
GLib.mkdir
() would.
- Infinity.file_util_create_single_directory(path, mode)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Attempts to create a directory at path. The mode parameter is only used on Unix in which case it specifies the permissions to use for all newly created directories in the same way as
GLib.mkdir
() would.
- Infinity.file_util_delete(path)¶
- Parameters:
path (
str
) – Path to the object to delete.- Raises:
- Returns:
- Return type:
Removes the file or directory at path. If it is a directory the directory is deleted recursively. If the function fails
False
is returned and error is set.
- Infinity.file_util_delete_directory(path)¶
- Parameters:
path (
str
) – Path to the directory to delete.- Raises:
- Returns:
- Return type:
Removes the directory at path recursively. Fails if path points to a regular file and not a directory. If the function fails
False
is returned and error is set.
- Infinity.file_util_delete_file(path)¶
- Parameters:
path (
str
) – Path to the file to delete.- Raises:
- Returns:
- Return type:
Removes the file at path if it is empty. Fails if path points to a directory and not a regular file. If the function fails
False
is returned and error is set.
- Infinity.file_util_delete_single_directory(path)¶
- Parameters:
path (
str
) – Path to the directory to delete.- Raises:
- Returns:
- Return type:
Removes the directory at path if it is empty, or fails otherwise. Fails if path points to a regular file and not a directory. If the function fails
False
is returned and error is set.
- Infinity.file_util_list_directory(path, func, *user_data)¶
- Parameters:
path (
str
) – The directory to explore.func (
Infinity.FileListFunc
) – Callback function to be called for each child of the directory at path.user_data (
object
orNone
) – Additional data to pass to func.
- Raises:
- Returns:
- Return type:
Calls func for each file within the given directory. It also passes the type of the found file to the callback function. The callback function can return
False
to stop the iteration. If it does this, then this function still returnsTrue
. This can for example be used to find a file in a directory. If, in addition, the callback function sets error, then this function returnsFalse
and propagates the error.
- Infinity.file_util_write_private_data(filename, data, length)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Writes data to the file pointed to by filename. On Unix-like systems, filename is created with 0600 permission. If the function fails,
False
is returned and error is set.
- Infinity.gnutls_certificate_verification_error_quark()¶
- Returns:
A GQuark.
- Return type:
Error domain for GnuTLS certificate verification errors. Errors in this domain will be GnuTLS certificate verification results as returned by gnutls_certificate_verify_peers2(). See
GLib.Error
for information on error domains.
- Infinity.gnutls_certificate_verification_set_error(error, verify)¶
- Parameters:
error (
GLib.Error
) – Location to store the error, orNone
.verify (
int
) – A GnuTLS certificate verification code.
Sets a
GLib.Error
from a certificate verification result. If error isNone
, does nothing.
- Infinity.gnutls_error_quark()¶
- Returns:
A GQuark.
- Return type:
Error domain for GnuTLS errors. Errors in this domain will be GnuTLS error codes. See
GLib.Error
for information on error domains.
- Infinity.gnutls_set_error(error, error_code)¶
- Parameters:
error (
GLib.Error
) – Location to store the error, orNone
.error_code (
int
) – A GnuTLS error code.
Sets a
GLib.Error
from a GnuTLS error code. If error isNone
, does nothing.
- Infinity.gsasl_error_quark()¶
- Returns:
A GQuark.
- Return type:
Error domain for GNU SASL errors. Errors in this domain will be GNU SASL error codes. See
GLib.Error
for information on error domains.
- Infinity.gsasl_set_error(error, error_code)¶
- Parameters:
error (
GLib.Error
) – Location to store the error, orNone
.error_code (
int
) – A GNU SASL error code.
Sets a
GLib.Error
from a GNU SASL error code. If error isNone
, does nothing.
- Infinity.init()¶
- Raises:
- Returns:
Whether the initialization was successful or not.
- Return type:
This function initializes the libinfinity library and should be called before any other functions of the library. The function does nothing if it has already been called before.
- Infinity.native_socket_error_quark()¶
- Returns:
A #GQuark representing the INF_NATIVE_SOCKET_ERROR domain.
- Return type:
Returns a #GQuark representing the INF_NATIVE_SOCKET_ERROR domain.
- Infinity.native_socket_make_error(code)¶
- Parameters:
code (
int
) – An error code obtained with #INF_NATIVE_SOCKET_LAST_ERROR- Raises:
Converts the platform-dependent error code code into a
GLib.Error
. TheGLib.Error
will contain the same numerical value and a platform-dependent human-readable error message.
- Infinity.protocol_get_default_port()¶
- Returns:
The default port.
- Return type:
Returns the default port on which the infinote daemon listens for new connections.
- Infinity.protocol_get_version()¶
- Returns:
The supported infinote version.
- Return type:
Returns the version of the Infinote protocol implemented by this version of libinfinity.
- Infinity.protocol_parse_version(version, major, minor)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Splits the given version string into it’s major and minor version number. If the string is badly formatted then the function returns
False
, error is set and major and minor are left untouched.It is guaranteed that, if version is
Infinity.protocol_get_version
(), the function does not fail.
- Infinity.request_error_quark()¶
- Returns:
A GQuark.
- Return type:
Error domain for request errors. Errors in this domain will be from the
Infinity.RequestError
enumeration. SeeGLib.Error
for information on error domains.
- Infinity.request_result_make_add_node(browser, iter, new_node)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.iter (
Infinity.BrowserIter
) – An iterator pointing to the node to which a node has been added.new_node (
Infinity.BrowserIter
) – An iterator pointing to the new node.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for an “add-node” request, seeInfinity.Browser.add_note
() orInfinity.Browser.add_subdirectory
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser.
- Infinity.request_result_make_create_acl_account(browser, account, certificate)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.account (
Infinity.AclAccount
) – The createdInfinity.AclAccount
.certificate (
Infinity.CertificateChain
) – The certificate which can be used to log into account.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for a “create-acl-account” request, seeInfinity.Browser.create_acl_account
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser.
- Infinity.request_result_make_explore_node(browser, iter)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.iter (
Infinity.BrowserIter
) – An iterator pointing to the node to which was explored.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for an “explore-node” request, seeInfinity.Browser.explore
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser.
- Infinity.request_result_make_join_user(proxy, user)¶
- Parameters:
proxy (
Infinity.SessionProxy
) – AInfinity.SessionProxy
.user (
Infinity.User
) – The joined user.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for a “join-user” request, seeInfinity.SessionProxy.join_user
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to proxy.
- Infinity.request_result_make_lookup_acl_accounts(browser, accounts)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.accounts ([
Infinity.AclAccount
]) – The list of accounts.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for a “lookup-acl-accounts” request, seeInfinity.Browser.lookup_acl_accounts
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser.
- Infinity.request_result_make_query_acl(browser, iter, sheet_set)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.iter (
Infinity.BrowserIter
) – An iterator pointing to the node whose ACL was queried.sheet_set (
Infinity.AclSheetSet
) – The sheet set for the queried node.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for a “query-acl” request, seeInfinity.Browser.query_acl
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser and proxy.
- Infinity.request_result_make_query_acl_account_list(browser, accounts, does_notifications)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.accounts ([
Infinity.AclAccount
]) – The list of accounts.does_notifications (
bool
) – Whether the server notifies the clients about added or removed accounts.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for a “query-acl-account-list” request, seeInfinity.Browser.query_acl_account_list
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser.
- Infinity.request_result_make_remove_acl_account(browser, account)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.account (
Infinity.AclAccount
) – The removedInfinity.AclAccount
.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for a “remove-acl-account” request, seeInfinity.Browser.remove_acl_account
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser.
- Infinity.request_result_make_remove_node(browser, iter)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.iter (
Infinity.BrowserIter
) – An iterator pointing to the node to which was removed.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for an “remove-node” request, seeInfinity.Browser.remove_node
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser.
- Infinity.request_result_make_save_session(browser, iter)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.iter (
Infinity.BrowserIter
) – An iterator pointing to the node to which was saved.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for a “save-session” request, see infc_browser_iter_save_session(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser.
- Infinity.request_result_make_set_acl(browser, iter)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.iter (
Infinity.BrowserIter
) – An iterator pointing to the node whose ACL was set.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for a “set-acl” request, seeInfinity.Browser.set_acl
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser and proxy.
- Infinity.request_result_make_subscribe_chat(browser, proxy)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.proxy (
Infinity.SessionProxy
) – TheInfinity.SessionProxy
for the subscribed session.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for a “subscribe-chat” request, see infc_browser_subscribe_chat(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser and proxy.
- Infinity.request_result_make_subscribe_session(browser, iter, proxy)¶
- Parameters:
browser (
Infinity.Browser
) – AInfinity.Browser
.iter (
Infinity.BrowserIter
) – An iterator pointing to the node to which a subscription was made.proxy (
Infinity.SessionProxy
) – TheInfinity.SessionProxy
for the subscription.
- Returns:
A new
Infinity.RequestResult
. Free withInfinity.RequestResult.free
().- Return type:
Creates a new
Infinity.RequestResult
for a “subscribe-session” request, seeInfinity.Browser.subscribe
(). TheInfinity.RequestResult
object is only valid as long as the caller maintains a reference to browser and proxy.
- Infinity.request_strerror(code)¶
- Parameters:
code (
Infinity.RequestError
) – An error code from theInfinity.RequestError
enumeration.- Returns:
A static string that must not be freed.
- Return type:
Returns a human-readable string for the given error code.
- Infinity.user_status_from_string(string)¶
- Parameters:
string (
str
) – A string representation of aInfinity.UserStatus
.- Raises:
- Returns:
When an error occurred during the conversion,
False
is returned, andTrue
otherwise.- status:
A pointer to a
Infinity.UserStatus
value, orNone
.
- Return type:
(
bool
, status:Infinity.UserStatus
)
This function does the opposite of
Infinity.UserStatus.to_string
(). It turns the given string back to aInfinity.UserStatus
, storing the result in status if status is non-None
. If string is invalid, then status is left untouched, error is set andFalse
is returned. Otherwise, the function returnsTrue
.
- Infinity.user_status_to_string(status)¶
- Parameters:
status (
Infinity.UserStatus
) – A value from theInfinity.UserStatus
enumeration.- Returns:
A static string representation of status.
- Return type:
Returns a non-localized string identifying the given status. This is not meant to be shown to a user, but rather to serialize a user status, for example to store it in XML.
- Infinity.xml_util_add_child_text(xml, text)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.text ([
str
]) – The child text to add.
Adds the given text as child text to xml in the same way xmlNodeAddContentLen() would do. The difference is that text is allowed to contain characters that are not valid in
XML text, such as formfeed characters \f. In case one occurs in text, the function adds an <uchar /> element node instead to xml as specified in the infinote protocol.
- Infinity.xml_util_get_attribute_double(xml, attribute)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to query.
- Raises:
- Returns:
Whether result was set.
- result:
Location to store the read value.
- Return type:
Behaves exactly like
Infinity.xml_util_get_attribute_int
(). The only difference is that the function reads a double-precision floating point number.
- Infinity.xml_util_get_attribute_double_required(xml, attribute)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to query.
- Raises:
- Returns:
Whether result was set.
- result:
Location to store the read value.
- Return type:
Behaves exactly like
Infinity.xml_util_get_attribute_int_required
(). The only difference is that the function reads a double-precision floating point number.
- Infinity.xml_util_get_attribute_int(xml, attribute)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to query.
- Raises:
- Returns:
Whether result was set.
- result:
Location to store the read value.
- Return type:
Reads the attribute named attribute from the XML element xml. The attribute value is expected to be a signed integral number. If it is the function converts the text to an integer and stores the result into result. In this case,
True
is returned and error is left untouched.If the value is not a signed integral number, then the function returns
False
, error is set and result is left untouched.If the attribute does not exist the function returns
False
but error is not set.
- Infinity.xml_util_get_attribute_int_required(xml, attribute)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to query.
- Raises:
- Returns:
Whether result was set.
- result:
Location to store the read value.
- Return type:
Reads the attribute named attribute from the XML element xml. The attribute value is expected to be a signed integral number. If it is the function converts the text to an integere and stores the result into result. In this case,
True
is returned and error is left untouched.If the value is not a signed integral number or the attribute does not exist, then the function returns
False
, error is set and result is left untouched.
- Infinity.xml_util_get_attribute_long(xml, attribute)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to query.
- Raises:
- Returns:
Whether result was set.
- result:
Location to store the read value.
- Return type:
Behaves exactly like
Infinity.xml_util_get_attribute_int
(). The only difference is that the function reads a signed long integral number.
- Infinity.xml_util_get_attribute_long_required(xml, attribute)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to query.
- Raises:
- Returns:
Whether result was set.
- result:
Location to store the read value.
- Return type:
Behaves exactly like
Infinity.xml_util_get_attribute_int_required
(). The only difference is that the function reads a signed long integral number.
- Infinity.xml_util_get_attribute_uint(xml, attribute)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to query.
- Raises:
- Returns:
Whether result was set.
- result:
Location to store the read value.
- Return type:
Behaves exactly like
Infinity.xml_util_get_attribute_int
(). The only difference is that the function reads an unsigned integral number.
- Infinity.xml_util_get_attribute_uint_required(xml, attribute)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to query.
- Raises:
- Returns:
Whether result was set.
- result:
Location to store the read value.
- Return type:
Behaves exactly like
Infinity.xml_util_get_attribute_int_required
(). The only difference is that the function reads an unsigned integral number.
- Infinity.xml_util_get_attribute_ulong(xml, attribute)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to query.
- Raises:
- Returns:
Whether result was set.
- result:
Location to store the read value.
- Return type:
Behaves exactly like
Infinity.xml_util_get_attribute_int
(). The only difference is that the function reads an unsigned long integral number.
- Infinity.xml_util_get_attribute_ulong_required(xml, attribute)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to query.
- Raises:
- Returns:
Whether result was set.
- result:
Location to store the read value.
- Return type:
Behaves exactly like
Infinity.xml_util_get_attribute_int_required
(). The only difference is that the function reads an unsigned long integral number.
- Infinity.xml_util_get_child_text(xml)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
- Raises:
- Returns:
The node’s child text, or
None
on error. Free withGLib.free
() when no longer needed.- chars:
Location to store number of characters of child text, or
None
.
- Return type:
Reads a node’s child text. If there are <uchar /> child elements, as added by
Infinity.xml_util_add_child_text
() this function will convert them back to character codes. There should not be any other child elements in xml.
- Infinity.xml_util_new_error_from_node(xml)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
as returned by inf_xml_util_new_node_from_error().- Returns:
A pointer to a new
GLib.Error
, orNone
on failure. It is the caller’s responsibility to dispose theGLib.Error
object usingGLib.Error.free
().- Return type:
Creates a new
GLib.Error
with the domain and erro code given in xml's attributes. The message is parsed from the child text as withInfinity.xml_util_get_child_text
(). The element name and namespace are ignored. If xml does not have the attributes as expected,None
is returned.
- Infinity.xml_util_set_attribute(xml, attribute, value)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to set.value (
str
) – The value to set.
Sets the attribute named attribute to the given value of the XML element xml. This is a thin wrapper around xmlSetProp(), mainly provided for consistency and for not having to cast the arguments to
libxml2.Char
.
- Infinity.xml_util_set_attribute_double(xml, attribute, value)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to set.value (
float
) – The value to set.
Sets the attribute named attribute to the given double-precision floating point number converted to text.
- Infinity.xml_util_set_attribute_int(xml, attribute, value)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to set.value (
int
) – The value to set.
Sets the attribute named attribute to the given signed integral value converted to text.
- Infinity.xml_util_set_attribute_long(xml, attribute, value)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to set.value (
int
) – The value to set.
Sets the attribute named attribute to the given signed long integral value converted to text.
- Infinity.xml_util_set_attribute_uint(xml, attribute, value)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to set.value (
int
) – The value to set.
Sets the attribute named attribute to the given unsigned integral value converted to text.
- Infinity.xml_util_set_attribute_ulong(xml, attribute, value)¶
- Parameters:
xml (
libxml2.NodePtr
) – Alibxml2.NodePtr
.attribute (
str
) – The name of the attribute to set.value (
int
) – The value to set.
Sets the attribute named attribute to the given unsigned long integral value converted to text.