## InfGtkChat InfGtkChat — Gtk interface to InfChatSession |

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <libinfgtk/inf-gtk-chat.h>

                        InfGtkChat;
    GtkWidget *         inf_gtk_chat_new                    (void);
    void                inf_gtk_chat_set_session            (InfGtkChat *chat,
                                                             InfChatSession *session);
    void                inf_gtk_chat_set_active_user        (InfGtkChat *chat,
                                                             InfUser *user);
    GtkWidget *         inf_gtk_chat_get_entry              (InfGtkChat *chat);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBox
                                     +----GtkVBox
                                           +----InfGtkChat

## Implemented Interfaces

InfGtkChat implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Properties

      "active-user"              InfUser*              : Read / Write
      "session"                  InfChatSession*       : Read / Write

## Description

InfGtkChat is a widget showing a InfChatSession conversation. Use `inf_gtk_chat_set_session()` to set the session whose conversation to show in the widget. If you have a local user in the session you can also call `inf_gtk_chat_set_active_user()`. In this case the input text entry is made available and messages are sent via that user.

## Details

### InfGtkChat

    typedef struct _InfGtkChat InfGtkChat;

InfGtkChat is an opaque data type. You should only access it via the public API functions.

### inf_gtk_chat_new ()

    GtkWidget *         inf_gtk_chat_new                    (void);

Creates a new InfGtkChat. To show a chat conversation set a session to show via `inf_gtk_chat_set_session()`.

Returns : | A new InfGtkChat.

### inf_gtk_chat_set_session ()

    void                inf_gtk_chat_set_session            (InfGtkChat *chat,
                                                             InfChatSession *session);

Sets the chat session to show in the chat widget. If there is a previous session set the chat view will be cleared before showing the new session. If the previous session had an active user set it will be unset. If `session` is `NULL` this function just clears the chat view and unsets the active user, if any.

`chat` : | A InfGtkChat.
`session` : | The InfChatSession to set.

### inf_gtk_chat_set_active_user ()

    void                inf_gtk_chat_set_active_user        (InfGtkChat *chat,
                                                             InfUser *user);

Sets the active user for the chat. This must be a user in the chat's session's user table and it must have the `INF_USER_LOCAL` flag set, i.e. you need to have it joined before using `infc_session_proxy_join_user()` or `infd_session_proxy_add_user()`.

If an active user is set the chat's text entry is made sensitive and the user can type chat messages. They are sent to the session as originated by `user`. If `user`'s status changes to `INF_USER_UNAVAILABLE` or the `INF_USER_LOCAL` flag is removed the active user will be unset automatically.

This cannot be called when the chat has no session set yet. Use `inf_gtk_chat_set_session()` first.

`chat` : | A InfGtkChat.
`user` : | A local InfUser which joined chat's session.

### inf_gtk_chat_get_entry ()

    GtkWidget *         inf_gtk_chat_get_entry              (InfGtkChat *chat);

Returns the chat's text input entry.

`chat` : | A InfGtkChat.
Returns : | The chat's GtkEntry. This is owned by the chat, so you don't need to free it.

## Property Details

### The `"active-user"` property

      "active-user"              InfUser*              : Read / Write

The user outgoing messages come from.

### The `"session"` property

      "session"                  InfChatSession*       : Read / Write

The chat session this widget is displaying.