TelepathyGLib.FileTransferChannel

g GObject.Object GObject.Object TelepathyGLib.Proxy TelepathyGLib.Proxy GObject.Object->TelepathyGLib.Proxy TelepathyGLib.Channel TelepathyGLib.Channel TelepathyGLib.FileTransferChannel TelepathyGLib.FileTransferChannel TelepathyGLib.Channel->TelepathyGLib.FileTransferChannel TelepathyGLib.Proxy->TelepathyGLib.Channel

Subclasses:

None

Methods

Inherited:

TelepathyGLib.Channel (44), TelepathyGLib.Proxy (11), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get_feature_quark_core ()

class

new (conn, object_path, immutable_properties)

accept_file_async (file, offset, callback, *user_data)

accept_file_finish (result)

get_date ()

get_description ()

get_filename ()

get_metadata ()

get_mime_type ()

get_service_name ()

get_size ()

get_state ()

get_transferred_bytes ()

provide_file_async (file, callback, *user_data)

provide_file_finish (result)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

TelepathyGLib.Channel (12), TelepathyGLib.Proxy (5)

Name

Type

Flags

Short Description

date

GLib.DateTime

r

The Date property of this channel

description

str

r

The Description property of this channel

file

Gio.File

r

A Gio.File corresponding to the URI property of this channel

filename

str

r

The Filename property of this channel

initial-offset

int

r

The InitialOffset property of this channel

mime-type

str

r

The ContentType property of this channel

service-name

str

r

The Metadata.ServiceName property of this channel

size

int

r

The Size property of this channel

state

int

r

The TelepathyGLib.FileTransferState of the channel

transferred-bytes

int

r

The TransferredBytes property of this channel

Signals

Inherited:

TelepathyGLib.Channel (5), TelepathyGLib.Proxy (2), GObject.Object (1)

Fields

Inherited:

TelepathyGLib.Channel (5), TelepathyGLib.Proxy (2), GObject.Object (1)

Name

Type

Access

Description

parent

TelepathyGLib.Channel

r

Class Details

class TelepathyGLib.FileTransferChannel(**kwargs)
Bases:

TelepathyGLib.Channel

Abstract:

No

Structure:

TelepathyGLib.FileTransferChannelClass

Data structure representing a TelepathyGLib.FileTransferChannel.

New in version 0.15.5.

classmethod get_feature_quark_core()
Return type:

int

classmethod new(conn, object_path, immutable_properties)
Parameters:
  • conn (TelepathyGLib.Connection) – a TelepathyGLib.Connection; may not be None

  • object_path (str) – the object path of the channel; may not be None

  • immutable_properties ({str: GObject.Value}) – the immutable properties of the channel, as signalled by the NewChannel D-Bus signal or returned by the CreateChannel and EnsureChannel D-Bus methods: a mapping from strings (D-Bus interface name + “.” + property name) to GObject.Value instances

Raises:

GLib.Error

Returns:

a newly created TelepathyGLib.FileTransferChannel

Return type:

TelepathyGLib.FileTransferChannel

Convenient function to create a new TelepathyGLib.FileTransferChannel

New in version 0.15.5.

Deprecated since version ???: Use TelepathyGLib.SimpleClientFactory.ensure_channel() instead.

accept_file_async(file, offset, callback, *user_data)
Parameters:
  • file (Gio.File) – a Gio.File where the file should be saved

  • offset (int) – Offset from the start of file where transfer begins

  • callback (Gio.AsyncReadyCallback or None) – a callback to call when the transfer has been accepted

  • user_data (object or None) – data to pass to callback

Accept an incoming file transfer in the TelepathyGLib.FileTransferState.PENDING state. Once the accept has been processed, callback will be called. You can then call TelepathyGLib.FileTransferChannel.accept_file_finish() to get the result of the operation.

New in version 0.17.1.

accept_file_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

True if the accept operation was a success, or False

Return type:

bool

Finishes a call to TelepathyGLib.FileTransferChannel.accept_file_async().

New in version 0.17.1.

get_date()
Returns:

the value of the TelepathyGLib.FileTransferChannel :date property

Return type:

GLib.DateTime

Return the TelepathyGLib.FileTransferChannel :date property

New in version 0.15.5.

get_description()
Returns:

the value of the TelepathyGLib.FileTransferChannel :description property

Return type:

str

Return the TelepathyGLib.FileTransferChannel :description property

New in version 0.15.5.

get_filename()
Returns:

the value of the TelepathyGLib.FileTransferChannel :filename property

Return type:

str

Return the TelepathyGLib.FileTransferChannel :filename property

New in version 0.15.5.

get_metadata()
Returns:

the value of the TelepathyGLib.FileTransferChannel :metadata property

Return type:

{str: [str]}

Return the TelepathyGLib.FileTransferChannel :metadata property

New in version 0.17.1.

get_mime_type()
Returns:

the value of the TelepathyGLib.FileTransferChannel :mime-type property

Return type:

str

Return the TelepathyGLib.FileTransferChannel :mime-type property

New in version 0.15.5.

get_service_name()
Returns:

the value of the TelepathyGLib.FileTransferChannel :service-name property

Return type:

str

Return the TelepathyGLib.FileTransferChannel :service-name property

New in version 0.17.1.

get_size()
Returns:

the value of the TelepathyGLib.FileTransferChannel :size property

Return type:

int

Return the TelepathyGLib.FileTransferChannel :size property

New in version 0.15.5.

get_state()
Returns:

the value of the TelepathyGLib.FileTransferChannel :state property

reason:

a TelepathyGLib.FileTransferStateChangeReason, or None

Return type:

(TelepathyGLib.FileTransferState, reason: TelepathyGLib.FileTransferStateChangeReason)

Returns the TelepathyGLib.FileTransferChannel :state property.

If reason is not None it is set to the reason why TelepathyGLib.FileTransferChannel :state changed to its current value.

New in version 0.17.1.

get_transferred_bytes()
Returns:

the value of the TelepathyGLib.FileTransferChannel :transferred-bytes property

Return type:

int

Return the TelepathyGLib.FileTransferChannel :transferred-bytes property

New in version 0.15.5.

provide_file_async(file, callback, *user_data)
Parameters:

Provide a file transfer. This should be called when the file transfer state changes (TelepathyGLib.FileTransferChannel.get_state() and the “notify::state” signal) to TelepathyGLib.FileTransferState.ACCEPTED or TelepathyGLib.FileTransferState.PENDING. Once the file has been provided, the channel TelepathyGLib.FileTransferChannel :state will change to TelepathyGLib.FileTransferState.OPEN.

Once the file has been provided, callback will be called. You should then call TelepathyGLib.FileTransferChannel.provide_file_finish() to get the result of the operation.

New in version 0.17.1.

provide_file_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

True if the file has been successfully provided, or False.

Return type:

bool

Finishes a call to TelepathyGLib.FileTransferChannel.provide_file_async().

Successful return from this function does not mean that the file transfer has completed or has even started at all. The state of the file transfer should be monitored with the “notify::state” signal.

New in version 0.17.1.

Property Details

TelepathyGLib.FileTransferChannel.props.date
Name:

date

Type:

GLib.DateTime

Default Value:

None

Flags:

READABLE

A GLib.DateTime representing the last modification time of the file to be transferred.

New in version 0.15.5.

TelepathyGLib.FileTransferChannel.props.description
Name:

description

Type:

str

Default Value:

None

Flags:

READABLE

The description of the file transfer, defined by the sender when sending the file transfer offer.

New in version 0.15.5.

TelepathyGLib.FileTransferChannel.props.file
Name:

file

Type:

Gio.File

Default Value:

None

Flags:

READABLE

For incoming file transfers, this property will be set to a Gio.File for the location where the file will be saved (given by TelepathyGLib.FileTransferChannel.accept_file_async()) when the transfer starts. The feature %TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE must already be prepared for this property to have a meaningful value, and to receive change notification. Once the initial value is set, this property will not be changed.

For outgoing file transfers, this property is a Gio.File for the location of the file being sent (given by TelepathyGLib.FileTransferChannel.provide_file_async()). The feature %TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE does not have to be prepared and there is no change notification.

New in version 0.17.1.

TelepathyGLib.FileTransferChannel.props.filename
Name:

filename

Type:

str

Default Value:

None

Flags:

READABLE

The name of the file on the sender’s side. This is therefore given as a suggested filename for the receiver.

New in version 0.15.5.

TelepathyGLib.FileTransferChannel.props.initial_offset
Name:

initial-offset

Type:

int

Default Value:

0

Flags:

READABLE

The offset in bytes from where the file should be sent.

The %TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE feature has to be prepared for this property to be meaningful and kept up to date.

New in version 0.17.1.

TelepathyGLib.FileTransferChannel.props.mime_type
Name:

mime-type

Type:

str

Default Value:

None

Flags:

READABLE

The MIME type of the file to be transferred.

New in version 0.15.5.

TelepathyGLib.FileTransferChannel.props.service_name
Name:

service-name

Type:

str

Default Value:

''

Flags:

READABLE

A string representing the name of the service suggested to handle this file transfer channel, or None if the initiator did not provide one.

This is a useful way of requesting file transfer channels with a hint of what handler they should be handled by on the remote side. If a channel request is made with this property set (to a contact who also supports the metadata extension; see the requestable channel classes for said contact), this property will be set to the same value on the remote incoming channel and handlers can match on this in their handler filter. For example, a remote handler could call the following:

tp_base_client_take_handler_filter (handler, tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
TP_PROP_CHANNEL_REQUESTED, G_TYPE_BOOLEAN, FALSE,
TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_SERVICE_NAME, G_TYPE_STRING, "service.name",
NULL));

The %TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE feature has to be prepared for this property to be meaningful.

New in version 0.17.1.

TelepathyGLib.FileTransferChannel.props.size
Name:

size

Type:

int

Default Value:

0

Flags:

READABLE

The size of the file to be transferred, or GObject.G_MAXUINT64 if not known.

New in version 0.15.5.

TelepathyGLib.FileTransferChannel.props.state
Name:

state

Type:

int

Default Value:

0

Flags:

READABLE

A TelepathyGLib.FileTransferState holding the state of the file transfer.

The %TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE feature has to be prepared for this property to be meaningful and kept up to date.

New in version 0.17.1.

TelepathyGLib.FileTransferChannel.props.transferred_bytes
Name:

transferred-bytes

Type:

int

Default Value:

0

Flags:

READABLE

The number of bytes transferred so far in this file transfer.

The %TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE feature has to be prepared for this property to be meaningful and kept up to date.

New in version 0.15.5.