[ecf8fa8] | 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 << 0, |
---|
| 43 | GAIM_INPUT_WRITE = 1 << 1 |
---|
[ba9edaa] | 44 | } b_input_condition; |
---|
| 45 | typedef gboolean (*b_event_handler)(gpointer data, gint fd, b_input_condition cond); |
---|
[ecf8fa8] | 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 | |
---|
[fc2ee0f] | 51 | #define event_debug( x... ) printf( x ) |
---|
| 52 | |
---|
[ba9edaa] | 53 | G_MODULE_EXPORT void b_main_init(); |
---|
| 54 | G_MODULE_EXPORT void b_main_run(); |
---|
| 55 | G_MODULE_EXPORT void b_main_quit(); |
---|
[ecf8fa8] | 56 | |
---|
[ba9edaa] | 57 | G_MODULE_EXPORT gint b_input_add(int fd, b_input_condition cond, b_event_handler func, gpointer data); |
---|
| 58 | G_MODULE_EXPORT gint b_timeout_add(gint timeout, b_event_handler func, gpointer data); |
---|
| 59 | G_MODULE_EXPORT void b_event_remove(gint id); |
---|
| 60 | G_MODULE_EXPORT gboolean b_event_remove_by_data(gpointer data); |
---|
[ecf8fa8] | 61 | |
---|
| 62 | #endif /* _EVENTS_H_ */ |
---|