00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __INTERNALS_H__
00021 #define __INTERNALS_H__
00022
00023 #define CTRLPROXY_CORE_BUILD
00024
00025 #ifdef HAVE_CONFIG_H
00026 # include "config.h"
00027 #endif
00028 #ifdef HAVE_UNISTD_H
00029 # include <unistd.h>
00030 #endif
00031 #include <netdb.h>
00032 #include <sys/socket.h>
00033 #include <sys/types.h>
00034 #include <errno.h>
00035 #include <stdio.h>
00036 #include <stdlib.h>
00037 #include <sys/types.h>
00038 #include <string.h>
00039 #include <stdarg.h>
00040 #include <signal.h>
00041 #include <sys/stat.h>
00042 #include <fcntl.h>
00043 #include "ctrlproxy.h"
00044 #include "plugins.h"
00045 #include "local.h"
00046
00047 #define DEFAULT_RECONNECT_INTERVAL 60
00048 #define MIN_SILENT_TIME 60
00049 #define MAX_SILENT_TIME (2*MIN_SILENT_TIME)
00050
00051
00052 void fini_networks(struct global *);
00053 void kill_pending_clients(const char *reason);
00054 gboolean network_set_iochannel(struct irc_network *s, GIOChannel *ioc);
00055
00056
00057 void free_channels(struct irc_network *s);
00058 void network_nick_set_data(struct network_nick *n, const char *nick, const char *username, const char *host);
00059
00060
00061 gboolean init_plugins(const char *dir);
00062
00063
00064 char **get_motd_lines(const char *motd_file);
00065
00066
00067 G_MODULE_EXPORT struct irc_network *load_network(struct global *global, struct network_config *sc);
00068 G_MODULE_EXPORT gboolean load_networks(struct global *, struct ctrlproxy_config *cfg, network_log_fn);
00069 G_MODULE_EXPORT void unload_network(struct irc_network *);
00070 typedef void (*new_network_notify_fn) (struct irc_network *, void *);
00071 G_MODULE_EXPORT struct irc_network *find_network_by_hostname(struct global *global, const char *host, guint16 port, gboolean create);
00072 G_MODULE_EXPORT void register_new_network_notify(struct global *, new_network_notify_fn, void *userdata);
00073
00074
00075 void server_disconnected_hook_execute(struct irc_network *);
00076 void server_connected_hook_execute(struct irc_network *);
00077 gboolean new_client_hook_execute(struct irc_client *c);
00078 void lose_client_hook_execute(struct irc_client *c);
00079 gboolean run_client_filter(struct irc_client *c, const struct irc_line *l, enum data_direction dir);
00080 gboolean run_server_filter(struct irc_network *s, const struct irc_line *l, enum data_direction dir);
00081 gboolean run_log_filter(struct irc_network *s, const struct irc_line *l, enum data_direction dir);
00082 gboolean run_replication_filter(struct irc_network *s, const struct irc_line *l, enum data_direction dir);
00083
00084
00092 G_MODULE_EXPORT G_GNUC_MALLOC struct irc_client *client_init_iochannel(
00093 struct irc_network *net,
00094 GIOChannel *io,
00095 const char *desc);
00096
00097 G_MODULE_EXPORT G_GNUC_MALLOC struct irc_client *client_init(
00098 struct irc_network *net,
00099 struct irc_transport *transport,
00100 const char *desc);
00101
00102 G_MODULE_EXPORT void clients_send(GList *clients, const struct irc_line *, const struct irc_client *exception);
00103 G_MODULE_EXPORT void clients_send_args_ex(GList *clients, const char *hostmask, ...);
00104
00105
00106 gboolean init_log(const char *file);
00107 void log_network_line(const struct irc_network *n, const struct irc_line *l, gboolean incoming);
00108 void log_client_line(const struct irc_client *c, const struct irc_line *l, gboolean incoming);
00109 void handle_network_log(enum log_level level, const struct irc_network *n,
00110 const char *msg);
00111 char *custom_subst(struct irc_network *network,
00112 const char *fmt, const struct irc_line *l,
00113 const char *_identifier,
00114 gboolean case_sensitive, gboolean noslash);
00115
00116
00117 void redirect_record(const struct irc_network *n, struct irc_client *c, const struct irc_line *l);
00118 gboolean redirect_response(struct irc_network *n, const struct irc_line *l);
00119 void redirect_clear(const struct irc_network *n);
00120
00121
00122 gboolean client_try_cache(struct irc_client *c, struct irc_network_state *n, struct irc_line *l);
00123
00124
00125 void init_linestack(struct ctrlproxy_config *);
00126
00127
00128 void network_update_config(struct irc_network_state *ns, struct network_config *nc);
00129 void channel_update_config(struct irc_channel_state *ns, struct channel_config *nc);
00130 void global_update_config(struct global *my_global);
00131
00132
00133 void client_replicate(struct irc_client *);
00134
00135 gboolean init_replication(void);
00136
00137
00138 void free_global(struct global *);
00139 void config_load_notify(struct global *global);
00140 void config_save_notify(struct global *global, const char *);
00141 struct global *load_global(const char *config_dir);
00142 struct global *init_global(void);
00143
00144
00145 void init_nickserv(void);
00146 gboolean nickserv_load(struct global *global);
00147 gboolean nickserv_save(struct global *global, const char *dir);
00148 void nickserv_identify_me(struct irc_network *network, char *nick);
00149
00150
00151 void init_admin(void);
00152 gboolean admin_process_command(struct irc_client *c, struct irc_line *l, int cmdoffset);
00153 void admin_log(enum log_level level, const struct irc_network *n, const struct irc_client *c, const char *data);
00154 gboolean start_admin_socket(struct global *global);
00155 gboolean stop_admin_socket(struct global *global);
00156 gboolean admin_socket_prompt(const char *config_dir);
00157
00158
00159 gboolean create_configuration(const char *config_dir);
00160
00161
00162 gboolean start_unix_socket(struct global *);
00163 gboolean stop_unix_socket(struct global *);
00164
00165
00166 void log_custom_load(struct log_file_config *config);
00167
00168
00169 G_GNUC_MALLOC G_MODULE_EXPORT struct irc_listener *listener_init(struct global *global, struct listener_config *);
00170 void free_listeners(struct global *global);
00171
00172
00173 void auto_away_add(struct global *global, struct auto_away_config *config);
00174
00175
00176
00177 #endif
00178