## TplEntity TplEntity — Representation of a contact or room |

## Functions

TplEntity * | tpl_entity_new ()
TplEntity * | tpl_entity_new_from_tp_contact ()
TplEntity * | tpl_entity_new_from_room_id ()
const gchar * | tpl_entity_get_alias ()
const gchar * | tpl_entity_get_identifier ()
TplEntityType | tpl_entity_get_entity_type ()
const gchar * | tpl_entity_get_avatar_token ()

## Properties

gchar * | alias | Read / Write / Construct Only
gchar * | avatar-token | Read / Write / Construct Only
gchar * | identifier | Read / Write / Construct Only
gint | type | Read / Write / Construct Only

## Types and Values

enum | TplEntityType
| TplEntityPriv

## Object Hierarchy

        GObject
        ╰── TplEntity

## Description

An object representing a contact or room.

## Functions

### tpl_entity_new ()

    TplEntity *
    tpl_entity_new (const gchar *id,
                    TplEntityType type,
                    const gchar *alias,
                    const gchar *avatar_token);

#### Returns

### tpl_entity_new_from_tp_contact ()

    TplEntity *
    tpl_entity_new_from_tp_contact (TpContact *contact,
                                    TplEntityType type);

#### Parameters

contact | the TpContact instance to create the TplEntity from |
type | the TplEntity type |

#### Returns

a TplEntity instance with identifier, alias and avatar's token copied. Type parameter is useful to differentiate between normal contact and self contact, thus only `TPL_ENTITY_CONTACT` and `TPL_ENTITY_SELF` are accepted. If contact is `NULL`, an entity of type `TPL_ENTITY_UNKNOWN` with id set to "unknown" is returned.

### tpl_entity_new_from_room_id ()

    TplEntity *
    tpl_entity_new_from_room_id (const gchar *room_id);

#### Parameters

room_id | the room id which will be the identifier for the entity |

#### Returns

a TplEntity instance with identifier, alias copied from `room_id` . It also sets `TPL_ENTITY_ROOM` as type for the TplEntity returned.

### tpl_entity_get_alias ()

    const gchar *
    tpl_entity_get_alias (TplEntity *self);

#### Parameters

self | a TplEntity |

#### Returns

the alias of the entity, or `NULL`

### tpl_entity_get_identifier ()

    const gchar *
    tpl_entity_get_identifier (TplEntity *self);

#### Parameters

self | a TplEntity |

#### Returns

the identifier of the entity

### tpl_entity_get_entity_type ()

    TplEntityType
    tpl_entity_get_entity_type (TplEntity *self);

#### Parameters

self | a TplEntity |

#### Returns

the type of the entity

### tpl_entity_get_avatar_token ()

    const gchar *
    tpl_entity_get_avatar_token (TplEntity *self);

#### Parameters

self | a TplEntity |

#### Returns

a token representing the avatar of the token, or `NULL`

## Types and Values

### enum TplEntityType

#### Members

TPL_ENTITY_UNKNOWN | the current contact's type is unknown |
TPL_ENTITY_CONTACT | the contact's type represents a user (buddy), but not the account's owner for which `TPL_ENTITY_SELF` is used |
TPL_ENTITY_ROOM | a named room (TP_HANDLE_TYPE_ROOM) |
TPL_ENTITY_SELF | the contact's type represents the owner of the account whose channel has been logged, as opposed to `TPL_ENTITY_CONTACT` which represents any other user |

### TplEntityPriv

    typedef struct _TplEntityPriv TplEntityPriv;

## Property Details

### The `“alias”` property

      “alias”                    gchar *

The entity's alias.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“avatar-token”` property

      “avatar-token”             gchar *

The entity's avatar's token.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“identifier”` property

      “identifier”               gchar *

The entity's identifier.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“type”` property

      “type”                     gint

The entity's type.

Flags: Read / Write / Construct Only

Allowed values: [0,3]

Default value: 0