pidgin: _PurpleEventLoopUiOps Struct Reference

pidgin 2.14.4

Loading...
Searching...
No Matches
Data Fields
_PurpleEventLoopUiOps Struct Reference

An abstraction of an application's mainloop; libpurple will use this to watch file descriptors and schedule timed callbacks. More...

`#include <eventloop.h>`

## Data Fields
guint(* | timeout_add )(guint interval, GSourceFunc function, gpointer data)
| Should create a callback timer with an interval measured in milliseconds.
gboolean(* | timeout_remove )(guint handle)
| Should remove a callback timer.
guint(* | input_add )(int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer user_data)
| Should add an input handler.
gboolean(* | input_remove )(guint handle)
| Should remove an input handler.
int(* | input_get_error )(int fd, int *error)
| If implemented, should get the current error status for an input.
guint(* | timeout_add_seconds )(guint interval, GSourceFunc function, gpointer data)
| If implemented, should create a callback timer with an interval measured in seconds.
void(* | _purple_reserved2 )(void)
void(* | _purple_reserved3 )(void)
void(* | _purple_reserved4 )(void)

## Detailed Description

An abstraction of an application's mainloop; libpurple will use this to watch file descriptors and schedule timed callbacks.

If your application uses the glib mainloop, there is an implementation of this struct in `libpurple/example/nullclient.c` which you can use verbatim.

Definition at line 60 of file eventloop.h.

## Field Documentation

## ◆ _purple_reserved2

void(* _PurpleEventLoopUiOps::_purple_reserved2) (void)

Definition at line 153 of file eventloop.h.

## ◆ _purple_reserved3

void(* _PurpleEventLoopUiOps::_purple_reserved3) (void)

Definition at line 154 of file eventloop.h.

## ◆ _purple_reserved4

void(* _PurpleEventLoopUiOps::_purple_reserved4) (void)

Definition at line 155 of file eventloop.h.

## ◆ input_add

guint(* _PurpleEventLoopUiOps::input_add) (int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer user_data)

Should add an input handler.

Analogous to g_io_add_watch_full in glib.

Parameters

  fd | a file descriptor to watch for events
  cond | a bitwise OR of events on fd for which func should be called.
  func | a callback to fire whenever a relevant event on fd occurs.
  user_data | arbitrary data to pass to fd.

Returns
  an identifier for this input handler, which can be passed to input_remove.

See also
  purple_input_add

Definition at line 112 of file eventloop.h.

## ◆ input_get_error

int(* _PurpleEventLoopUiOps::input_get_error) (int fd, int *error)

If implemented, should get the current error status for an input.

Implementation of this UI op is optional. Implement it if the UI's sockets or event loop needs to customize determination of socket error status. If unimplemented, `getsockopt(2)` will be used instead.

See also
  purple_input_get_error

Definition at line 134 of file eventloop.h.

## ◆ input_remove

gboolean(* _PurpleEventLoopUiOps::input_remove) (guint handle)

Should remove an input handler.

Analogous to g_source_remove in glib.

Parameters

  handle | an identifier, as returned by input_add.

Returns
  `TRUE` if the input handler was found and removed.

See also
  purple_input_remove

Definition at line 121 of file eventloop.h.

## ◆ timeout_add

guint(* _PurpleEventLoopUiOps::timeout_add) (guint interval, GSourceFunc function, gpointer data)

Should create a callback timer with an interval measured in milliseconds.

The supplied function should be called every interval seconds until it returns `FALSE`, after which it should not be called again.

Analogous to g_timeout_add in glib.

Note: On Win32, this function may be called from a thread other than the libpurple thread. You should make sure to detect this situation and to only call "function" from the libpurple thread.

Parameters

  interval | the interval in milliseconds between calls to function.
  data | arbitrary data to be passed to function at each call.

Todo:
  Who is responsible for freeing data?

Returns
  a handle for the timeout, which can be passed to timeout_remove.

See also
  purple_timeout_add

Definition at line 85 of file eventloop.h.

## ◆ timeout_add_seconds

guint(* _PurpleEventLoopUiOps::timeout_add_seconds) (guint interval, GSourceFunc function, gpointer data)

If implemented, should create a callback timer with an interval measured in seconds.

Analogous to g_timeout_add_seconds in glib.

This allows UIs to group timers for better power efficiency. For this reason, interval may be rounded by up to a second.

Implementation of this UI op is optional. If it's not implemented, calls to purple_timeout_add_seconds() will be serviced by timeout_add.

See also
  purple_timeout_add_seconds()

Since
  2.1.0

Definition at line 150 of file eventloop.h.

## ◆ timeout_remove

gboolean(* _PurpleEventLoopUiOps::timeout_remove) (guint handle)

Should remove a callback timer.

Analogous to g_source_remove in glib.

Parameters

  handle | an identifier for a timeout, as returned by timeout_add.

Returns
  `TRUE` if the timeout identified by handle was found and removed.

See also
  purple_timeout_remove

Definition at line 95 of file eventloop.h.

The documentation for this struct was generated from the following file:

- eventloop.h