CM.Callback
Description: Reference for CM.Callback

### Function

# CMCallback

#### Declaration

    void
    (* CmCallback) (
      CmClient* self,
      CmRoom* room,
      GPtrArray* events,
      GError* err,
      gpointer user_data
    )

#### Description [src]

Type definition for the function that will be called when the client sees new events.

Usually you don’t do much in this callback. The `items-changed` signals of the list models returned from e.g. `cm_client_get_joined_rooms()` or `cm_room_get_events_list()` are easier to use.

The `GMainContext` for these operations isn’t well defined atm, see https://source.puri.sm/Librem5/libcmatrix/-/issues/24.

#### Parameters

`self`

  Type: `CmClient`

  The client that received the events.

  The data is owned by the caller of the function.

`room`

  Type: `CmRoom`

  The room (if any) the events belong to.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`events`

  Type: An array of `None`

  The events.

  The data is owned by the caller of the function.

`err`

  Type: `GError`

  A recoverable error.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`user_data`

  Type: `gpointer`

  The user data passed in `cm_client_set_sync_callback()`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.