Shut up a flood of GLib-related compiler warnings.
[bitlbee.git] / bitlbee.h
blob13f3fda5508d5a263e71f6575497edc82b5730d9
1 /********************************************************************\
2 * BitlBee -- An IRC to other IM-networks gateway *
3 * *
4 * Copyright 2002-2004 Wilmer van der Gaast and others *
5 \********************************************************************/
7 /* Main file */
9 /*
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License with
21 the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
22 if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23 Suite 330, Boston, MA 02111-1307 USA
26 #ifndef _BITLBEE_H
27 #define _BITLBEE_H
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 #ifndef _GNU_SOURCE
34 #define _GNU_SOURCE /* Stupid GNU :-P */
35 #endif
37 /* Depend on Windows 2000 for now since we need getaddrinfo() */
38 #define _WIN32_WINNT 0x0501
40 #define PACKAGE "BitlBee"
41 #define BITLBEE_VERSION "3.0.5"
42 #define VERSION BITLBEE_VERSION
43 #define BITLBEE_VER(a,b,c) (((a) << 16) + ((b) << 8) + (c))
44 #define BITLBEE_VERSION_CODE BITLBEE_VER(3, 0, 5)
46 #define MAX_STRING 511
48 #if HAVE_CONFIG_H
49 #include <config.h>
50 #endif
52 #include <fcntl.h>
53 #include <time.h>
54 #include <sys/stat.h>
55 #include <sys/types.h>
56 #include <stdlib.h>
57 #include <string.h>
58 #include <stdarg.h>
59 #include <stdio.h>
60 #include <ctype.h>
61 #include <errno.h>
63 #ifndef _WIN32
64 #include <syslog.h>
65 #endif
67 #include <glib.h>
68 #include <gmodule.h>
70 /* The following functions should not be used if we want to maintain Windows compatibility... */
71 #undef free
72 #define free __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
73 #undef malloc
74 #define malloc __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
75 #undef calloc
76 #define calloc __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
77 #undef realloc
78 #define realloc __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
79 #undef strdup
80 #define strdup __PLEASE_USE_THE_GLIB_STRDUP_FUNCTIONS_SYSTEM__
81 #undef strndup
82 #define strndup __PLEASE_USE_THE_GLIB_STRDUP_FUNCTIONS_SYSTEM__
83 #undef snprintf
84 #define snprintf __PLEASE_USE_G_SNPRINTF__
85 #undef strcasecmp
86 #define strcasecmp __PLEASE_USE_G_STRCASECMP__
87 #undef strncasecmp
88 #define strncasecmp __PLEASE_USE_G_STRNCASECMP__
90 /* And the following functions shouldn't be used anymore to keep compatibility
91 with other event handling libs than GLib. */
92 #undef g_timeout_add
93 #define g_timeout_add __PLEASE_USE_B_TIMEOUT_ADD__
94 #undef g_timeout_add_full
95 #define g_timeout_add_full __PLEASE_USE_B_TIMEOUT_ADD__
96 #undef g_io_add_watch
97 #define g_io_add_watch __PLEASE_USE_B_INPUT_ADD__
98 #undef g_io_add_watch_full
99 #define g_io_add_watch_full __PLEASE_USE_B_INPUT_ADD__
100 #undef g_source_remove
101 #define g_source_remove __PLEASE_USE_B_EVENT_REMOVE__
102 #undef g_source_remove_by_user_data
103 #define g_source_remove_by_user_data __PLEASE_USE_B_SOURCE_REMOVE_BY_USER_DATA__
104 #undef g_main_run
105 #define g_main_run __PLEASE_USE_B_MAIN_RUN__
106 #undef g_main_quit
107 #define g_main_quit __PLEASE_USE_B_MAIN_QUIT__
109 /* And now, because GLib folks think everyone loves typing ridiculously long
110 function names ... no I don't or I'd write BitlBee in Java, ffs. */
111 #define g_strcasecmp g_ascii_strcasecmp
112 #define g_strncasecmp g_ascii_strncasecmp
114 #ifndef G_GNUC_MALLOC
115 /* Doesn't exist in GLib <=2.4 while everything else in BitlBee should
116 work with it, so let's fake this one. */
117 #define G_GNUC_MALLOC
118 #endif
120 #define _( x ) x
122 #define ROOT_NICK "root"
123 #define ROOT_CHAN "&bitlbee"
124 #define ROOT_FN "User manager"
126 #define NS_NICK "NickServ"
128 #define DEFAULT_AWAY "Away from computer"
129 #define CONTROL_TOPIC "Welcome to the control channel. Type \2help\2 for help information."
130 #define IRCD_INFO PACKAGE " <http://www.bitlbee.org/>"
132 #define MAX_NICK_LENGTH 24
134 #define HELP_FILE VARDIR "help.txt"
135 #define CONF_FILE_DEF ETCDIR "bitlbee.conf"
137 /* Hack to give a little bit more password security on IRC: If an account has
138 this password set, use /OPER to change it. */
139 #define PASSWORD_PENDING "\r\rchangeme\r\r"
141 #include "bee.h"
142 #include "irc.h"
143 #include "storage.h"
144 #include "set.h"
145 #include "nogaim.h"
146 #include "commands.h"
147 #include "account.h"
148 #include "nick.h"
149 #include "conf.h"
150 #include "log.h"
151 #include "ini.h"
152 #include "query.h"
153 #include "sock.h"
154 #include "misc.h"
155 #include "proxy.h"
157 typedef struct global {
158 /* In forked mode, child processes store the fd of the IPC socket here. */
159 int listen_socket;
160 gint listen_watch_source_id;
161 struct help *help;
162 char *conf_file;
163 conf_t *conf;
164 GList *storage; /* The first backend in the list will be used for saving */
165 char *helpfile;
166 int restart;
167 } global_t;
169 int bitlbee_daemon_init( void );
170 int bitlbee_inetd_init( void );
172 gboolean bitlbee_io_current_client_read( gpointer data, gint source, b_input_condition cond );
173 gboolean bitlbee_io_current_client_write( gpointer data, gint source, b_input_condition cond );
175 void root_command_string( irc_t *irc, char *command );
176 void root_command( irc_t *irc, char *command[] );
177 gboolean root_command_add( const char *command, int params, void (*func)(irc_t *, char **args), int flags );
178 gboolean cmd_identify_finish( gpointer data, gint fd, b_input_condition cond );
179 gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond );
181 char *set_eval_root_nick( set_t *set, char *new_nick );
182 char *set_eval_control_channel( set_t *set, char *new_name );
184 extern global_t global;
186 #ifdef __cplusplus
188 #endif
190 #endif