TelepathyGLib.BaseClient

g GObject.Object GObject.Object TelepathyGLib.BaseClient TelepathyGLib.BaseClient GObject.Object->TelepathyGLib.BaseClient

Subclasses:

TelepathyGLib.SimpleApprover, TelepathyGLib.SimpleHandler, TelepathyGLib.SimpleObserver

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

add_account_features (features)

add_approver_filter (filter)

add_approver_filter_vardict (filter)

add_channel_features (features)

add_connection_features (features)

add_handler_capabilities (tokens)

add_handler_capability (token)

add_handler_filter (filter)

add_handler_filter_vardict (filter)

add_observer_filter (filter)

add_observer_filter_vardict (filter)

be_a_handler ()

delegate_channels_async (channels, user_action_time, preferred_handler, callback, *user_data)

delegate_channels_finish (result)

dup_handled_channels ()

dup_pending_requests ()

get_bus_name ()

get_dbus_daemon ()

get_handled_channels ()

get_name ()

get_object_path ()

get_pending_requests ()

get_uniquify_name ()

is_handling_channel (channel)

register ()

set_channel_factory (factory)

set_delegated_channels_callback (callback, *user_data)

set_handler_bypass_approval (bypass_approval)

set_handler_request_notification ()

set_observer_delay_approvers (delay)

set_observer_recover (recover)

unregister ()

Virtual Methods

Inherited:

GObject.Object (7)

do_add_dispatch_operation (account, connection, channels, dispatch_operation, context)

do_handle_channels (account, connection, channels, requests_satisfied, user_action_time, context)

do_observe_channels (account, connection, channels, dispatch_operation, requests, context)

Properties

Name

Type

Flags

Short Description

account-manager

TelepathyGLib.AccountManager

r/w/co

The TelepathyGLib.AccountManager used look up or create TelepathyGLib.Account objects deprecated

channel-factory

GObject.Object

r/w/co

Object implementing TelepathyGLib.ClientChannelFactoryInterface deprecated

dbus-daemon

TelepathyGLib.DBusDaemon

r/w/co

The dbus daemon associated with this client

factory

TelepathyGLib.SimpleClientFactory

r/w/co

The TelepathyGLib.SimpleClientFactory used look up or create TelepathyGLib.Account objects

name

str

r/w/co

The name of the client

uniquify-name

bool

r/w/co

if True, append a unique token to the name

Signals

Inherited:

GObject.Object (1)

Name

Short Description

request-added

Emitted when a channels have been requested, and that if the request is successful, they will probably be handled by this Handler.

request-removed

Emitted when a request has failed and should be disregarded.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class TelepathyGLib.BaseClient(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

TelepathyGLib.BaseClientClass

Data structure representing a generic #TpSvcClient implementation.

New in version 0.11.5.

add_account_features(features)
Parameters:

features ([int]) – the features

Request that the given features are prepared on each TelepathyGLib.Account (in addition to %TP_ACCOUNT_FEATURE_CORE) before calling TelepathyGLib.BaseClientClass.observe_channels, TelepathyGLib.BaseClientClass.add_dispatch_operation or TelepathyGLib.BaseClientClass.handle_channels, or emitting TelepathyGLib.BaseClient ::request-added.

New in version 0.11.14.

Deprecated since version ???: New code should use TelepathyGLib.SimpleClientFactory.add_account_features() instead.

add_approver_filter(filter)
Parameters:

filter ({str: GObject.Value}) – a %TP_HASH_TYPE_CHANNEL_CLASS

Register a new channel class as Approver.ApproverChannelFilter. The TelepathyGLib.BaseClientClass.add_dispatch_operation virtual method will be called whenever a new channel’s properties match the ones in filter.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.add_dispatch_operation.

New in version 0.11.5.

add_approver_filter_vardict(filter)
Parameters:

filter (GLib.Variant) – a variant of type %G_VARIANT_TYPE_VARDICT

Register a new channel class as Approver.ApproverChannelFilter. The TelepathyGLib.BaseClientClass.add_dispatch_operation virtual method will be called whenever a new channel’s properties match the ones in filter.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.add_dispatch_operation.

If the variant is floating (see GLib.Variant.ref_sink()), ownership will be taken. See TelepathyGLib.BaseClient.add_observer_filter_vardict() for more details.

New in version 0.19.10.

add_channel_features(features)
Parameters:

features ([int]) – the features

Request that the given features are prepared on each TelepathyGLib.Channel (in addition to %TP_CHANNEL_FEATURE_CORE) before calling TelepathyGLib.BaseClientClass.observe_channels, TelepathyGLib.BaseClientClass.add_dispatch_operation or TelepathyGLib.BaseClientClass.handle_channels.

New in version 0.11.14.

Deprecated since version ???: New code should use TelepathyGLib.SimpleClientFactory.add_channel_features() instead.

add_connection_features(features)
Parameters:

features ([int]) – the features

Request that the given features are prepared on each TelepathyGLib.Connection (in addition to %TP_CONNECTION_FEATURE_CORE) before calling TelepathyGLib.BaseClientClass.observe_channels, TelepathyGLib.BaseClientClass.add_dispatch_operation or TelepathyGLib.BaseClientClass.handle_channels.

New in version 0.11.14.

Deprecated since version ???: New code should use TelepathyGLib.SimpleClientFactory.add_connection_features() instead.

add_handler_capabilities(tokens)
Parameters:

tokens ([str]) – capability tokens as defined by the Telepathy D-Bus API Specification

Add several capability tokens to this client. These are used to signal that Telepathy connection managers should advertise certain capabilities to other contacts, such as the ability to receive audio/video calls using particular streaming protocols and codecs.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.handle_channels.

New in version 0.11.6.

add_handler_capability(token)
Parameters:

token (str) – a capability token as defined by the Telepathy D-Bus API Specification

Add one capability token to this client, as if via TelepathyGLib.BaseClient.add_handler_capabilities().

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.handle_channels.

New in version 0.11.6.

add_handler_filter(filter)
Parameters:

filter ({str: GObject.Value}) – a %TP_HASH_TYPE_CHANNEL_CLASS

Register a new channel class as Handler.HandlerChannelFilter. The TelepathyGLib.BaseClientClass.handle_channels virtual method will be called whenever a new channel’s properties match the ones in filter.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.handle_channels.

New in version 0.11.6.

add_handler_filter_vardict(filter)
Parameters:

filter (GLib.Variant) – a variant of type %G_VARIANT_TYPE_VARDICT

Register a new channel class as Handler.HandlerChannelFilter. The TelepathyGLib.BaseClientClass.handle_channels virtual method will be called whenever a new channel’s properties match the ones in filter.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.handle_channels.

If the variant is floating (see GLib.Variant.ref_sink()), ownership will be taken. See TelepathyGLib.BaseClient.add_observer_filter_vardict() for more details.

New in version 0.19.10.

add_observer_filter(filter)
Parameters:

filter ({str: GObject.Value}) – a %TP_HASH_TYPE_CHANNEL_CLASS

Register a new channel class as Observer.ObserverChannelFilter. The TelepathyGLib.BaseClientClass.observe_channels virtual method will be called whenever a new channel’s properties match the ones in filter.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.observe_channels.

New in version 0.11.5.

add_observer_filter_vardict(filter)
Parameters:

filter (GLib.Variant) – a variant of type %G_VARIANT_TYPE_VARDICT

Register a new channel class as Observer.ObserverChannelFilter. The TelepathyGLib.BaseClientClass.observe_channels virtual method will be called whenever a new channel’s properties match the ones in filter.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.observe_channels.

If the variant is floating (see GLib.Variant.ref_sink()), ownership will be taken, allowing for uses like this:

tp_base_client_add_observer_filter_vardict (client,
g_variant_new_parsed ("{ %s: <%s>, %s: <%u>, ... }",
    TP_PROP_CHANNEL_CHANNEL_TYPE, TP_IFACE_CHANNEL_TYPE_TEXT,
    TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, (guint32) TP_HANDLE_TYPE_CONTACT,
    ...));

New in version 0.19.10.

be_a_handler()

Register self as a Client.Handler with an empty list of filters. This is useful if you want to create a client that only handle channels for which it’s the PreferredHandler.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.handle_channels.

New in version 0.11.6.

delegate_channels_async(channels, user_action_time, preferred_handler, callback, *user_data)
Parameters:

Asynchronously calls DelegateChannels on the ChannelDispatcher to try stopping handling channels and pass them to another Handler. You can then call TelepathyGLib.BaseClient.delegate_channels_finish() to get the result of the operation.

New in version 0.15.0.

delegate_channels_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

True if the operation succeed, delegated and not_delegated can be used to know the channels that self is not handling any more, otherwise False.

delegated:

if not None, used to return a GLib.PtrArray containing the TelepathyGLib.Channel s which have been properly delegated

not_delegated:

if not not None, used to return a GLib.HashTable mapping TelepathyGLib.Channel s which have not been delegated to a GLib.Error explaining the reason of the failure

Return type:

(bool, delegated: [TelepathyGLib.Channel], not_delegated: {TelepathyGLib.Channel: GLib.Error})

Finishes an async channels delegation request started using TelepathyGLib.BaseClient.delegate_channels_async().

New in version 0.15.0.

dup_handled_channels()
Returns:

the handled channels

Return type:

[TelepathyGLib.Channel]

Returns the set of channels currently handled by this base client or by any other TelepathyGLib.BaseClient with which it shares a unique name.

New in version 0.19.9.

dup_pending_requests()
Returns:

a GLib.List of TelepathyGLib.ChannelRequest

Return type:

[TelepathyGLib.ChannelRequest]

Only works if TelepathyGLib.BaseClient.set_handler_request_notification() has been called. Returns the list of requests self is likely be asked to handle.

New in version 0.19.9.

get_bus_name()
Returns:

the bus name of the client

Return type:

str

Return the bus name of self. Note that doesn’t mean the client is actually owning this name; for example if TelepathyGLib.BaseClient.register() has not been called yet or failed.

New in version 0.11.5.

get_dbus_daemon()
Returns:

the value of TelepathyGLib.BaseClient :dbus-daemon

Return type:

TelepathyGLib.DBusDaemon

Return the TelepathyGLib.BaseClient :dbus-daemon construct-only property, which represents the D-Bus connection used to export this client object.

The returned object’s reference count is not incremented, so it is not necessarily valid after self is destroyed.

New in version 0.11.11.

get_handled_channels()
Returns:

the handled channels

Return type:

[TelepathyGLib.Channel]

Returns the set of channels currently handled by this base client or by any other TelepathyGLib.BaseClient with which it shares a unique name.

New in version 0.11.6.

Deprecated since version 0.19.9: New code should use TelepathyGLib.BaseClient.dup_handled_channels() instead.

get_name()
Returns:

the value of TelepathyGLib.BaseClient :name

Return type:

str

Return the TelepathyGLib.BaseClient :name construct-only property, which is used as part of the bus name and object path.

New in version 0.11.11.

get_object_path()
Returns:

the object path of the client

Return type:

str

Return the object path of self. Note that doesn’t mean the client is actually registered on this path; for example if TelepathyGLib.BaseClient.register() has not been called yet or failed.

New in version 0.11.5.

get_pending_requests()
Returns:

a GLib.List of TelepathyGLib.ChannelRequest

Return type:

[TelepathyGLib.ChannelRequest]

Only works if TelepathyGLib.BaseClient.set_handler_request_notification() has been called. Returns the list of requests self is likely be asked to handle.

New in version 0.11.6.

Deprecated since version 0.19.9: New code should use TelepathyGLib.BaseClient.dup_pending_requests() instead.

get_uniquify_name()
Returns:

the value of TelepathyGLib.BaseClient :uniquify-name

Return type:

bool

Return the TelepathyGLib.BaseClient :uniquify-name construct-only property; if this is true, the bus name and object path will be made unique by appending a suffix that includes the D-Bus unique name and a per-process counter.

New in version 0.11.11.

is_handling_channel(channel)
Parameters:

channel (TelepathyGLib.Channel) – a TelepathyGLib.Channel

Returns:

True if self is handling channel, False otherwise

Return type:

bool

Check if self is currently handling channel.

New in version 0.14.5.

register()
Raises:

GLib.Error

Returns:

True if the client was registered successfully

Return type:

bool

Publish self as an available client. After this method is called, as long as it continues to exist, it will receive and process whatever events were requested via the various filters.

Methods that set the filters and other immutable state, such as TelepathyGLib.BaseClient.add_observer_filter(), cannot be called after this one.

New in version 0.11.5.

set_channel_factory(factory)
Parameters:

factory (TelepathyGLib.ClientChannelFactory) – an object implementing the TelepathyGLib.ClientChannelFactoryInterface interface

Change the value of the TelepathyGLib.BaseClient :channel-factory property. It can’t be changed once self has been registered.

New in version 0.13.2.

Deprecated since version ???: since 0.15.5. The factory is taken from TelepathyGLib.BaseClient :account-manager.

set_delegated_channels_callback(callback, *user_data)
Parameters:

Turn on support for the org.freedesktop.Telepathy.ChannelRequest.DelegateToPreferredHandler hint.

When receiving a request containing this hint, self will automatically delegate the channels to the preferred handler of the request and then call callback to inform the client that it is no longer handling those channels.

New in version 0.15.3.

set_handler_bypass_approval(bypass_approval)
Parameters:

bypass_approval (bool) – the value of the Handler.BypassApproval property

Set whether the channels destined for this handler are automatically handled, without invoking approvers. (This is implemented by setting the value of its BypassApproval D-Bus property.)

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.handle_channels.

New in version 0.11.6.

set_handler_request_notification()

Indicate that self is a Handler willing to be notified about requests for channels that it is likely to be asked to handle. This means that the TelepathyGLib.BaseClient ::request-added and TelepathyGLib.BaseClient ::request-removed signals will be fired and TelepathyGLib.BaseClient.get_pending_requests() will return the list of pending requests.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.handle_channels.

New in version 0.11.6.

set_observer_delay_approvers(delay)
Parameters:

delay (bool) – the value of the Observer.DelayApprovers property

Set whether the channel dispatcher should wait for TelepathyGLib.ObserveChannelsContext.accept() or TelepathyGLib.ObserveChannelsContext.fail() to be called before calling TelepathyGLib.BaseClientClass.add_dispatch_operation on appropriate Approvers.

This is implemented by setting the value of the DelayApprovers D-Bus property.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.observe_channels.

New in version 0.13.16.

set_observer_recover(recover)
Parameters:

recover (bool) – the value of the Observer.Recover property

Set whether the channel dispatcher should attempt to recover this Observer if it crashes. (This is implemented by setting the value of its Recover D-Bus property.)

Normally, Observers are only notified when new channels appear. If an Observer is set to recover, when it registers with TelepathyGLib.BaseClient.register(), it will also be told about any channels that already existed before it started.

For Observers that are activatable as a D-Bus service, if the Observer exits or crashes while there are any channels that match its filter, it will automatically be restarted by service-activation.

This method may only be called before TelepathyGLib.BaseClient.register() is called, and may only be called on objects whose class implements TelepathyGLib.BaseClientClass.observe_channels.

New in version 0.11.5.

unregister()

Remove this client object from D-Bus, if TelepathyGLib.BaseClient.register() has already been called.

If the object is not registered, this method may be called, but has no effect.

Releasing the last reference to the object also has the same effect as calling this method, but this method should be preferred, as it has more deterministic behaviour.

If the object still exists, TelepathyGLib.BaseClient.register() may be used to attempt to register it again.

New in version 0.11.6.

do_add_dispatch_operation(account, connection, channels, dispatch_operation, context) virtual
Parameters:
do_handle_channels(account, connection, channels, requests_satisfied, user_action_time, context) virtual
Parameters:
do_observe_channels(account, connection, channels, dispatch_operation, requests, context) virtual
Parameters:

Signal Details

TelepathyGLib.BaseClient.signals.request_added(base_client, account, request)
Signal Name:

request-added

Flags:

RUN_LAST, DETAILED

Parameters:

Emitted when a channels have been requested, and that if the request is successful, they will probably be handled by this Handler.

This signal is only fired if TelepathyGLib.BaseClient.set_handler_request_notification() has been called on self previously.

New in version 0.11.6.

TelepathyGLib.BaseClient.signals.request_removed(base_client, request, error, message)
Signal Name:

request-removed

Flags:

RUN_LAST, DETAILED

Parameters:

Emitted when a request has failed and should be disregarded.

This signal is only fired if TelepathyGLib.BaseClient.set_handler_request_notification() has been called on self previously.

New in version 0.11.6.

Property Details

TelepathyGLib.BaseClient.props.account_manager
Name:

account-manager

Type:

TelepathyGLib.AccountManager

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Account manager for this base client, used to look up or create TelepathyGLib.Account objects. This may be specified in the constructor in order to get existing TelepathyGLib.Account objects.

It is not guaranteed that any of its features have been prepared, and it is not necessary to wait for any features before specifying this property in the constructor.

Clients that interact with the TelepathyGLib.Account should usually set this property instead of TelepathyGLib.BaseClient :dbus-daemon. Doing this will ensure that each account, connection or contact is represented by a single TelepathyGLib.Account, TelepathyGLib.Connection or TelepathyGLib.Contact object, shared between all the cooperating modules that have the same TelepathyGLib.AccountManager.

If the TelepathyGLib.BaseClient :dbus-daemon is set to the result of TelepathyGLib.DBusDaemon.dup(), then this property defaults to the result of TelepathyGLib.AccountManager.dup().

This property may be None initially, but will always be non-None after the TelepathyGLib.BaseClient has been constructed.

It is an error to specify both a non-None account manager, and a non-None TelepathyGLib.BaseClient :dbus-daemon that is not the same as the account manager’s TelepathyGLib.Proxy :dbus-daemon.

New in version 0.11.14.

Deprecated since version ???: New code should not use this property, it may be None in the case self was constructed with a TelepathyGLib.SimpleClientFactory.

TelepathyGLib.BaseClient.props.channel_factory
Name:

channel-factory

Type:

GObject.Object

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The object implementing the TelepathyGLib.ClientChannelFactoryInterface interface that will be used to create channel proxies. While TelepathyGLib.BaseClient.register() has not yet been called, this property can be changed using TelepathyGLib.BaseClient.set_channel_factory().

If no channel factory is specified then TelepathyGLib.AutomaticProxyFactory is used.

New in version 0.13.2.

Deprecated since version ???: since 0.15.5. The factory is taken from TelepathyGLib.BaseClient :account-manager.

TelepathyGLib.BaseClient.props.dbus_daemon
Name:

dbus-daemon

Type:

TelepathyGLib.DBusDaemon

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

TelepathyGLib.DBusDaemon object encapsulating this object’s connection to D-Bus. Read-only except during construction.

This property can’t be None after construction.

Since 0.11.14 this property may be None or unspecified in g_object_new(), but only if TelepathyGLib.BaseClient :account-manager is provided instead, in which case its TelepathyGLib.Proxy :dbus-daemon property will be used.

New in version 0.11.5.

TelepathyGLib.BaseClient.props.factory
Name:

factory

Type:

TelepathyGLib.SimpleClientFactory

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Factory for this base client, used to look up or create TelepathyGLib.Account objects.

New in version 0.15.5.

TelepathyGLib.BaseClient.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The name of the client. This is used to register the D-Bus service name and object path of the service.

This property can’t be None.

New in version 0.11.5.

TelepathyGLib.BaseClient.props.uniquify_name
Name:

uniquify-name

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

If True, TelepathyGLib.BaseClient.register() will append an unique token to the service bus name and object path to ensure they are unique.

New in version 0.11.5.