Functions

acl_account_array_free (accounts)

acl_account_from_xml (xml)

acl_account_id_to_string (account)

acl_sheet_perms_from_xml (xml)

acl_sheet_perms_to_xml (mask, perms, xml)

acl_sheet_set_from_xml (xml)

adopted_state_vector_error_quark ()

adopted_state_vector_from_string (str)

adopted_state_vector_from_string_diff (str, orig)

authentication_detail_error_quark ()

authentication_detail_strerror (code)

cert_util_check_certificate_key (cert, key)

cert_util_compare_fingerprint (cert1, cert2)

cert_util_get_activation_time (cert)

cert_util_get_dn (cert)

cert_util_get_dn_by_oid (cert, oid, index)

cert_util_get_expiration_time (cert)

cert_util_get_fingerprint (cert, algo)

cert_util_get_hostname (cert)

cert_util_get_issuer_dn_by_oid (cert, oid, index)

cert_util_get_serial_number (cert)

cert_util_read_certificate (filename, current)

cert_util_write_certificate (certs, filename)

cert_util_write_certificate_mem (certs, n_certs)

cert_util_write_certificate_with_key (key, certs, filename)

cert_util_write_dh_params (params, filename)

cert_util_write_private_key (key, filename)

deinit ()

directory_error_quark ()

directory_strerror (code)

file_util_create_directory (path, mode)

file_util_create_single_directory (path, mode)

file_util_delete (path)

file_util_delete_directory (path)

file_util_delete_file (path)

file_util_delete_single_directory (path)

file_util_list_directory (path, func, *user_data)

file_util_write_private_data (filename, data, length)

gnutls_certificate_verification_error_quark ()

gnutls_certificate_verification_set_error (error, verify)

gnutls_error_quark ()

gnutls_set_error (error, error_code)

gsasl_error_quark ()

gsasl_set_error (error, error_code)

init ()

native_socket_error_quark ()

native_socket_make_error (code)

protocol_get_default_port ()

protocol_get_version ()

protocol_parse_version (version, major, minor)

request_error_quark ()

request_result_make_add_node (browser, iter, new_node)

request_result_make_create_acl_account (browser, account, certificate)

request_result_make_explore_node (browser, iter)

request_result_make_join_user (proxy, user)

request_result_make_lookup_acl_accounts (browser, accounts)

request_result_make_query_acl (browser, iter, sheet_set)

request_result_make_query_acl_account_list (browser, accounts, does_notifications)

request_result_make_remove_acl_account (browser, account)

request_result_make_remove_node (browser, iter)

request_result_make_save_session (browser, iter)

request_result_make_set_acl (browser, iter)

request_result_make_subscribe_chat (browser, proxy)

request_result_make_subscribe_session (browser, iter, proxy)

request_strerror (code)

user_status_from_string (string)

user_status_to_string (status)

xml_util_add_child_text (xml, text)

xml_util_get_attribute_double (xml, attribute)

xml_util_get_attribute_double_required (xml, attribute)

xml_util_get_attribute_int (xml, attribute)

xml_util_get_attribute_int_required (xml, attribute)

xml_util_get_attribute_long (xml, attribute)

xml_util_get_attribute_long_required (xml, attribute)

xml_util_get_attribute_uint (xml, attribute)

xml_util_get_attribute_uint_required (xml, attribute)

xml_util_get_attribute_ulong (xml, attribute)

xml_util_get_attribute_ulong_required (xml, attribute)

xml_util_get_child_text (xml)

xml_util_new_error_from_node (xml)

xml_util_set_attribute (xml, attribute, value)

xml_util_set_attribute_double (xml, attribute, value)

xml_util_set_attribute_int (xml, attribute, value)

xml_util_set_attribute_long (xml, attribute, value)

xml_util_set_attribute_uint (xml, attribute, value)

xml_util_set_attribute_ulong (xml, attribute, value)

Details

Infinity.acl_account_array_free(accounts)
Parameters:

accounts ([Infinity.AclAccount]) – An array of Infinity.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:

GLib.Error

Returns:

A new Infinity.AclAccount on success, or None on failure. Free with Infinity.AclAccount.free() when no longer needed.

Return type:

Infinity.AclAccount

Attempts to deserialize an Infinity.AclAccount that was written to an XML node by the function Infinity.AclAccount.to_xml(). If an error occurs, such as mandatory fields being missing, the function returns None 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:

str

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:

GLib.Error

Returns:

True if the operation was successful, or False 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 returns False and error is set.

Infinity.acl_sheet_perms_to_xml(mask, perms, xml)
Parameters:

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:

GLib.Error

Returns:

A Infinity.AclSheetSet, or None. Free with Infinity.AclSheetSet.free() when no longer needed.

Return type:

Infinity.AclSheetSet

Reads a sheet set from xml that has been written with Infinity.AclSheetSet.to_xml(). If an error occurs the function returns None and error is set. If there is no ACL stored in xml, the function returns None without setting error.

Infinity.adopted_state_vector_error_quark()
Returns:

A #GQuark for that domain.

Return type:

int

The domain for Infinity.AdoptedStateVectorError errors.

Infinity.adopted_state_vector_from_string(str)
Parameters:

str (str) – A string representation of a Infinity.AdoptedStateVector.

Raises:

GLib.Error

Returns:

A new Infinity.AdoptedStateVector, or None.

Return type:

Infinity.AdoptedStateVector

Recreates the Infinity.AdoptedStateVector from its string representation. If an error occurs, the function returns None and error is set.

Infinity.adopted_state_vector_from_string_diff(str, orig)
Parameters:
Raises:

GLib.Error

Returns:

The created state vector, or None on error. Free with Infinity.AdoptedStateVector.free() when no longer needed.

Return type:

Infinity.AdoptedStateVector

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:

int

Error domain for further information on authentication errors. Errors in this domain will be from the Infinity.AuthenticationDetailError enumeration. See GLib.Error for information on error domains.

Infinity.authentication_detail_strerror(code)
Parameters:

code (Infinity.AuthenticationDetailError) – An error code from the Infinity.AuthenticationDetailError enumeration.

Returns:

A static string that must not be freed.

Return type:

str

Returns a human-readable string for the given error code.

Infinity.cert_util_check_certificate_key(cert, key)
Parameters:
Returns:

True if cert was signed with key, or False otherwise.

Return type:

bool

This function returns True if key is the private key belonging to cert, or False otherwise.

Infinity.cert_util_compare_fingerprint(cert1, cert2)
Parameters:
Raises:

GLib.Error

Returns:

Whether the two certificates have identical fingerprints. Returns False on error.

Return type:

bool

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 initialized InfGnutls.X509Crt.

Returns:

The activation time of the certificate, or None. Free with GLib.free() after use.

Return type:

str

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 initialized InfGnutls.X509Crt.

Returns:

The DN of the certificate. Free with GLib.free() after use.

Return type:

str

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:
Returns:

The certificate entry, or None if it is not present. Free with GLib.free() after use.

Return type:

str

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 initialized InfGnutls.X509Crt.

Returns:

The expiration time of the certificate, or None. Free with GLib.free() after use.

Return type:

str

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:
Returns:

The fingerprint of the certificate, or None. Free with GLib.free() after use.

Return type:

str

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 initialized InfGnutls.X509Crt.

Returns:

The best guess for the certificate’s hostname, or None when it cannot be retrieved. Free with GLib.free() after use.

Return type:

str or None

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:
Returns:

The certificate entry, or None if it is not present. Free with GLib.free() after use.

Return type:

str

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 initialized InfGnutls.X509Crt.

Returns:

The serial number of the certificate, or None. Free with GLib.free() after use.

Return type:

str

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:
Raises:

GLib.Error

Returns:

An array of the read certificates, or None on error.

Return type:

[InfGnutls.X509Crt]

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:
Raises:

GLib.Error

Returns:

True on success or False otherwise.

Return type:

bool

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:
Raises:

GLib.Error

Returns:

A string with PEM-encoded certificate data, or None on error. Free with GLib.free().

Return type:

str

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:
Raises:

GLib.Error

Returns:

True on success or False otherwise.

Return type:

bool

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:
Raises:

GLib.Error

Returns:

True on success or False otherwise.

Return type:

bool

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:
Raises:

GLib.Error

Returns:

True on success, False otherwise.

Return type:

bool

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, then Infinity.deinit() needs to be called the same number of times to actually deinitialize the library.

Infinity.directory_error_quark()
Returns:

A GQuark.

Return type:

int

Error domain for directory errors. Errors in this domain will be from the Infinity.DirectoryError enumeration. See GLib.Error for information on error domains.

Infinity.directory_strerror(code)
Parameters:

code (Infinity.DirectoryError) – An error code from the Infinity.DirectoryError enumeration.

Returns:

A static string that must not be freed.

Return type:

str

Returns a human-readable string for the given error code.

Infinity.file_util_create_directory(path, mode)
Parameters:
  • path (str) – The directory to create.

  • mode (int) – Permissions to use for the newly created directory.

Raises:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

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:
  • path (str) – The directory to create.

  • mode (int) – Permissions to use for the newly created directory.

Raises:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

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:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

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:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

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:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

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:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

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 or None) – Additional data to pass to func.

Raises:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

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 returns True. This can for example be used to find a file in a directory. If, in addition, the callback function sets error, then this function returns False and propagates the error.

Infinity.file_util_write_private_data(filename, data, length)
Parameters:
  • filename (str) – Filename of the file to be written to.

  • data (object or None) – Data that should be written to file.

  • length (int) – Length of data in bytes.

Raises:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

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:

int

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, or None.

  • verify (int) – A GnuTLS certificate verification code.

Sets a GLib.Error from a certificate verification result. If error is None, does nothing.

Infinity.gnutls_error_quark()
Returns:

A GQuark.

Return type:

int

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, or None.

  • error_code (int) – A GnuTLS error code.

Sets a GLib.Error from a GnuTLS error code. If error is None, does nothing.

Infinity.gsasl_error_quark()
Returns:

A GQuark.

Return type:

int

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, or None.

  • error_code (int) – A GNU SASL error code.

Sets a GLib.Error from a GNU SASL error code. If error is None, does nothing.

Infinity.init()
Raises:

GLib.Error

Returns:

Whether the initialization was successful or not.

Return type:

bool

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:

int

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:

GLib.Error

Converts the platform-dependent error code code into a GLib.Error. The GLib.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:

int

Returns the default port on which the infinote daemon listens for new connections.

Infinity.protocol_get_version()
Returns:

The supported infinote version.

Return type:

str

Returns the version of the Infinote protocol implemented by this version of libinfinity.

Infinity.protocol_parse_version(version, major, minor)
Parameters:
  • version (str) – A version string, such as “1.0”

  • major (int) – A location to store the major version number to.

  • minor (int) – A location to store the minor version number to

Raises:

GLib.Error

Returns:

True on success, or False on error.

Return type:

bool

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:

int

Error domain for request errors. Errors in this domain will be from the Infinity.RequestError enumeration. See GLib.Error for information on error domains.

Infinity.request_result_make_add_node(browser, iter, new_node)
Parameters:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for an “add-node” request, see Infinity.Browser.add_note() or Infinity.Browser.add_subdirectory(). The Infinity.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:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for a “create-acl-account” request, see Infinity.Browser.create_acl_account(). The Infinity.RequestResult object is only valid as long as the caller maintains a reference to browser.

Infinity.request_result_make_explore_node(browser, iter)
Parameters:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for an “explore-node” request, see Infinity.Browser.explore(). The Infinity.RequestResult object is only valid as long as the caller maintains a reference to browser.

Infinity.request_result_make_join_user(proxy, user)
Parameters:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for a “join-user” request, see Infinity.SessionProxy.join_user(). The Infinity.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:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for a “lookup-acl-accounts” request, see Infinity.Browser.lookup_acl_accounts(). The Infinity.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:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for a “query-acl” request, see Infinity.Browser.query_acl(). The Infinity.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:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for a “query-acl-account-list” request, see Infinity.Browser.query_acl_account_list(). The Infinity.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:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for a “remove-acl-account” request, see Infinity.Browser.remove_acl_account(). The Infinity.RequestResult object is only valid as long as the caller maintains a reference to browser.

Infinity.request_result_make_remove_node(browser, iter)
Parameters:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for an “remove-node” request, see Infinity.Browser.remove_node(). The Infinity.RequestResult object is only valid as long as the caller maintains a reference to browser.

Infinity.request_result_make_save_session(browser, iter)
Parameters:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for a “save-session” request, see infc_browser_iter_save_session(). The Infinity.RequestResult object is only valid as long as the caller maintains a reference to browser.

Infinity.request_result_make_set_acl(browser, iter)
Parameters:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for a “set-acl” request, see Infinity.Browser.set_acl(). The Infinity.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:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for a “subscribe-chat” request, see infc_browser_subscribe_chat(). The Infinity.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:
Returns:

A new Infinity.RequestResult. Free with Infinity.RequestResult.free().

Return type:

Infinity.RequestResult

Creates a new Infinity.RequestResult for a “subscribe-session” request, see Infinity.Browser.subscribe(). The Infinity.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 the Infinity.RequestError enumeration.

Returns:

A static string that must not be freed.

Return type:

str

Returns a human-readable string for the given error code.

Infinity.user_status_from_string(string)
Parameters:

string (str) – A string representation of a Infinity.UserStatus.

Raises:

GLib.Error

Returns:

When an error occurred during the conversion, False is returned, and True otherwise.

status:

A pointer to a Infinity.UserStatus value, or None.

Return type:

(bool, status: Infinity.UserStatus)

This function does the opposite of Infinity.UserStatus.to_string(). It turns the given string back to a Infinity.UserStatus, storing the result in status if status is non-None. If string is invalid, then status is left untouched, error is set and False is returned. Otherwise, the function returns True.

Infinity.user_status_to_string(status)
Parameters:

status (Infinity.UserStatus) – A value from the Infinity.UserStatus enumeration.

Returns:

A static string representation of status.

Return type:

str

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:

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:
Raises:

GLib.Error

Returns:

Whether result was set.

result:

Location to store the read value.

Return type:

(bool, result: float)

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:
Raises:

GLib.Error

Returns:

Whether result was set.

result:

Location to store the read value.

Return type:

(bool, result: float)

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:
Raises:

GLib.Error

Returns:

Whether result was set.

result:

Location to store the read value.

Return type:

(bool, result: int)

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:
Raises:

GLib.Error

Returns:

Whether result was set.

result:

Location to store the read value.

Return type:

(bool, result: int)

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:
Raises:

GLib.Error

Returns:

Whether result was set.

result:

Location to store the read value.

Return type:

(bool, result: int)

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:
Raises:

GLib.Error

Returns:

Whether result was set.

result:

Location to store the read value.

Return type:

(bool, result: int)

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:
Raises:

GLib.Error

Returns:

Whether result was set.

result:

Location to store the read value.

Return type:

(bool, result: int)

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:
Raises:

GLib.Error

Returns:

Whether result was set.

result:

Location to store the read value.

Return type:

(bool, result: int)

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:
Raises:

GLib.Error

Returns:

Whether result was set.

result:

Location to store the read value.

Return type:

(bool, result: int)

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:
Raises:

GLib.Error

Returns:

Whether result was set.

result:

Location to store the read value.

Return type:

(bool, result: int)

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) – A libxml2.NodePtr

Raises:

GLib.Error

Returns:

The node’s child text, or None on error. Free with GLib.free() when no longer needed.

chars:

Location to store number of characters of child text, or None.

Return type:

([str], chars: int)

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) – A libxml2.NodePtr as returned by inf_xml_util_new_node_from_error().

Returns:

A pointer to a new GLib.Error, or None on failure. It is the caller’s responsibility to dispose the GLib.Error object using GLib.Error.free().

Return type:

GLib.Error

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 with Infinity.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:

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:

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:

Sets the attribute named attribute to the given signed integral value converted to text.

Infinity.xml_util_set_attribute_long(xml, attribute, value)
Parameters:

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:

Sets the attribute named attribute to the given unsigned integral value converted to text.

Infinity.xml_util_set_attribute_ulong(xml, attribute, value)
Parameters:

Sets the attribute named attribute to the given unsigned long integral value converted to text.