00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CTRLPROXY_H__
00021 #define __CTRLPROXY_H__
00022
00023 #include <stdlib.h>
00024 #include <string.h>
00025 #include <time.h>
00026 #include <stdarg.h>
00027 #include <glib.h>
00028 #include <gmodule.h>
00029
00033 #define CTRLPROXY_PLUGIN_VERSION 4
00034
00040 #if defined(STRICT_MEMORY_ALLOCS) && !defined(SWIGPYTHON)
00041 #define calloc(a,b) __ERROR_USE_G_NEW0__
00042 #define malloc(a) __ERROR_USE_G_MALLOC_OR_G_NEW__
00043 #define realloc(a,b) __ERROR_USE_G_REALLOC_OR_G_RE_NEW__
00044 #define free(a) __ERROR_USE_G_FREE__
00045 #undef strdup
00046 #define strdup(a) __ERROR_USE_G_STRDUP__
00047 #undef strndup
00048 #define strndup(a) __ERROR_USE_G_STRNDUP__
00049 #endif
00050
00051 #ifndef G_MODULE_EXPORT
00052 #define G_MODULE_EXPORT
00053 #endif
00054
00055 #include "settings.h"
00056 #include "network.h"
00057 #include "util.h"
00058 #include "client.h"
00059 #include "state.h"
00060 #include "linestack.h"
00061 #include "hooks.h"
00062 #include "repl.h"
00063 #include "ctcp.h"
00064 #include "admin.h"
00065 #include "log.h"
00066 #include "isupport.h"
00067 #include "log_support.h"
00068 #include "listener.h"
00069 #include "url.h"
00070
00074 struct global {
00075 struct ctrlproxy_config *config;
00076 GList *new_network_notifiers;
00077 GList *networks;
00078 GList *nickserv_nicks;
00079 GList *listeners;
00080
00081 GIOChannel *unix_incoming;
00082 gint unix_incoming_id;
00083
00084 GIOChannel *admin_incoming;
00085 gint admin_incoming_id;
00086 };
00087
00091 struct plugin_ops {
00093 int version;
00095 char *name;
00097 gboolean (*init) (void);
00098 };
00099
00100
00101 G_MODULE_EXPORT const char *ctrlproxy_version(void);
00102 G_MODULE_EXPORT const char *get_my_hostname(void);
00103
00104 typedef void (*config_load_notify_fn) (struct global *);
00105 typedef void (*config_save_notify_fn) (struct global *, const char *);
00106 G_MODULE_EXPORT void register_load_config_notify(config_load_notify_fn fn);
00107 G_MODULE_EXPORT void register_save_config_notify(config_save_notify_fn fn);
00108
00109 typedef void (*hup_handler_fn) (void *);
00110 G_MODULE_EXPORT void register_hup_handler(hup_handler_fn, void *userdata);
00111
00112
00113 G_MODULE_EXPORT char *list_make_string(GList *);
00114
00115
00116
00117 G_GNUC_PRINTF(3, 4) G_MODULE_EXPORT void log_network_state(enum log_level l, const struct irc_network_state *st, const char *fmt, ...);
00118
00119 gboolean rep_g_file_get_contents (const gchar *filename,
00120 gchar **contents,
00121 gsize *length,
00122 GError **error);
00123 gboolean rep_g_file_set_contents (const gchar *filename,
00124 const gchar *contents,
00125 gssize length,
00126 GError **error);
00127 int rep_g_mkdir_with_parents (const gchar *pathname, int mode);
00128
00129
00130 #if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 8
00131 #define g_file_get_contents rep_g_file_get_contents
00132 #define g_file_set_contents rep_g_file_set_contents
00133 #define g_mkdir_with_parents rep_g_mkdir_with_parents
00134 #define G_GNUC_NULL_TERMINATED
00135 #endif
00136 #if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 10
00137 #define G_GNUC_WARN_UNUSED_RESULT
00138 #endif
00139 gboolean write_pidfile(const char *filename);
00140 pid_t read_pidfile(const char *filename);
00141
00142 #endif