## EmpathyTpFile EmpathyTpFile — File channel |

## Synopsis

    #include <libempthy/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_close               (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
      "size"                     guint64               : Read / Write
      "state"                    guint                 : Read / Write / Construct
      "transferred-bytes"        guint64               : Read / Write

## Description

The EmpathyTpFile object 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;

### 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.

`channel` : | a Telepathy channel
Returns : | a new EmpathyTpFile

### empathy_tp_file_get_channel ()

    TpChannel *         empathy_tp_file_get_channel         (EmpathyTpFile *tp_file);

Returns the Telepathy file transfer channel

`tp_file` : | an EmpathyTpFile
Returns : | the TpChannel

### 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);

`tp_file` : |

### empathy_tp_file_close ()

    void                empathy_tp_file_close               (EmpathyTpFile *tp_file);

`tp_file` : |

### 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);

`tp_file` : |
Returns : |

### 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);

`tp_file` : |
Returns : |

### empathy_tp_file_get_state ()

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

`tp_file` : |
`reason` : |
Returns : |

### empathy_tp_file_get_size ()

    guint64             empathy_tp_file_get_size            (EmpathyTpFile *tp_file);

`tp_file` : |
Returns : |

### empathy_tp_file_get_transferred_bytes ()

    guint64             empathy_tp_file_get_transferred_bytes
                                                            (EmpathyTpFile *tp_file);

`tp_file` : |
Returns : |

### empathy_tp_file_get_remaining_time ()

    gint                empathy_tp_file_get_remaining_time  (EmpathyTpFile *tp_file);

`tp_file` : |
Returns : |

### 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 file transfer channel.

### The `"content-hash"` property

      "content-hash"             gchar*                : Read / Write

The hash of the transfer's contents.

Default value: ""

### The `"content-hash-type"` property

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

The type of the file transfer hash.

Default value: 0

### The `"content-type"` property

      "content-type"             gchar*                : Read / Write

The file transfer content-type.

Default value: ""

### The `"filename"` property

      "filename"                 gchar*                : Read / Write

The file transfer filename.

Default value: ""

### The `"incoming"` property

      "incoming"                 gboolean              : Read / Write / Construct

Whether the transfer is incoming.

Default value: FALSE

### The `"size"` property

      "size"                     guint64               : Read / Write

The file transfer size.

Default value: 18446744073709551615

### The `"state"` property

      "state"                    guint                 : Read / Write / Construct

The file transfer state.

Default value: 4294967295

### The `"transferred-bytes"` property

      "transferred-bytes"        guint64               : Read / Write

The number of bytes transferred.

Default value: 0

## See Also

#EmpathyTpFile, EmpathyContact, `empathy_dispatcher_send_file()`