## TpTextMixin

TpTextMixin — a mixin implementation of the text channel type

## Functions

GQuark | tp_text_mixin_class_get_offset_quark ()
GQuark | tp_text_mixin_get_offset_quark ()
void | tp_text_mixin_class_init ()
void | tp_text_mixin_init ()
void | tp_text_mixin_set_message_types ()
void | tp_text_mixin_finalize ()
gboolean | tp_text_mixin_receive_with_flags ()
gboolean | tp_text_mixin_receive ()
gboolean | tp_text_mixin_acknowledge_pending_messages ()
gboolean | tp_text_mixin_list_pending_messages ()
gboolean | tp_text_mixin_get_message_types ()
void | tp_text_mixin_clear ()
gboolean | tp_text_mixin_has_pending_messages ()
void | tp_text_mixin_set_rescued ()
void | tp_text_mixin_iface_init ()

## Types and Values

struct | TpTextMixin
struct | TpTextMixinClass

## Includes

    #include <telepathy-glib/text-mixin.h>

## Description

This mixin can be added to a channel GObject class to implement the text channel type in a general way. It implements the pending message queue and GetMessageTypes, so the implementation should only need to implement Send.

To use the text mixin, include a TpTextMixinClass somewhere in your class structure and a TpTextMixin somewhere in your instance structure, and call `tp_text_mixin_class_init()` from your class_init function, `tp_text_mixin_init()` from your init function or constructor, and `tp_text_mixin_finalize()` from your dispose or finalize function.

To use the text mixin as the implementation of TpSvcChannelTypeText, in the function you pass to G_IMPLEMENT_INTERFACE, you should first call `tp_text_mixin_iface_init()`, then call `tp_svc_channel_type_text_implement_send()` to register your implementation of the Send method.

## Functions

### tp_text_mixin_class_get_offset_quark ()

    GQuark
    tp_text_mixin_class_get_offset_quark (void);

`tp_text_mixin_class_get_offset_quark` is deprecated and should not be used in newly-written code.

Use TpMessageMixin instead.

#### Returns

the quark used for storing mixin offset on a GObjectClass

### tp_text_mixin_get_offset_quark ()

    GQuark
    tp_text_mixin_get_offset_quark (void);

`tp_text_mixin_get_offset_quark` is deprecated and should not be used in newly-written code.

Use TpMessageMixin instead.

#### Returns

the quark used for storing mixin offset on a GObject

### tp_text_mixin_class_init ()

    void
    tp_text_mixin_class_init (GObjectClass *obj_cls,
                              glong offset);

`tp_text_mixin_class_init` is deprecated and should not be used in newly-written code.

Use TpMessageMixin instead.

Initialize the text mixin. Should be called from the implementation's class_init function like so:

    1
    2

    tp_text_mixin_class_init ((GObjectClass *) klass,
                              G_STRUCT_OFFSET (SomeObjectClass, text_mixin));

#### Parameters

obj_cls | The class of the implementation that uses this mixin |
offset | The byte offset of the TpTextMixinClass within the class structure |

### tp_text_mixin_init ()

    void
    tp_text_mixin_init (GObject *obj,
                        glong offset,
                        TpHandleRepoIface *contacts_repo);

`tp_text_mixin_init` is deprecated and should not be used in newly-written code.

Use `tp_message_mixin_init()` instead.

Initialize the text mixin. Should be called from the implementation's instance init function like so:

    1
    2
    3

    tp_text_mixin_init ((GObject *) self,
                        G_STRUCT_OFFSET (SomeObject, text_mixin),
                        self->contact_repo);

#### Parameters

obj | An instance of the implementation that uses this mixin |
offset | The byte offset of the TpTextMixin within the object structure |
contacts_repo | The connection's `TP_HANDLE_TYPE_CONTACT` repository |

### tp_text_mixin_set_message_types ()

    void
    tp_text_mixin_set_message_types (GObject *obj,
                                     ...);

`tp_text_mixin_set_message_types` is deprecated and should not be used in newly-written code.

Use TpMessageMixin instead.

Set the supported message types.

#### Parameters

obj | An object with this mixin |
... | guints representing members of TpChannelTextMessageType, terminated by G_MAXUINT |

### tp_text_mixin_finalize ()

    void
    tp_text_mixin_finalize (GObject *obj);

`tp_text_mixin_finalize` is deprecated and should not be used in newly-written code.

Use `tp_message_mixin_finalize()` instead.

Free resources held by the text mixin.

#### Parameters

obj | An object with this mixin. |

### tp_text_mixin_receive_with_flags ()

    gboolean
    tp_text_mixin_receive_with_flags (GObject *obj,
                                      TpChannelTextMessageType type,
                                      TpHandle sender,
                                      time_t timestamp,
                                      const char *text,
                                      TpChannelTextMessageFlags flags);

`tp_text_mixin_receive_with_flags` is deprecated and should not be used in newly-written code.

Use `tp_message_mixin_take_received()` instead.

Add a message to the pending queue and emit Received.

#### Parameters

obj | An object with the text mixin |
type | The type of message received from the underlying protocol |
sender | The handle of the message sender |
timestamp | The time the message was received |
text | The text of the message |
flags | the message's flags |

#### Returns

`TRUE` on success; `FALSE` if the message was lost due to the memory limit.

### tp_text_mixin_receive ()

    gboolean
    tp_text_mixin_receive (GObject *obj,
                           TpChannelTextMessageType type,
                           TpHandle sender,
                           time_t timestamp,
                           const char *text);

`tp_text_mixin_receive` is deprecated and should not be used in newly-written code.

Use `tp_message_mixin_take_received()` instead.

Add a message to the pending queue and emit Received. Exactly equivalent to `tp_text_mixin_receive_with_flags()` with `flags` == 0.

#### Parameters

obj | An object with the text mixin |
type | The type of message received from the underlying protocol |
sender | The handle of the message sender |
timestamp | The time the message was received |
text | The text of the message |

#### Returns

`TRUE` on success; `FALSE` if the message was lost due to the memory limit.

### tp_text_mixin_acknowledge_pending_messages ()

    gboolean
    tp_text_mixin_acknowledge_pending_messages
                                   (GObject *obj,
                                    const GArray *ids,
                                    GError **error);

`tp_text_mixin_acknowledge_pending_messages` is deprecated and should not be used in newly-written code.

Use TpMessageMixin instead.

Implements D-Bus method AcknowledgePendingMessages on interface org.freedesktop.Telepathy.Channel.Type.Text

#### Parameters

obj | An object with this mixin |
ids | An array of guint representing message IDs |
error | Used to return a pointer to a GError detailing any error that occurred, D-Bus will throw the error only if this function returns false. |

#### Returns

TRUE if successful, FALSE if an error was thrown.

### tp_text_mixin_list_pending_messages ()

    gboolean
    tp_text_mixin_list_pending_messages (GObject *obj,
                                         gboolean clear,
                                         GPtrArray **ret,
                                         GError **error);

`tp_text_mixin_list_pending_messages` is deprecated and should not be used in newly-written code.

Use TpMessageMixin instead.

Implements D-Bus method ListPendingMessages on interface org.freedesktop.Telepathy.Channel.Type.Text

#### Parameters

obj | An object with this mixin |
clear | If `TRUE`, delete the pending messages from the queue |
ret | Used to return a pointer to a new GPtrArray of D-Bus structures |
error | Used to return a pointer to a GError detailing any error that occurred, D-Bus will throw the error only if this function returns false. |

#### Returns

TRUE if successful, FALSE if an error was thrown.

### tp_text_mixin_get_message_types ()

    gboolean
    tp_text_mixin_get_message_types (GObject *obj,
                                     GArray **ret,
                                     GError **error);

`tp_text_mixin_get_message_types` is deprecated and should not be used in newly-written code.

Use TpMessageMixin instead.

Return a newly allocated GArray of guint, representing message types taken from TpChannelTextMessageType, through `ret` .

#### Parameters

obj | An object with this mixin |
ret | A pointer to where a GArray of guint will be placed on success |
error | A pointer to where an error will be placed on failure |

#### Returns

`TRUE` on success

### tp_text_mixin_clear ()

    void
    tp_text_mixin_clear (GObject *obj);

`tp_text_mixin_clear` is deprecated and should not be used in newly-written code.

Use `tp_message_mixin_clear()` instead.

Clear the pending message queue, deleting all messages.

#### Parameters

obj | An object with this mixin |

### tp_text_mixin_has_pending_messages ()

    gboolean
    tp_text_mixin_has_pending_messages (GObject *obj,
                                        TpHandle *first_sender);

`tp_text_mixin_has_pending_messages` is deprecated and should not be used in newly-written code.

Use `tp_message_mixin_has_pending_messages()` instead.

Return whether the channel `obj` has unacknowledged messages. If so, and `first_sender` is not `NULL`, the handle of the sender of the first message is placed in it, without incrementing the handle's reference count.

#### Parameters

obj | An object with this mixin |
first_sender | If not `NULL`, used to store the sender of the oldest pending message |

#### Returns

`TRUE` if there are pending messages

### tp_text_mixin_set_rescued ()

    void
    tp_text_mixin_set_rescued (GObject *obj);

`tp_text_mixin_set_rescued` is deprecated and should not be used in newly-written code.

Use `tp_message_mixin_set_rescued()` instead.

Mark all pending messages as having been "rescued" from a channel that previously closed.

#### Parameters

obj | An object with this mixin |

### tp_text_mixin_iface_init ()

    void
    tp_text_mixin_iface_init (gpointer g_iface,
                              gpointer iface_data);

`tp_text_mixin_iface_init` is deprecated and should not be used in newly-written code.

Use `tp_message_mixin_text_iface_init()` instead.

Fill in this mixin's AcknowledgePendingMessages, GetMessageTypes and ListPendingMessages implementations in the given interface vtable. In addition to calling this function during interface initialization, the implementor is expected to call `tp_svc_channel_type_text_implement_send()`, providing a Send implementation.

#### Parameters

g_iface | A pointer to the TpSvcChannelTypeTextClass in an object class |
iface_data | Ignored |

## Types and Values

### struct TpTextMixin

    struct TpTextMixin {
    };

`TpTextMixin` is deprecated and should not be used in newly-written code.

Structure to be included in the instance structure of objects that use this mixin. Initialize it with `tp_text_mixin_init()`.

There are no public fields.

### struct TpTextMixinClass

    struct TpTextMixinClass {
    };

`TpTextMixinClass` is deprecated and should not be used in newly-written code.

Structure to be included in the class structure of objects that use this mixin. Initialize it with `tp_text_mixin_class_init()`.

There are no public fields.

## See Also

TpSvcChannelTypeText