eventloop.h
Go to the documentation of this file.
1
6 /* purple
7 *
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 */
26 #ifndef _PURPLE_EVENTLOOP_H_
27 #define _PURPLE_EVENTLOOP_H_
28
29 #include <glib.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
38 typedef enum
39 {
40 PURPLE_INPUT_READ = 1 << 0,
41 PURPLE_INPUT_WRITE = 1 << 1
43 } PurpleInputCondition;
44
50 typedef void (*PurpleInputFunction)(gpointer, gint, PurpleInputCondition);
51
53 typedef struct _PurpleEventLoopUiOps PurpleEventLoopUiOps;
54
60 struct _PurpleEventLoopUiOps
61 {
85 guint (*timeout_add)(guint interval, GSourceFunc function, gpointer data);
86
95 gboolean (*timeout_remove)(guint handle);
96
112 guint (*input_add)(int fd, PurpleInputCondition cond,
113 PurpleInputFunction func, gpointer user_data);
114
121 gboolean (*input_remove)(guint handle);
122
123
134 int (*input_get_error)(int fd, int *error);
135
150 guint (*timeout_add_seconds)(guint interval, GSourceFunc function,
151 gpointer data);
152
153 void (*_purple_reserved2)(void);
154 void (*_purple_reserved3)(void);
155 void (*_purple_reserved4)(void);
156 };
157
158 /**************************************************************************/
160 /**************************************************************************/
178 guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data);
179
198 guint purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data);
199
207 gboolean purple_timeout_remove(guint handle);
208
220 guint purple_input_add(int fd, PurpleInputCondition cond,
221 PurpleInputFunction func, gpointer user_data);
222
229 gboolean purple_input_remove(guint handle);
230
245 int
246 purple_input_get_error(int fd, int *error);
247
248
252 /**************************************************************************/
254 /**************************************************************************/
261 void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops);
262
268 PurpleEventLoopUiOps *purple_eventloop_get_ui_ops(void);
269
272 #ifdef __cplusplus
273 }
274 #endif
275
276 #endif /* _PURPLE_EVENTLOOP_H_ */
purple_eventloop_set_ui_ops
void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops)
Sets the UI operations structure to be used for accounts.
purple_input_get_error
int purple_input_get_error(int fd, int *error)
Get the current error status for an input.
_PurpleEventLoopUiOps::input_remove
gboolean(* input_remove)(guint handle)
Should remove an input handler.
Definition: eventloop.h:121
PURPLE_INPUT_WRITE
A write condition.
Definition: eventloop.h:41
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
_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_input_remove
gboolean purple_input_remove(guint handle)
Removes an input handler.
PURPLE_INPUT_READ
A read condition.
Definition: eventloop.h:40
_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
_PurpleEventLoopUiOps
An abstraction of an application&#39;s mainloop; libpurple will use this to watch file descriptors and sc...
Definition: eventloop.h:60
_PurpleEventLoopUiOps::input_add
guint(* input_add)(int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer user_data)
Should add an input handler.
Definition: eventloop.h:112
PurpleInputCondition
PurpleInputCondition
An input condition.
Definition: eventloop.h:38
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.
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_timeout_add
guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data)
Creates a callback timer.
_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_timeout_add_seconds
guint purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data)
Creates a callback timer.