1 /********************************************************************\
2 * BitlBee -- An IRC to other IM-networks gateway *
4 * Copyright 2002-2004 Wilmer van der Gaast and others *
5 \********************************************************************/
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
34 #define _GNU_SOURCE /* Stupid GNU :-P */
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
55 #include <sys/types.h>
70 /* The following functions should not be used if we want to maintain Windows compatibility... */
72 #define free __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
74 #define malloc __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
76 #define calloc __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
78 #define realloc __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
80 #define strdup __PLEASE_USE_THE_GLIB_STRDUP_FUNCTIONS_SYSTEM__
82 #define strndup __PLEASE_USE_THE_GLIB_STRDUP_FUNCTIONS_SYSTEM__
84 #define snprintf __PLEASE_USE_G_SNPRINTF__
86 #define strcasecmp __PLEASE_USE_G_STRCASECMP__
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. */
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__
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__
105 #define g_main_run __PLEASE_USE_B_MAIN_RUN__
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
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"
146 #include "commands.h"
157 typedef struct global
{
158 /* In forked mode, child processes store the fd of the IPC socket here. */
160 gint listen_watch_source_id
;
164 GList
*storage
; /* The first backend in the list will be used for saving */
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
;