eventloop.h
Go to the documentation of this file.
/* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifndef _PURPLE_EVENTLOOP_H_
#define _PURPLE_EVENTLOOP_H_
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
PURPLE_INPUT_READ = 1 << 0,
PURPLE_INPUT_WRITE = 1 << 1
} PurpleInputCondition;
typedef void (*PurpleInputFunction)(gpointer, gint, PurpleInputCondition);
typedef struct _PurpleEventLoopUiOps PurpleEventLoopUiOps;
struct _PurpleEventLoopUiOps
{
guint (*timeout_add)(guint interval, GSourceFunc function, gpointer data);
gboolean (*timeout_remove)(guint handle);
guint (*input_add)(int fd, PurpleInputCondition cond,
PurpleInputFunction func, gpointer user_data);
gboolean (*input_remove)(guint handle);
int (*input_get_error)(int fd, int *error);
guint (*timeout_add_seconds)(guint interval, GSourceFunc function,
gpointer data);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
void (*_purple_reserved4)(void);
};
/**************************************************************************/
/**************************************************************************/
guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data);
guint purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data);
gboolean purple_timeout_remove(guint handle);
guint purple_input_add(int fd, PurpleInputCondition cond,
PurpleInputFunction func, gpointer user_data);
gboolean purple_input_remove(guint handle);
int
purple_input_get_error(int fd, int *error);
/**************************************************************************/
/**************************************************************************/
void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops);
PurpleEventLoopUiOps *purple_eventloop_get_ui_ops(void);
#ifdef __cplusplus
}
#endif
#endif /* _PURPLE_EVENTLOOP_H_ */
purple_timeout_add
guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data)
Creates a callback timer.
_PurpleEventLoopUiOps::input_remove
gboolean(* input_remove)(guint handle)
Should remove an input handler.
Definition: eventloop.h:121
purple_eventloop_set_ui_ops
void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops)
Sets the UI operations structure to be used for accounts.
_PurpleEventLoopUiOps::timeout_add
guint(* timeout_add)(guint interval, GSourceFunc function, gpointer data)
Should create a callback timer with an interval measured in milliseconds.
Definition: eventloop.h:85
purple_timeout_add_seconds
guint purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data)
Creates a callback timer.
_PurpleEventLoopUiOps::input_get_error
int(* input_get_error)(int fd, int *error)
If implemented, should get the current error status for an input.
Definition: eventloop.h:134
PurpleInputFunction
void(* PurpleInputFunction)(gpointer, gint, PurpleInputCondition)
The type of callbacks to handle events on file descriptors, as passed to purple_input_add().
Definition: eventloop.h:50
purple_input_add
guint purple_input_add(int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer user_data)
Adds an input handler.
_PurpleEventLoopUiOps::timeout_remove
gboolean(* timeout_remove)(guint handle)
Should remove a callback timer.
Definition: eventloop.h:95
PurpleInputCondition
PurpleInputCondition
An input condition.
Definition: eventloop.h:38
purple_input_get_error
int purple_input_get_error(int fd, int *error)
Get the current error status for an input.
PURPLE_INPUT_READ
A read condition.
Definition: eventloop.h:40
_PurpleEventLoopUiOps::input_add
guint(* input_add)(int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer user_data)
Should add an input handler.
Definition: eventloop.h:112
purple_input_remove
gboolean purple_input_remove(guint handle)
Removes an input handler.
purple_eventloop_get_ui_ops
PurpleEventLoopUiOps * purple_eventloop_get_ui_ops(void)
Returns the UI operations structure used for accounts.
purple_timeout_remove
gboolean purple_timeout_remove(guint handle)
Removes a timeout handler.
_PurpleEventLoopUiOps::timeout_add_seconds
guint(* timeout_add_seconds)(guint interval, GSourceFunc function, gpointer data)
If implemented, should create a callback timer with an interval measured in seconds.
Definition: eventloop.h:150
PURPLE_INPUT_WRITE
A write condition.
Definition: eventloop.h:41
_PurpleEventLoopUiOps
An abstraction of an application's mainloop; libpurple will use this to watch file descriptors and sc...
Definition: eventloop.h:60