EmpathyTpFile

EmpathyTpFile — Object which represents a Telepathy file channel

Synopsis


#include <libempathy/empathy-tp-file.h>

#define             EMPATHY_TP_FILE_UNKNOWN_SIZE
                    EmpathyTpFilePriv;
                    EmpathyTpFile;
EmpathyTpFile *     empathy_tp_file_new                 (TpChannel *channel);
TpChannel *         empathy_tp_file_get_channel         (EmpathyTpFile *tp_file);
void                empathy_tp_file_accept              (EmpathyTpFile *tp_file,
                                                         guint64 offset,
                                                         GFile *gfile,
                                                         GError **error);
void                empathy_tp_file_cancel              (EmpathyTpFile *tp_file);
void                empathy_tp_file_offer               (EmpathyTpFile *tp_file,
                                                         GFile *gfile,
                                                         GError **error);
EmpathyContact *    empathy_tp_file_get_contact         (EmpathyTpFile *tp_file);
const gchar *       empathy_tp_file_get_filename        (EmpathyTpFile *tp_file);
gboolean            empathy_tp_file_is_incoming         (EmpathyTpFile *tp_file);
TpFileTransferState  empathy_tp_file_get_state          (EmpathyTpFile *tp_file,
                                                         TpFileTransferStateChangeReason *reason);
guint64             empathy_tp_file_get_size            (EmpathyTpFile *tp_file);
guint64             empathy_tp_file_get_transferred_bytes
                                                        (EmpathyTpFile *tp_file);
gint                empathy_tp_file_get_remaining_time  (EmpathyTpFile *tp_file);
const gchar *       empathy_tp_file_get_content_type    (EmpathyTpFile *tp_file);

Object Hierarchy

  GObject
   +----EmpathyTpFile

Properties

  "channel"                  TpChannel*            : Read / Write / Construct Only
  "content-hash"             gchar*                : Read / Write
  "content-hash-type"        guint                 : Read / Write
  "content-type"             gchar*                : Read / Write
  "filename"                 gchar*                : Read / Write
  "incoming"                 gboolean              : Read / Write / Construct
  "ready"                    gboolean              : Read
  "size"                     guint64               : Read / Write
  "state"                    guint                 : Read / Write / Construct
  "transferred-bytes"        guint64               : Read / Write

Signals

  "refresh"                                        : Run Last

Description

EmpathyTpFile is an object which represents a Telepathy file channel.

Details

EMPATHY_TP_FILE_UNKNOWN_SIZE

#define EMPATHY_TP_FILE_UNKNOWN_SIZE G_MAXUINT64

Value used for the "size" or "estimated-size" properties when the size of the transferred file is unknown.


EmpathyTpFilePriv

typedef struct _EmpathyTpFilePriv EmpathyTpFilePriv;


EmpathyTpFile

typedef struct _EmpathyTpFile EmpathyTpFile;

Object which represents a Telepathy file channel.


empathy_tp_file_new ()

EmpathyTpFile *     empathy_tp_file_new                 (TpChannel *channel);

Creates a new EmpathyTpFile wrapping channel, or return a new ref to an existing EmpathyTpFile for that channel. The returned EmpathyTpFile should be unrefed with g_object_unref() when finished with.

channel :

a TpChannel

Returns :

a new EmpathyTpFile

empathy_tp_file_get_channel ()

TpChannel *         empathy_tp_file_get_channel         (EmpathyTpFile *tp_file);

Returns the TpChannel associated with tp_file.

tp_file :

an EmpathyTpFile

Returns :

the TpChannel associated with tp_file

empathy_tp_file_accept ()

void                empathy_tp_file_accept              (EmpathyTpFile *tp_file,
                                                         guint64 offset,
                                                         GFile *gfile,
                                                         GError **error);

Accepts a file transfer that's in the "local pending" state (i.e. TP_FILE_TRANSFER_STATE_LOCAL_PENDING).

tp_file :

an EmpathyTpFile

offset :

position where to start the transfer

gfile :

a GFile where to write transfered data

error :

a GError set if there is an error when opening gfile

empathy_tp_file_cancel ()

void                empathy_tp_file_cancel              (EmpathyTpFile *tp_file);

Cancels the file transfer, tp_file.

tp_file :

an EmpathyTpFile

empathy_tp_file_offer ()

void                empathy_tp_file_offer               (EmpathyTpFile *tp_file,
                                                         GFile *gfile,
                                                         GError **error);

Offers a file transfer that's in the "not offered" state (i.e. TP_FILE_TRANSFER_STATE_NOT_OFFERED).

tp_file :

an EmpathyTpFile

gfile :

a GFile where to read the data to transfer

error :

a GError set if there is an error when opening gfile

empathy_tp_file_get_contact ()

EmpathyContact *    empathy_tp_file_get_contact         (EmpathyTpFile *tp_file);

Returns the EmpathyContact that tp_file is open with.

tp_file :

an EmpathyTpFile

Returns :

the EmpathyContact that tp_file is open with.

empathy_tp_file_get_filename ()

const gchar *       empathy_tp_file_get_filename        (EmpathyTpFile *tp_file);

tp_file :

Returns :


empathy_tp_file_is_incoming ()

gboolean            empathy_tp_file_is_incoming         (EmpathyTpFile *tp_file);

Returns whether tp_file is incoming.

tp_file :

an EmpathyTpFile

Returns :

TRUE if the tp_file is incoming, otherwise FALSE

empathy_tp_file_get_state ()

TpFileTransferState  empathy_tp_file_get_state          (EmpathyTpFile *tp_file,
                                                         TpFileTransferStateChangeReason *reason);

Gets the current state of tp_file. If reason is not NULL, then it is set to the reason of the last state change.

tp_file :

an EmpathyTpFile

reason :

return location for state change reason, or NULL

Returns :

a TpFileTransferState

empathy_tp_file_get_size ()

guint64             empathy_tp_file_get_size            (EmpathyTpFile *tp_file);

Gets the size of the file being transferred over tp_file, in bytes.

tp_file :

an EmpathyTpFile

Returns :

the size of the file being transferred, in bytes

empathy_tp_file_get_transferred_bytes ()

guint64             empathy_tp_file_get_transferred_bytes
                                                        (EmpathyTpFile *tp_file);

Gets the number of transferred bytes of tp_file so far, in bytes.

tp_file :

an EmpathyTpFile

Returns :

number of transferred bytes of tp_file, in bytes

empathy_tp_file_get_remaining_time ()

gint                empathy_tp_file_get_remaining_time  (EmpathyTpFile *tp_file);

Gets the estimated time remaining of tp_file, in seconds.

tp_file :

a EmpathyTpFile

Returns :

the estimated time remaining of tp_file, in seconds

empathy_tp_file_get_content_type ()

const gchar *       empathy_tp_file_get_content_type    (EmpathyTpFile *tp_file);

tp_file :

Returns :

Property Details

The "channel" property

  "channel"                  TpChannel*            : Read / Write / Construct Only

The TpChannel associated with the EmpathyTpFile.


The "content-hash" property

  "content-hash"             gchar*                : Read / Write

A hash of the contents of the file being transferred.

Default value: ""


The "content-hash-type" property

  "content-hash-type"        guint                 : Read / Write

The type of hash type stored in "content-hash", from TpFileHashType.

Default value: 0


The "content-type" property

  "content-type"             gchar*                : Read / Write

The content-type of the file being transferred.

Default value: ""


The "filename" property

  "filename"                 gchar*                : Read / Write

The name of the file being transferred.

Default value: ""


The "incoming" property

  "incoming"                 gboolean              : Read / Write / Construct

Whether the EmpathyTpFile is incoming.

Default value: FALSE


The "ready" property

  "ready"                    gboolean              : Read

Whether the EmpathyTpFile is ready to use. This property returns the same as empathy_tp_file_is_ready().

Default value: FALSE


The "size" property

  "size"                     guint64               : Read / Write

The size of the file being transferred.

Default value: 18446744073709551615


The "state" property

  "state"                    guint                 : Read / Write / Construct

The TpFileTransferState of the EmpathyTpFile.

Default value: 4294967295


The "transferred-bytes" property

  "transferred-bytes"        guint64               : Read / Write

The number of bytes transferred in the EmpathyTpFile.

Default value: 0

Signal Details

The "refresh" signal

void                user_function                      (EmpathyTpFile *tp_file,
                                                        gpointer       user_data)      : Run Last

The progress of tp_file has changed. This can either be an update in the number of bytes transferred, or it can be to inform of the transfer stalling.

This signal is designed for clients to provide more user feedback when something to do with tp_file changes. To avoid emitting this signal too much, it is guaranteed that it will only ever be fired at least every two seconds.

tp_file :

the EmpathyTpFile

user_data :

user data set when the signal handler was connected.