1 | /* |
---|
2 | * nogaim |
---|
3 | * |
---|
4 | * Copyright (C) 2006 Wilmer van der Gaast and others |
---|
5 | * |
---|
6 | * This program is free software; you can redistribute it and/or modify |
---|
7 | * it under the terms of the GNU General Public License as published by |
---|
8 | * the Free Software Foundation; either version 2 of the License, or |
---|
9 | * (at your option) any later version. |
---|
10 | * |
---|
11 | * This program is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | * GNU General Public License for more details. |
---|
15 | * |
---|
16 | * You should have received a copy of the GNU General Public License |
---|
17 | * along with this program; if not, write to the Free Software |
---|
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
19 | * |
---|
20 | */ |
---|
21 | |
---|
22 | /* |
---|
23 | * Split off the event handling things from proxy.[ch] (and adding timer |
---|
24 | * stuff. This to allow BitlBee to use other libs than GLib for event |
---|
25 | * handling. |
---|
26 | */ |
---|
27 | |
---|
28 | |
---|
29 | #ifndef _EVENTS_H_ |
---|
30 | #define _EVENTS_H_ |
---|
31 | |
---|
32 | #include <sys/types.h> |
---|
33 | #ifndef _WIN32 |
---|
34 | #include <sys/socket.h> |
---|
35 | #include <netdb.h> |
---|
36 | #include <netinet/in.h> |
---|
37 | #endif |
---|
38 | #include <glib.h> |
---|
39 | #include <gmodule.h> |
---|
40 | |
---|
41 | typedef enum { |
---|
42 | GAIM_INPUT_READ = 1 << 1, |
---|
43 | GAIM_INPUT_WRITE = 1 << 2 |
---|
44 | } b_input_condition; |
---|
45 | typedef gboolean (*b_event_handler)(gpointer data, gint fd, b_input_condition cond); |
---|
46 | |
---|
47 | #define GAIM_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) |
---|
48 | #define GAIM_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) |
---|
49 | #define GAIM_ERR_COND (G_IO_HUP | G_IO_ERR | G_IO_NVAL) |
---|
50 | |
---|
51 | #define event_debug( x... ) printf( x ) |
---|
52 | // #define event_debug( x... ) |
---|
53 | |
---|
54 | G_MODULE_EXPORT void b_main_init(); |
---|
55 | G_MODULE_EXPORT void b_main_run(); |
---|
56 | G_MODULE_EXPORT void b_main_quit(); |
---|
57 | |
---|
58 | G_MODULE_EXPORT gint b_input_add(int fd, b_input_condition cond, b_event_handler func, gpointer data); |
---|
59 | G_MODULE_EXPORT gint b_timeout_add(gint timeout, b_event_handler func, gpointer data); |
---|
60 | G_MODULE_EXPORT void b_event_remove(gint id); |
---|
61 | G_MODULE_EXPORT gboolean b_event_remove_by_data(gpointer data); |
---|
62 | |
---|
63 | #endif /* _EVENTS_H_ */ |
---|