1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-12-21 23:28:51 -05:00

Revert "Proof-of-concept compat mode for XChat"

This reverts commit ad16a2bfee.
This commit is contained in:
Berke Viktor 2012-10-30 06:56:41 +01:00
parent ad16a2bfee
commit 81747d996c
6 changed files with 78 additions and 751 deletions

View File

@ -42,7 +42,6 @@ typedef struct _xchat_context xchat_context;
struct _xchat_plugin
{
/* these are only used on win32 */
#ifdef XCHAT_PLUGIN_COMPAT
xchat_hook *(*xchat_hook_command) (xchat_plugin *ph,
const char *name,
int pri,
@ -138,122 +137,25 @@ struct _xchat_plugin
int flags);
void (*xchat_free) (xchat_plugin *ph,
void *ptr);
#endif /* XCHAT_PLUGIN_COMPAT */
xchat_hook *(*hexchat_hook_command) (xchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
const char *help_text,
void *userdata);
xchat_hook *(*hexchat_hook_server) (xchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
void *userdata);
xchat_hook *(*hexchat_hook_print) (xchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], void *user_data),
void *userdata);
xchat_hook *(*hexchat_hook_timer) (xchat_plugin *ph,
int timeout,
int (*callback) (void *user_data),
void *userdata);
xchat_hook *(*hexchat_hook_fd) (xchat_plugin *ph,
int fd,
int flags,
int (*callback) (int fd, int flags, void *user_data),
void *userdata);
void *(*hexchat_unhook) (xchat_plugin *ph,
xchat_hook *hook);
void (*hexchat_print) (xchat_plugin *ph,
const char *text);
void (*hexchat_printf) (xchat_plugin *ph,
const char *format, ...);
void (*hexchat_command) (xchat_plugin *ph,
const char *command);
void (*hexchat_commandf) (xchat_plugin *ph,
const char *format, ...);
int (*hexchat_nickcmp) (xchat_plugin *ph,
const char *s1,
const char *s2);
int (*hexchat_set_context) (xchat_plugin *ph,
xchat_context *ctx);
xchat_context *(*hexchat_find_context) (xchat_plugin *ph,
const char *servname,
const char *channel);
xchat_context *(*hexchat_get_context) (xchat_plugin *ph);
const char *(*hexchat_get_info) (xchat_plugin *ph,
const char *id);
int (*hexchat_get_prefs) (xchat_plugin *ph,
const char *name,
const char **string,
int *integer);
xchat_list * (*hexchat_list_get) (xchat_plugin *ph,
const char *name);
void (*hexchat_list_free) (xchat_plugin *ph,
xchat_list *xlist);
const char * const * (*hexchat_list_fields) (xchat_plugin *ph,
const char *name);
int (*hexchat_list_next) (xchat_plugin *ph,
xchat_list *xlist);
const char * (*hexchat_list_str) (xchat_plugin *ph,
xchat_list *xlist,
const char *name);
int (*hexchat_list_int) (xchat_plugin *ph,
xchat_list *xlist,
const char *name);
void * (*hexchat_plugingui_add) (xchat_plugin *ph,
const char *filename,
const char *name,
const char *desc,
const char *version,
char *reserved);
void (*hexchat_plugingui_remove) (xchat_plugin *ph,
void *handle);
int (*hexchat_emit_print) (xchat_plugin *ph,
const char *event_name, ...);
int (*hexchat_read_fd) (xchat_plugin *ph,
void *src,
char *buf,
int *len);
time_t (*hexchat_list_time) (xchat_plugin *ph,
xchat_list *xlist,
const char *name);
char *(*hexchat_gettext) (xchat_plugin *ph,
const char *msgid);
void (*hexchat_send_modes) (xchat_plugin *ph,
const char **targets,
int ntargets,
int modes_per_line,
char sign,
char mode);
char *(*hexchat_strip) (xchat_plugin *ph,
const char *str,
int len,
int flags);
void (*hexchat_free) (xchat_plugin *ph,
void *ptr);
int (*hexchat_pluginpref_set_str) (xchat_plugin *ph,
int (*xchat_pluginpref_set_str) (xchat_plugin *ph,
const char *var,
const char *value);
int (*hexchat_pluginpref_get_str) (xchat_plugin *ph,
int (*xchat_pluginpref_get_str) (xchat_plugin *ph,
const char *var,
char *dest);
int (*hexchat_pluginpref_set_int) (xchat_plugin *ph,
int (*xchat_pluginpref_set_int) (xchat_plugin *ph,
const char *var,
int value);
int (*hexchat_pluginpref_get_int) (xchat_plugin *ph,
int (*xchat_pluginpref_get_int) (xchat_plugin *ph,
const char *var);
int (*hexchat_pluginpref_delete) (xchat_plugin *ph,
int (*xchat_pluginpref_delete) (xchat_plugin *ph,
const char *var);
int (*hexchat_pluginpref_list) (xchat_plugin *ph,
int (*xchat_pluginpref_list) (xchat_plugin *ph,
char *dest);
};
#endif
#ifdef XCHAT_PLUGIN_COMPAT
xchat_hook *
xchat_hook_command (xchat_plugin *ph,
const char *name,
@ -404,190 +306,37 @@ xchat_strip (xchat_plugin *ph,
void
xchat_free (xchat_plugin *ph,
void *ptr);
#endif /* XCHAT_PLUGIN_COMPAT */
xchat_hook *
hexchat_hook_command (xchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
const char *help_text,
void *userdata);
xchat_hook *
hexchat_hook_server (xchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
void *userdata);
xchat_hook *
hexchat_hook_print (xchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], void *user_data),
void *userdata);
xchat_hook *
hexchat_hook_timer (xchat_plugin *ph,
int timeout,
int (*callback) (void *user_data),
void *userdata);
xchat_hook *
hexchat_hook_fd (xchat_plugin *ph,
int fd,
int flags,
int (*callback) (int fd, int flags, void *user_data),
void *userdata);
void *
hexchat_unhook (xchat_plugin *ph,
xchat_hook *hook);
void
hexchat_print (xchat_plugin *ph,
const char *text);
void
hexchat_printf (xchat_plugin *ph,
const char *format, ...);
void
hexchat_command (xchat_plugin *ph,
const char *command);
void
hexchat_commandf (xchat_plugin *ph,
const char *format, ...);
int
hexchat_nickcmp (xchat_plugin *ph,
const char *s1,
const char *s2);
int
hexchat_set_context (xchat_plugin *ph,
xchat_context *ctx);
xchat_context *
hexchat_find_context (xchat_plugin *ph,
const char *servname,
const char *channel);
xchat_context *
hexchat_get_context (xchat_plugin *ph);
const char *
hexchat_get_info (xchat_plugin *ph,
const char *id);
int
hexchat_get_prefs (xchat_plugin *ph,
const char *name,
const char **string,
int *integer);
xchat_list *
hexchat_list_get (xchat_plugin *ph,
const char *name);
void
hexchat_list_free (xchat_plugin *ph,
xchat_list *xlist);
const char * const *
hexchat_list_fields (xchat_plugin *ph,
const char *name);
int
hexchat_list_next (xchat_plugin *ph,
xchat_list *xlist);
const char *
hexchat_list_str (xchat_plugin *ph,
xchat_list *xlist,
const char *name);
int
hexchat_list_int (xchat_plugin *ph,
xchat_list *xlist,
const char *name);
time_t
hexchat_list_time (xchat_plugin *ph,
xchat_list *xlist,
const char *name);
void *
hexchat_plugingui_add (xchat_plugin *ph,
const char *filename,
const char *name,
const char *desc,
const char *version,
char *reserved);
void
hexchat_plugingui_remove (xchat_plugin *ph,
void *handle);
int
hexchat_emit_print (xchat_plugin *ph,
const char *event_name, ...);
char *
hexchat_gettext (xchat_plugin *ph,
const char *msgid);
void
hexchat_send_modes (xchat_plugin *ph,
const char **targets,
int ntargets,
int modes_per_line,
char sign,
char mode);
char *
hexchat_strip (xchat_plugin *ph,
const char *str,
int len,
int flags);
void
hexchat_free (xchat_plugin *ph,
void *ptr);
int
hexchat_pluginpref_set_str (xchat_plugin *ph,
xchat_pluginpref_set_str (xchat_plugin *ph,
const char *var,
const char *value);
int
hexchat_pluginpref_get_str (xchat_plugin *ph,
xchat_pluginpref_get_str (xchat_plugin *ph,
const char *var,
char *dest);
int
hexchat_pluginpref_set_int (xchat_plugin *ph,
xchat_pluginpref_set_int (xchat_plugin *ph,
const char *var,
int value);
int
hexchat_pluginpref_get_int (xchat_plugin *ph,
xchat_pluginpref_get_int (xchat_plugin *ph,
const char *var);
int
hexchat_pluginpref_delete (xchat_plugin *ph,
xchat_pluginpref_delete (xchat_plugin *ph,
const char *var);
int
hexchat_pluginpref_list (xchat_plugin *ph,
xchat_pluginpref_list (xchat_plugin *ph,
char *dest);
#if !defined(PLUGIN_C) && defined(WIN32)
#ifndef XCHAT_PLUGIN_HANDLE
#define XCHAT_PLUGIN_HANDLE (ph)
#endif
#ifdef XCHAT_PLUGIN_COMPAT
#define xchat_hook_command ((XCHAT_PLUGIN_HANDLE)->xchat_hook_command)
#define xchat_hook_server ((XCHAT_PLUGIN_HANDLE)->xchat_hook_server)
#define xchat_hook_print ((XCHAT_PLUGIN_HANDLE)->xchat_hook_print)
@ -618,43 +367,12 @@ hexchat_pluginpref_list (xchat_plugin *ph,
#define xchat_send_modes ((XCHAT_PLUGIN_HANDLE)->xchat_send_modes)
#define xchat_strip ((XCHAT_PLUGIN_HANDLE)->xchat_strip)
#define xchat_free ((XCHAT_PLUGIN_HANDLE)->xchat_free)
#endif /* XCHAT_PLUGIN_COMPAT */
#define hexchat_hook_command ((XCHAT_PLUGIN_HANDLE)->hexchat_hook_command)
#define hexchat_hook_server ((XCHAT_PLUGIN_HANDLE)->hexchat_hook_server)
#define hexchat_hook_print ((XCHAT_PLUGIN_HANDLE)->hexchat_hook_print)
#define hexchat_hook_timer ((XCHAT_PLUGIN_HANDLE)->hexchat_hook_timer)
#define hexchat_hook_fd ((XCHAT_PLUGIN_HANDLE)->hexchat_hook_fd)
#define hexchat_unhook ((XCHAT_PLUGIN_HANDLE)->hexchat_unhook)
#define hexchat_print ((XCHAT_PLUGIN_HANDLE)->hexchat_print)
#define hexchat_printf ((XCHAT_PLUGIN_HANDLE)->hexchat_printf)
#define hexchat_command ((XCHAT_PLUGIN_HANDLE)->hexchat_command)
#define hexchat_commandf ((XCHAT_PLUGIN_HANDLE)->hexchat_commandf)
#define hexchat_nickcmp ((XCHAT_PLUGIN_HANDLE)->hexchat_nickcmp)
#define hexchat_set_context ((XCHAT_PLUGIN_HANDLE)->hexchat_set_context)
#define hexchat_find_context ((XCHAT_PLUGIN_HANDLE)->hexchat_find_context)
#define hexchat_get_context ((XCHAT_PLUGIN_HANDLE)->hexchat_get_context)
#define hexchat_get_info ((XCHAT_PLUGIN_HANDLE)->hexchat_get_info)
#define hexchat_get_prefs ((XCHAT_PLUGIN_HANDLE)->hexchat_get_prefs)
#define hexchat_list_get ((XCHAT_PLUGIN_HANDLE)->hexchat_list_get)
#define hexchat_list_free ((XCHAT_PLUGIN_HANDLE)->hexchat_list_free)
#define hexchat_list_fields ((XCHAT_PLUGIN_HANDLE)->hexchat_list_fields)
#define hexchat_list_next ((XCHAT_PLUGIN_HANDLE)->hexchat_list_next)
#define hexchat_list_str ((XCHAT_PLUGIN_HANDLE)->hexchat_list_str)
#define hexchat_list_int ((XCHAT_PLUGIN_HANDLE)->hexchat_list_int)
#define hexchat_plugingui_add ((XCHAT_PLUGIN_HANDLE)->hexchat_plugingui_add)
#define hexchat_plugingui_remove ((XCHAT_PLUGIN_HANDLE)->hexchat_plugingui_remove)
#define hexchat_emit_print ((XCHAT_PLUGIN_HANDLE)->hexchat_emit_print)
#define hexchat_list_time ((XCHAT_PLUGIN_HANDLE)->hexchat_list_time)
#define hexchat_gettext ((XCHAT_PLUGIN_HANDLE)->hexchat_gettext)
#define hexchat_send_modes ((XCHAT_PLUGIN_HANDLE)->hexchat_send_modes)
#define hexchat_strip ((XCHAT_PLUGIN_HANDLE)->hexchat_strip)
#define hexchat_free ((XCHAT_PLUGIN_HANDLE)->hexchat_free)
#define hexchat_pluginpref_set_str ((XCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_set_str)
#define hexchat_pluginpref_get_str ((XCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_get_str)
#define hexchat_pluginpref_set_int ((XCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_set_int)
#define hexchat_pluginpref_get_int ((XCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_get_int)
#define hexchat_pluginpref_delete ((XCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_delete)
#define hexchat_pluginpref_list ((XCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_list)
#define xchat_pluginpref_set_str ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_set_str)
#define xchat_pluginpref_get_str ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_get_str)
#define xchat_pluginpref_set_int ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_set_int)
#define xchat_pluginpref_get_int ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_get_int)
#define xchat_pluginpref_delete ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_delete)
#define xchat_pluginpref_list ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_list)
#endif
#ifdef __cplusplus

View File

@ -209,16 +209,8 @@ xchat_dummy (xchat_plugin *ph)
}
#ifdef WIN32
#ifdef XCHAT_PLUGIN_COMPAT
static int
xchat_read_fd (xchat_plugin *ph, GIOChannel *source, char *buf, int *len)
{
return hexchat_read_fd (ph, source, buf, len);
}
#endif
static int
hexchat_read_fd (xchat_plugin *ph, GIOChannel *source, char *buf, int *len)
{
GError *error = NULL;
@ -255,7 +247,6 @@ plugin_add (session *sess, char *filename, void *handle, void *init_func,
if (!fake)
{
/* win32 uses these because it doesn't have --export-dynamic! */
#ifdef XCHAT_PLUGIN_COMPAT
pl->xchat_hook_command = xchat_hook_command;
pl->xchat_hook_server = xchat_hook_server;
pl->xchat_hook_print = xchat_hook_print;
@ -291,48 +282,12 @@ plugin_add (session *sess, char *filename, void *handle, void *init_func,
pl->xchat_send_modes = xchat_send_modes;
pl->xchat_strip = xchat_strip;
pl->xchat_free = xchat_free;
#endif /* XCHAT_PLUGIN_COMPAT */
pl->hexchat_hook_command = hexchat_hook_command;
pl->hexchat_hook_server = hexchat_hook_server;
pl->hexchat_hook_print = hexchat_hook_print;
pl->hexchat_hook_timer = hexchat_hook_timer;
pl->hexchat_hook_fd = hexchat_hook_fd;
pl->hexchat_unhook = hexchat_unhook;
pl->hexchat_print = hexchat_print;
pl->hexchat_printf = hexchat_printf;
pl->hexchat_command = hexchat_command;
pl->hexchat_commandf = hexchat_commandf;
pl->hexchat_nickcmp = hexchat_nickcmp;
pl->hexchat_set_context = hexchat_set_context;
pl->hexchat_find_context = hexchat_find_context;
pl->hexchat_get_context = hexchat_get_context;
pl->hexchat_get_info = hexchat_get_info;
pl->hexchat_get_prefs = hexchat_get_prefs;
pl->hexchat_list_get = hexchat_list_get;
pl->hexchat_list_free = hexchat_list_free;
pl->hexchat_list_fields = hexchat_list_fields;
pl->hexchat_list_str = hexchat_list_str;
pl->hexchat_list_next = hexchat_list_next;
pl->hexchat_list_int = hexchat_list_int;
pl->hexchat_plugingui_add = hexchat_plugingui_add;
pl->hexchat_plugingui_remove = hexchat_plugingui_remove;
pl->hexchat_emit_print = hexchat_emit_print;
#ifdef WIN32
pl->hexchat_read_fd = (void *) hexchat_read_fd;
#else
pl->hexchat_read_fd = hexchat_dummy;
#endif
pl->hexchat_list_time = hexchat_list_time;
pl->hexchat_gettext = hexchat_gettext;
pl->hexchat_send_modes = hexchat_send_modes;
pl->hexchat_strip = hexchat_strip;
pl->hexchat_free = hexchat_free;
pl->hexchat_pluginpref_set_str = hexchat_pluginpref_set_str;
pl->hexchat_pluginpref_get_str = hexchat_pluginpref_get_str;
pl->hexchat_pluginpref_set_int = hexchat_pluginpref_set_int;
pl->hexchat_pluginpref_get_int = hexchat_pluginpref_get_int;
pl->hexchat_pluginpref_delete = hexchat_pluginpref_delete;
pl->hexchat_pluginpref_list = hexchat_pluginpref_list;
pl->xchat_pluginpref_set_str = xchat_pluginpref_set_str;
pl->xchat_pluginpref_get_str = xchat_pluginpref_get_str;
pl->xchat_pluginpref_set_int = xchat_pluginpref_set_int;
pl->xchat_pluginpref_get_int = xchat_pluginpref_get_int;
pl->xchat_pluginpref_delete = xchat_pluginpref_delete;
pl->xchat_pluginpref_list = xchat_pluginpref_list;
/* incase new plugins are loaded on older xchat */
pl->xchat_dummy4 = xchat_dummy;
@ -867,230 +822,8 @@ plugin_show_help (session *sess, char *cmd)
/* ===== these are the functions plugins actually call ===== */
/* ========================================================= */
#ifdef XCHAT_PLUGIN_COMPAT
void *
xchat_unhook (xchat_plugin *ph, xchat_hook *hook)
{
return hexchat_unhook (ph, hook);
}
xchat_hook *
xchat_hook_command (xchat_plugin *ph, const char *name, int pri, xchat_cmd_cb *callb, const char *help_text, void *userdata)
{
return hexchat_hook_command (ph, name, pri, callb, help_text, userdata);
}
xchat_hook *
xchat_hook_server (xchat_plugin *ph, const char *name, int pri, xchat_serv_cb *callb, void *userdata)
{
return hexchat_hook_server (ph, name, pri, callb, userdata);
}
xchat_hook *
xchat_hook_print (xchat_plugin *ph, const char *name, int pri, xchat_print_cb *callb, void *userdata)
{
return hexchat_hook_print (ph, name, pri, callb, userdata);
}
xchat_hook *
xchat_hook_timer (xchat_plugin *ph, int timeout, xchat_timer_cb *callb, void *userdata)
{
return hexchat_hook_timer (ph, timeout, callb, userdata);
}
xchat_hook *
xchat_hook_fd (xchat_plugin *ph, int fd, int flags, xchat_fd_cb *callb, void *userdata)
{
return hexchat_hook_fd (ph, fd, flags, callb, userdata);
}
void
xchat_print (xchat_plugin *ph, const char *text)
{
hexchat_print (ph, text);
}
void
xchat_printf (xchat_plugin *ph, const char *format, ...)
{
va_list args;
char *buf;
va_start (args, format);
buf = g_strdup_vprintf (format, args);
va_end (args);
hexchat_print (ph, buf);
g_free (buf);
}
void
xchat_command (xchat_plugin *ph, const char *command)
{
hexchat_command (ph, command);
}
void
xchat_commandf (xchat_plugin *ph, const char *format, ...)
{
va_list args;
char *buf;
va_start (args, format);
buf = g_strdup_vprintf (format, args);
va_end (args);
hexchat_command (ph, buf);
g_free (buf);
}
int
xchat_nickcmp (xchat_plugin *ph, const char *s1, const char *s2)
{
return hexchat_nickcmp (ph, s1, s2);
}
xchat_context *
xchat_get_context (xchat_plugin *ph)
{
return hexchat_get_context (ph);
}
int
xchat_set_context (xchat_plugin *ph, xchat_context *context)
{
return hexchat_set_context (ph, context);
}
xchat_context *
xchat_find_context (xchat_plugin *ph, const char *servname, const char *channel)
{
return hexchat_find_context (ph, servname, channel);
}
const char *
xchat_get_info (xchat_plugin *ph, const char *id)
{
return hexchat_get_info (ph, id);
}
int
xchat_get_prefs (xchat_plugin *ph, const char *name, const char **string, int *integer)
{
return hexchat_get_prefs (ph, name, string, integer);
}
xchat_list *
xchat_list_get (xchat_plugin *ph, const char *name)
{
return hexchat_list_get (ph, name);
}
void
xchat_list_free (xchat_plugin *ph, xchat_list *xlist)
{
hexchat_list_free (ph, xlist);
}
int
xchat_list_next (xchat_plugin *ph, xchat_list *xlist)
{
return hexchat_list_next (ph, xlist);
}
const char * const *
xchat_list_fields (xchat_plugin *ph, const char *name)
{
return hexchat_list_fields (ph, name);
}
time_t
xchat_list_time (xchat_plugin *ph, xchat_list *xlist, const char *name)
{
return hexchat_list_time (ph, xlist, name);
}
const char *
xchat_list_str (xchat_plugin *ph, xchat_list *xlist, const char *name)
{
return hexchat_list_str (ph, xlist, name);
}
int
xchat_list_int (xchat_plugin *ph, xchat_list *xlist, const char *name)
{
return hexchat_list_int (ph, xlist, name);
}
void *
xchat_plugingui_add (xchat_plugin *ph, const char *filename,
const char *name, const char *desc,
const char *version, char *reserved)
{
return hexchat_plugingui_add (ph, filename, name, desc, version, reserved);
}
void
xchat_plugingui_remove (xchat_plugin *ph, void *handle)
{
hexchat_plugingui_remove (ph, handle);
}
int
xchat_emit_print (xchat_plugin *ph, const char *event_name, ...)
{
va_list args;
/* currently only 4 because no events use more than 4.
This can be easily expanded without breaking the API. */
char *argv[4] = {NULL, NULL, NULL, NULL};
int i = 0;
va_start (args, event_name);
while (1)
{
argv[i] = va_arg (args, char *);
if (!argv[i])
break;
i++;
if (i >= 4)
break;
}
i = text_emit_by_name ((char *)event_name, ph->context, argv[0], argv[1],
argv[2], argv[3]);
va_end (args);
return i;
}
char *
xchat_gettext (xchat_plugin *ph, const char *msgid)
{
return hexchat_gettext (ph, msgid);
}
void
xchat_send_modes (xchat_plugin *ph, const char **targets, int ntargets, int modes_per_line, char sign, char mode)
{
hexchat_send_modes (ph, targets, ntargets, modes_per_line, sign, mode);
}
char *
xchat_strip (xchat_plugin *ph, const char *str, int len, int flags)
{
return hexchat_strip (ph, str, len, flags);
}
void
xchat_free (xchat_plugin *ph, void *ptr)
{
hexchat_free (ph, ptr);
}
#endif /* XCHAT_PLUGIN_COMPAT */
void *
hexchat_unhook (xchat_plugin *ph, xchat_hook *hook)
{
/* perl.c trips this */
if (!g_slist_find (hook_list, hook) || hook->type == HOOK_DELETED)
@ -1113,7 +846,7 @@ hexchat_unhook (xchat_plugin *ph, xchat_hook *hook)
}
xchat_hook *
hexchat_hook_command (xchat_plugin *ph, const char *name, int pri,
xchat_hook_command (xchat_plugin *ph, const char *name, int pri,
xchat_cmd_cb *callb, const char *help_text, void *userdata)
{
return plugin_add_hook (ph, HOOK_COMMAND, pri, name, help_text, callb, 0,
@ -1121,28 +854,28 @@ hexchat_hook_command (xchat_plugin *ph, const char *name, int pri,
}
xchat_hook *
hexchat_hook_server (xchat_plugin *ph, const char *name, int pri,
xchat_hook_server (xchat_plugin *ph, const char *name, int pri,
xchat_serv_cb *callb, void *userdata)
{
return plugin_add_hook (ph, HOOK_SERVER, pri, name, 0, callb, 0, userdata);
}
xchat_hook *
hexchat_hook_print (xchat_plugin *ph, const char *name, int pri,
xchat_hook_print (xchat_plugin *ph, const char *name, int pri,
xchat_print_cb *callb, void *userdata)
{
return plugin_add_hook (ph, HOOK_PRINT, pri, name, 0, callb, 0, userdata);
}
xchat_hook *
hexchat_hook_timer (xchat_plugin *ph, int timeout, xchat_timer_cb *callb,
xchat_hook_timer (xchat_plugin *ph, int timeout, xchat_timer_cb *callb,
void *userdata)
{
return plugin_add_hook (ph, HOOK_TIMER, 0, 0, 0, callb, timeout, userdata);
}
xchat_hook *
hexchat_hook_fd (xchat_plugin *ph, int fd, int flags,
xchat_hook_fd (xchat_plugin *ph, int fd, int flags,
xchat_fd_cb *callb, void *userdata)
{
xchat_hook *hook;
@ -1156,7 +889,7 @@ hexchat_hook_fd (xchat_plugin *ph, int fd, int flags,
}
void
hexchat_print (xchat_plugin *ph, const char *text)
xchat_print (xchat_plugin *ph, const char *text)
{
if (!is_session (ph->context))
{
@ -1168,7 +901,7 @@ hexchat_print (xchat_plugin *ph, const char *text)
}
void
hexchat_printf (xchat_plugin *ph, const char *format, ...)
xchat_printf (xchat_plugin *ph, const char *format, ...)
{
va_list args;
char *buf;
@ -1182,7 +915,7 @@ hexchat_printf (xchat_plugin *ph, const char *format, ...)
}
void
hexchat_command (xchat_plugin *ph, const char *command)
xchat_command (xchat_plugin *ph, const char *command)
{
char *conv;
int len = -1;
@ -1200,7 +933,7 @@ hexchat_command (xchat_plugin *ph, const char *command)
}
void
hexchat_commandf (xchat_plugin *ph, const char *format, ...)
xchat_commandf (xchat_plugin *ph, const char *format, ...)
{
va_list args;
char *buf;
@ -1214,19 +947,19 @@ hexchat_commandf (xchat_plugin *ph, const char *format, ...)
}
int
hexchat_nickcmp (xchat_plugin *ph, const char *s1, const char *s2)
xchat_nickcmp (xchat_plugin *ph, const char *s1, const char *s2)
{
return ((session *)ph->context)->server->p_cmp (s1, s2);
}
xchat_context *
hexchat_get_context (xchat_plugin *ph)
xchat_get_context (xchat_plugin *ph)
{
return ph->context;
}
int
hexchat_set_context (xchat_plugin *ph, xchat_context *context)
xchat_set_context (xchat_plugin *ph, xchat_context *context)
{
if (is_session (context))
{
@ -1237,7 +970,7 @@ hexchat_set_context (xchat_plugin *ph, xchat_context *context)
}
xchat_context *
hexchat_find_context (xchat_plugin *ph, const char *servname, const char *channel)
xchat_find_context (xchat_plugin *ph, const char *servname, const char *channel)
{
GSList *slist, *clist, *sessions = NULL;
server *serv;
@ -1297,7 +1030,7 @@ hexchat_find_context (xchat_plugin *ph, const char *servname, const char *channe
}
const char *
hexchat_get_info (xchat_plugin *ph, const char *id)
xchat_get_info (xchat_plugin *ph, const char *id)
{
session *sess;
guint32 hash;
@ -1404,7 +1137,7 @@ hexchat_get_info (xchat_plugin *ph, const char *id)
}
int
hexchat_get_prefs (xchat_plugin *ph, const char *name, const char **string, int *integer)
xchat_get_prefs (xchat_plugin *ph, const char *name, const char **string, int *integer)
{
int i = 0;
@ -1451,7 +1184,7 @@ hexchat_get_prefs (xchat_plugin *ph, const char *name, const char **string, int
}
xchat_list *
hexchat_list_get (xchat_plugin *ph, const char *name)
xchat_list_get (xchat_plugin *ph, const char *name)
{
xchat_list *list;
@ -1499,7 +1232,7 @@ hexchat_list_get (xchat_plugin *ph, const char *name)
}
void
hexchat_list_free (xchat_plugin *ph, xchat_list *xlist)
xchat_list_free (xchat_plugin *ph, xchat_list *xlist)
{
if (xlist->type == LIST_USERS)
g_slist_free (xlist->head);
@ -1507,7 +1240,7 @@ hexchat_list_free (xchat_plugin *ph, xchat_list *xlist)
}
int
hexchat_list_next (xchat_plugin *ph, xchat_list *xlist)
xchat_list_next (xchat_plugin *ph, xchat_list *xlist)
{
if (xlist->next == NULL)
return 0;
@ -1529,7 +1262,7 @@ hexchat_list_next (xchat_plugin *ph, xchat_list *xlist)
}
const char * const *
hexchat_list_fields (xchat_plugin *ph, const char *name)
xchat_list_fields (xchat_plugin *ph, const char *name)
{
static const char * const dcc_fields[] =
{
@ -1579,7 +1312,7 @@ hexchat_list_fields (xchat_plugin *ph, const char *name)
}
time_t
hexchat_list_time (xchat_plugin *ph, xchat_list *xlist, const char *name)
xchat_list_time (xchat_plugin *ph, xchat_list *xlist, const char *name)
{
guint32 hash = str_hash (name);
gpointer data;
@ -1613,7 +1346,7 @@ hexchat_list_time (xchat_plugin *ph, xchat_list *xlist, const char *name)
}
const char *
hexchat_list_str (xchat_plugin *ph, xchat_list *xlist, const char *name)
xchat_list_str (xchat_plugin *ph, xchat_list *xlist, const char *name)
{
guint32 hash = str_hash (name);
gpointer data = ph->context;
@ -1697,7 +1430,7 @@ hexchat_list_str (xchat_plugin *ph, xchat_list *xlist, const char *name)
}
int
hexchat_list_int (xchat_plugin *ph, xchat_list *xlist, const char *name)
xchat_list_int (xchat_plugin *ph, xchat_list *xlist, const char *name)
{
guint32 hash = str_hash (name);
gpointer data = ph->context;
@ -1814,7 +1547,7 @@ hexchat_list_int (xchat_plugin *ph, xchat_list *xlist, const char *name)
}
void *
hexchat_plugingui_add (xchat_plugin *ph, const char *filename,
xchat_plugingui_add (xchat_plugin *ph, const char *filename,
const char *name, const char *desc,
const char *version, char *reserved)
{
@ -1828,7 +1561,7 @@ hexchat_plugingui_add (xchat_plugin *ph, const char *filename,
}
void
hexchat_plugingui_remove (xchat_plugin *ph, void *handle)
xchat_plugingui_remove (xchat_plugin *ph, void *handle)
{
#ifdef USE_PLUGIN
plugin_free (handle, FALSE, FALSE);
@ -1836,7 +1569,7 @@ hexchat_plugingui_remove (xchat_plugin *ph, void *handle)
}
int
hexchat_emit_print (xchat_plugin *ph, const char *event_name, ...)
xchat_emit_print (xchat_plugin *ph, const char *event_name, ...)
{
va_list args;
/* currently only 4 because no events use more than 4.
@ -1863,7 +1596,7 @@ hexchat_emit_print (xchat_plugin *ph, const char *event_name, ...)
}
char *
hexchat_gettext (xchat_plugin *ph, const char *msgid)
xchat_gettext (xchat_plugin *ph, const char *msgid)
{
/* so that plugins can use xchat's internal gettext strings. */
/* e.g. The EXEC plugin uses this on Windows. */
@ -1871,7 +1604,7 @@ hexchat_gettext (xchat_plugin *ph, const char *msgid)
}
void
hexchat_send_modes (xchat_plugin *ph, const char **targets, int ntargets, int modes_per_line, char sign, char mode)
xchat_send_modes (xchat_plugin *ph, const char **targets, int ntargets, int modes_per_line, char sign, char mode)
{
char tbuf[514]; /* modes.c needs 512 + null */
@ -1879,19 +1612,19 @@ hexchat_send_modes (xchat_plugin *ph, const char **targets, int ntargets, int mo
}
char *
hexchat_strip (xchat_plugin *ph, const char *str, int len, int flags)
xchat_strip (xchat_plugin *ph, const char *str, int len, int flags)
{
return strip_color ((char *)str, len, flags);
}
void
hexchat_free (xchat_plugin *ph, void *ptr)
xchat_free (xchat_plugin *ph, void *ptr)
{
g_free (ptr);
}
static int
hexchat_pluginpref_set_str_real (xchat_plugin *pl, const char *var, const char *value, int mode) /* mode: 0 = delete, 1 = save */
xchat_pluginpref_set_str_real (xchat_plugin *pl, const char *var, const char *value, int mode) /* mode: 0 = delete, 1 = save */
{
FILE *fpIn;
int fhOut;
@ -2004,13 +1737,13 @@ hexchat_pluginpref_set_str_real (xchat_plugin *pl, const char *var, const char *
}
int
hexchat_pluginpref_set_str (xchat_plugin *pl, const char *var, const char *value)
xchat_pluginpref_set_str (xchat_plugin *pl, const char *var, const char *value)
{
return hexchat_pluginpref_set_str_real (pl, var, value, 1);
return xchat_pluginpref_set_str_real (pl, var, value, 1);
}
int
hexchat_pluginpref_get_str (xchat_plugin *pl, const char *var, char *dest)
xchat_pluginpref_get_str (xchat_plugin *pl, const char *var, char *dest)
{
int fh;
int l;
@ -2062,20 +1795,20 @@ hexchat_pluginpref_get_str (xchat_plugin *pl, const char *var, char *dest)
}
int
hexchat_pluginpref_set_int (xchat_plugin *pl, const char *var, int value)
xchat_pluginpref_set_int (xchat_plugin *pl, const char *var, int value)
{
char buffer[12];
sprintf (buffer, "%d", value);
return hexchat_pluginpref_set_str_real (pl, var, buffer, 1);
return xchat_pluginpref_set_str_real (pl, var, buffer, 1);
}
int
hexchat_pluginpref_get_int (xchat_plugin *pl, const char *var)
xchat_pluginpref_get_int (xchat_plugin *pl, const char *var)
{
char buffer[12];
if (hexchat_pluginpref_get_str (pl, var, buffer))
if (xchat_pluginpref_get_str (pl, var, buffer))
{
return atoi (buffer);
}
@ -2086,13 +1819,13 @@ hexchat_pluginpref_get_int (xchat_plugin *pl, const char *var)
}
int
hexchat_pluginpref_delete (xchat_plugin *pl, const char *var)
xchat_pluginpref_delete (xchat_plugin *pl, const char *var)
{
return hexchat_pluginpref_set_str_real (pl, var, 0, 0);
return xchat_pluginpref_set_str_real (pl, var, 0, 0);
}
int
hexchat_pluginpref_list (xchat_plugin *pl, char* dest)
xchat_pluginpref_list (xchat_plugin *pl, char* dest)
{
FILE *fpIn;
char confname[64];

View File

@ -6,7 +6,6 @@ struct _xchat_plugin
{
/* Keep these in sync with hexchat-plugin.h */
/* !!don't change the order, to keep binary compat!! */
#ifdef XCHAT_PLUGIN_COMPAT
xchat_hook *(*xchat_hook_command) (xchat_plugin *ph,
const char *name,
int pri,
@ -99,113 +98,20 @@ struct _xchat_plugin
int flags);
void (*xchat_free) (xchat_plugin *ph,
void *ptr);
#endif /* XCHAT_PLUGIN_COMPAT */
xchat_hook *(*hexchat_hook_command) (xchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
const char *help_text,
void *userdata);
xchat_hook *(*hexchat_hook_server) (xchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
void *userdata);
xchat_hook *(*hexchat_hook_print) (xchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], void *user_data),
void *userdata);
xchat_hook *(*hexchat_hook_timer) (xchat_plugin *ph,
int timeout,
int (*callback) (void *user_data),
void *userdata);
xchat_hook *(*hexchat_hook_fd) (xchat_plugin *ph,
int fd,
int flags,
int (*callback) (int fd, int flags, void *user_data),
void *userdata);
void *(*hexchat_unhook) (xchat_plugin *ph,
xchat_hook *hook);
void (*hexchat_print) (xchat_plugin *ph,
const char *text);
void (*hexchat_printf) (xchat_plugin *ph,
const char *format, ...);
void (*hexchat_command) (xchat_plugin *ph,
const char *command);
void (*hexchat_commandf) (xchat_plugin *ph,
const char *format, ...);
int (*hexchat_nickcmp) (xchat_plugin *ph,
const char *s1,
const char *s2);
int (*hexchat_set_context) (xchat_plugin *ph,
xchat_context *ctx);
xchat_context *(*hexchat_find_context) (xchat_plugin *ph,
const char *servname,
const char *channel);
xchat_context *(*hexchat_get_context) (xchat_plugin *ph);
const char *(*hexchat_get_info) (xchat_plugin *ph,
const char *id);
int (*hexchat_get_prefs) (xchat_plugin *ph,
const char *name,
const char **string,
int *integer);
xchat_list * (*hexchat_list_get) (xchat_plugin *ph,
const char *name);
void (*hexchat_list_free) (xchat_plugin *ph,
xchat_list *xlist);
const char * const * (*hexchat_list_fields) (xchat_plugin *ph,
const char *name);
int (*hexchat_list_next) (xchat_plugin *ph,
xchat_list *xlist);
const char * (*hexchat_list_str) (xchat_plugin *ph,
xchat_list *xlist,
const char *name);
int (*hexchat_list_int) (xchat_plugin *ph,
xchat_list *xlist,
const char *name);
void * (*hexchat_plugingui_add) (xchat_plugin *ph,
const char *filename,
const char *name,
const char *desc,
const char *version,
char *reserved);
void (*hexchat_plugingui_remove) (xchat_plugin *ph,
void *handle);
int (*hexchat_emit_print) (xchat_plugin *ph,
const char *event_name, ...);
void *(*hexchat_read_fd) (xchat_plugin *ph);
time_t (*hexchat_list_time) (xchat_plugin *ph,
xchat_list *xlist,
const char *name);
char *(*hexchat_gettext) (xchat_plugin *ph,
const char *msgid);
void (*hexchat_send_modes) (xchat_plugin *ph,
const char **targets,
int ntargets,
int modes_per_line,
char sign,
char mode);
char *(*hexchat_strip) (xchat_plugin *ph,
const char *str,
int len,
int flags);
void (*hexchat_free) (xchat_plugin *ph,
void *ptr);
int (*hexchat_pluginpref_set_str) (xchat_plugin *ph,
int (*xchat_pluginpref_set_str) (xchat_plugin *ph,
const char *var,
const char *value);
int (*hexchat_pluginpref_get_str) (xchat_plugin *ph,
int (*xchat_pluginpref_get_str) (xchat_plugin *ph,
const char *var,
char *dest);
int (*hexchat_pluginpref_set_int) (xchat_plugin *ph,
int (*xchat_pluginpref_set_int) (xchat_plugin *ph,
const char *var,
int value);
int (*hexchat_pluginpref_get_int) (xchat_plugin *ph,
int (*xchat_pluginpref_get_int) (xchat_plugin *ph,
const char *var);
int (*hexchat_pluginpref_delete) (xchat_plugin *ph,
int (*xchat_pluginpref_delete) (xchat_plugin *ph,
const char *var);
int (*hexchat_pluginpref_list) (xchat_plugin *ph,
int (*xchat_pluginpref_list) (xchat_plugin *ph,
char *dest);
void *(*xchat_dummy4) (xchat_plugin *ph);
void *(*xchat_dummy3) (xchat_plugin *ph);

View File

@ -30,41 +30,11 @@ EXPORTED {
xchat_send_modes;
xchat_strip;
xchat_free;
hexchat_hook_command;
hexchat_hook_server;
hexchat_hook_print;
hexchat_hook_timer;
hexchat_hook_fd;
hexchat_unhook;
hexchat_print;
hexchat_printf;
hexchat_command;
hexchat_commandf;
hexchat_nickcmp;
hexchat_set_context;
hexchat_find_context;
hexchat_get_context;
hexchat_get_info;
hexchat_get_prefs;
hexchat_list_get;
hexchat_list_free;
hexchat_list_fields;
hexchat_list_next;
hexchat_list_str;
hexchat_list_int;
hexchat_plugingui_add;
hexchat_plugingui_remove;
hexchat_emit_print;
hexchat_list_time;
hexchat_gettext;
hexchat_send_modes;
hexchat_strip;
hexchat_free;
hexchat_pluginpref_set_str;
hexchat_pluginpref_get_str;
hexchat_pluginpref_set_int;
hexchat_pluginpref_get_int;
hexchat_pluginpref_delete;
hexchat_pluginpref_list;
xchat_pluginpref_set_str;
xchat_pluginpref_get_str;
xchat_pluginpref_set_int;
xchat_pluginpref_get_int;
xchat_pluginpref_delete;
xchat_pluginpref_list;
local: *;
};

View File

@ -11,7 +11,7 @@
<YourPerl516Path>c:\mozilla-build\perl-5.16</YourPerl516Path>
<YourPythonPath>c:\mozilla-build\python-2.7</YourPythonPath>
<!-- YOU SHOULDN'T TOUCH ANYTHING BELOW -->
<OwnFlags>G_DISABLE_CAST_CHECKS;G_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;GDK_DISABLE_DEPRECATED;HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline;XCHAT_PLUGIN_COMPAT;</OwnFlags>
<OwnFlags>G_DISABLE_CAST_CHECKS;G_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;GDK_DISABLE_DEPRECATED;HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline;</OwnFlags>
<DepsRoot>$(YourDepsPath)\$(PlatformName)</DepsRoot>
<GendefPath>$(YourGendefPath)</GendefPath>
<LuaLib>lua51</LuaLib>

View File

@ -12,7 +12,7 @@
<YourPerl516Path>c:\mozilla-build\perl-5.16</YourPerl516Path>
<YourPythonPath>c:\mozilla-build\python-2.7</YourPythonPath>
<!-- YOU SHOULDN'T TOUCH ANYTHING BELOW -->
<OwnFlags>G_DISABLE_CAST_CHECKS;G_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;GDK_DISABLE_DEPRECATED;HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline;XCHAT_PLUGIN_COMPAT;</OwnFlags>
<OwnFlags>G_DISABLE_CAST_CHECKS;G_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;GDK_DISABLE_DEPRECATED;HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline;</OwnFlags>
<DepsRoot>$(YourDepsPath)\$(PlatformName)</DepsRoot>
<GendefPath>$(YourGendefPath)</GendefPath>
<MsgfmtPath>$(YourMsgfmtPath)</MsgfmtPath>