new name after fork

This commit is contained in:
2026-01-05 23:12:38 -07:00
parent ca43595430
commit 4683ef705b
316 changed files with 5422 additions and 6141 deletions

View File

@@ -29,7 +29,7 @@
#include <unistd.h>
#endif
#include "hexchat.h"
#include "zoitechat.h"
#include "fe.h"
#include "util.h"
#include "outbound.h"
@@ -41,13 +41,13 @@
#include "notify.h"
#include "text.h"
#define PLUGIN_C
typedef struct session hexchat_context;
#include "hexchat-plugin.h"
typedef struct session zoitechat_context;
#include "zoitechat-plugin.h"
#include "plugin.h"
#include "typedef.h"
#include "hexchatc.h"
#include "zoitechatc.h"
/* the USE_PLUGIN define only removes libdl stuff */
@@ -58,9 +58,9 @@ typedef struct session hexchat_context;
#define DEBUG(x) {x;}
/* crafted to be an even 32 bytes */
struct _hexchat_hook
struct _zoitechat_hook
{
hexchat_plugin *pl; /* the plugin to which it belongs */
zoitechat_plugin *pl; /* the plugin to which it belongs */
char *name; /* "xdcc" */
void *callback; /* pointer to xdcc_callback */
char *help_text; /* help_text for commands only */
@@ -70,7 +70,7 @@ struct _hexchat_hook
int pri; /* fd */ /* priority / fd for HOOK_FD only */
};
struct _hexchat_list
struct _zoitechat_list
{
int type; /* LIST_* */
GSList *pos; /* current pos */
@@ -79,15 +79,15 @@ struct _hexchat_list
struct notify_per_server *notifyps; /* notify_per_server * */
};
typedef int (hexchat_cmd_cb) (char *word[], char *word_eol[], void *user_data);
typedef int (hexchat_serv_cb) (char *word[], char *word_eol[], void *user_data);
typedef int (hexchat_print_cb) (char *word[], void *user_data);
typedef int (hexchat_serv_attrs_cb) (char *word[], char *word_eol[], hexchat_event_attrs *attrs, void *user_data);
typedef int (hexchat_print_attrs_cb) (char *word[], hexchat_event_attrs *attrs, void *user_data);
typedef int (hexchat_fd_cb) (int fd, int flags, void *user_data);
typedef int (hexchat_timer_cb) (void *user_data);
typedef int (hexchat_init_func) (hexchat_plugin *, char **, char **, char **, char *);
typedef int (hexchat_deinit_func) (hexchat_plugin *);
typedef int (zoitechat_cmd_cb) (char *word[], char *word_eol[], void *user_data);
typedef int (zoitechat_serv_cb) (char *word[], char *word_eol[], void *user_data);
typedef int (zoitechat_print_cb) (char *word[], void *user_data);
typedef int (zoitechat_serv_attrs_cb) (char *word[], char *word_eol[], zoitechat_event_attrs *attrs, void *user_data);
typedef int (zoitechat_print_attrs_cb) (char *word[], zoitechat_event_attrs *attrs, void *user_data);
typedef int (zoitechat_fd_cb) (int fd, int flags, void *user_data);
typedef int (zoitechat_timer_cb) (void *user_data);
typedef int (zoitechat_init_func) (zoitechat_plugin *, char **, char **, char **, char *);
typedef int (zoitechat_deinit_func) (zoitechat_plugin *);
enum
{
@@ -152,13 +152,13 @@ extern const struct prefs vars[]; /* cfgfiles.c */
/* unload a plugin and remove it from our linked list */
static int
plugin_free (hexchat_plugin *pl, int do_deinit, int allow_refuse)
plugin_free (zoitechat_plugin *pl, int do_deinit, int allow_refuse)
{
GSList *list, *next;
hexchat_hook *hook;
hexchat_deinit_func *deinit_func;
zoitechat_hook *hook;
zoitechat_deinit_func *deinit_func;
/* fake plugin added by hexchat_plugingui_add() */
/* fake plugin added by zoitechat_plugingui_add() */
if (pl->fake)
goto xit;
@@ -177,7 +177,7 @@ plugin_free (hexchat_plugin *pl, int do_deinit, int allow_refuse)
hook = list->data;
next = list->next;
if (hook->pl == pl)
hexchat_unhook (NULL, hook);
zoitechat_unhook (NULL, hook);
list = next;
}
@@ -205,14 +205,14 @@ xit:
return TRUE;
}
static hexchat_plugin *
plugin_list_add (hexchat_context *ctx, char *filename, const char *name,
static zoitechat_plugin *
plugin_list_add (zoitechat_context *ctx, char *filename, const char *name,
const char *desc, const char *version, void *handle,
void *deinit_func, int fake, int free_strings)
{
hexchat_plugin *pl;
zoitechat_plugin *pl;
pl = g_new (hexchat_plugin, 1);
pl = g_new (zoitechat_plugin, 1);
pl->handle = handle;
pl->filename = filename;
pl->context = ctx;
@@ -230,7 +230,7 @@ plugin_list_add (hexchat_context *ctx, char *filename, const char *name,
#ifndef WIN32
static void *
hexchat_dummy (hexchat_plugin *ph)
zoitechat_dummy (zoitechat_plugin *ph)
{
return NULL;
}
@@ -238,7 +238,7 @@ hexchat_dummy (hexchat_plugin *ph)
#else
static int
hexchat_read_fd (hexchat_plugin *ph, GIOChannel *source, char *buf, int *len)
zoitechat_read_fd (zoitechat_plugin *ph, GIOChannel *source, char *buf, int *len)
{
GError *error = NULL;
@@ -262,7 +262,7 @@ void
plugin_add (session *sess, char *filename, void *handle, void *init_func,
void *deinit_func, char *arg, int fake)
{
hexchat_plugin *pl;
zoitechat_plugin *pl;
char *file;
file = g_strdup (filename);
@@ -273,55 +273,55 @@ plugin_add (session *sess, char *filename, void *handle, void *init_func,
if (!fake)
{
/* win32 uses these because it doesn't have --export-dynamic! */
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;
pl->zoitechat_hook_command = zoitechat_hook_command;
pl->zoitechat_hook_server = zoitechat_hook_server;
pl->zoitechat_hook_print = zoitechat_hook_print;
pl->zoitechat_hook_timer = zoitechat_hook_timer;
pl->zoitechat_hook_fd = zoitechat_hook_fd;
pl->zoitechat_unhook = zoitechat_unhook;
pl->zoitechat_print = zoitechat_print;
pl->zoitechat_printf = zoitechat_printf;
pl->zoitechat_command = zoitechat_command;
pl->zoitechat_commandf = zoitechat_commandf;
pl->zoitechat_nickcmp = zoitechat_nickcmp;
pl->zoitechat_set_context = zoitechat_set_context;
pl->zoitechat_find_context = zoitechat_find_context;
pl->zoitechat_get_context = zoitechat_get_context;
pl->zoitechat_get_info = zoitechat_get_info;
pl->zoitechat_get_prefs = zoitechat_get_prefs;
pl->zoitechat_list_get = zoitechat_list_get;
pl->zoitechat_list_free = zoitechat_list_free;
pl->zoitechat_list_fields = zoitechat_list_fields;
pl->zoitechat_list_str = zoitechat_list_str;
pl->zoitechat_list_next = zoitechat_list_next;
pl->zoitechat_list_int = zoitechat_list_int;
pl->zoitechat_plugingui_add = zoitechat_plugingui_add;
pl->zoitechat_plugingui_remove = zoitechat_plugingui_remove;
pl->zoitechat_emit_print = zoitechat_emit_print;
#ifdef WIN32
pl->hexchat_read_fd = (void *) hexchat_read_fd;
pl->zoitechat_read_fd = (void *) zoitechat_read_fd;
#else
pl->hexchat_read_fd = hexchat_dummy;
pl->zoitechat_read_fd = zoitechat_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->hexchat_hook_server_attrs = hexchat_hook_server_attrs;
pl->hexchat_hook_print_attrs = hexchat_hook_print_attrs;
pl->hexchat_emit_print_attrs = hexchat_emit_print_attrs;
pl->hexchat_event_attrs_create = hexchat_event_attrs_create;
pl->hexchat_event_attrs_free = hexchat_event_attrs_free;
pl->zoitechat_list_time = zoitechat_list_time;
pl->zoitechat_gettext = zoitechat_gettext;
pl->zoitechat_send_modes = zoitechat_send_modes;
pl->zoitechat_strip = zoitechat_strip;
pl->zoitechat_free = zoitechat_free;
pl->zoitechat_pluginpref_set_str = zoitechat_pluginpref_set_str;
pl->zoitechat_pluginpref_get_str = zoitechat_pluginpref_get_str;
pl->zoitechat_pluginpref_set_int = zoitechat_pluginpref_set_int;
pl->zoitechat_pluginpref_get_int = zoitechat_pluginpref_get_int;
pl->zoitechat_pluginpref_delete = zoitechat_pluginpref_delete;
pl->zoitechat_pluginpref_list = zoitechat_pluginpref_list;
pl->zoitechat_hook_server_attrs = zoitechat_hook_server_attrs;
pl->zoitechat_hook_print_attrs = zoitechat_hook_print_attrs;
pl->zoitechat_emit_print_attrs = zoitechat_emit_print_attrs;
pl->zoitechat_event_attrs_create = zoitechat_event_attrs_create;
pl->zoitechat_event_attrs_free = zoitechat_event_attrs_free;
/* run hexchat_plugin_init, if it returns 0, close the plugin */
if (((hexchat_init_func *)init_func) (pl, &pl->name, &pl->desc, &pl->version, arg) == 0)
/* run zoitechat_plugin_init, if it returns 0, close the plugin */
if (((zoitechat_init_func *)init_func) (pl, &pl->name, &pl->desc, &pl->version, arg) == 0)
{
plugin_free (pl, FALSE, FALSE);
return;
@@ -339,7 +339,7 @@ int
plugin_kill (char *name, int by_filename)
{
GSList *list;
hexchat_plugin *pl;
zoitechat_plugin *pl;
list = plugin_list;
while (list)
@@ -370,7 +370,7 @@ void
plugin_kill_all (void)
{
GSList *list, *next;
hexchat_plugin *pl;
zoitechat_plugin *pl;
list = plugin_list;
while (list)
@@ -423,21 +423,21 @@ char *
plugin_load (session *sess, char *filename, char *arg)
{
GModule *handle = module_load (filename);
hexchat_init_func *init_func;
hexchat_deinit_func *deinit_func;
zoitechat_init_func *init_func;
zoitechat_deinit_func *deinit_func;
if (handle == NULL)
return (char *)g_module_error ();
/* find the init routine hexchat_plugin_init */
if (!g_module_symbol (handle, "hexchat_plugin_init", (gpointer *)&init_func))
/* find the init routine zoitechat_plugin_init */
if (!g_module_symbol (handle, "zoitechat_plugin_init", (gpointer *)&init_func))
{
g_module_close (handle);
return _("No hexchat_plugin_init symbol; is this really a HexChat plugin?");
return _("No zoitechat_plugin_init symbol; is this really a ZoiteChat plugin?");
}
/* find the plugin's deinit routine, if any */
if (!g_module_symbol (handle, "hexchat_plugin_deinit", (gpointer *)&deinit_func))
if (!g_module_symbol (handle, "zoitechat_plugin_deinit", (gpointer *)&deinit_func))
deinit_func = NULL;
/* add it to our linked list */
@@ -510,7 +510,7 @@ plugin_reload (session *sess, char *name, int by_filename)
GSList *list;
char *filename;
char *ret;
hexchat_plugin *pl;
zoitechat_plugin *pl;
list = plugin_list;
while (list)
@@ -547,7 +547,7 @@ plugin_reload (session *sess, char *name, int by_filename)
static GSList *
plugin_hook_find (GSList *list, int type, char *name)
{
hexchat_hook *hook;
zoitechat_hook *hook;
while (list)
{
@@ -571,10 +571,10 @@ plugin_hook_find (GSList *list, int type, char *name)
static int
plugin_hook_run (session *sess, char *name, char *word[], char *word_eol[],
hexchat_event_attrs *attrs, int type)
zoitechat_event_attrs *attrs, int type)
{
GSList *list, *next;
hexchat_hook *hook;
zoitechat_hook *hook;
int ret, eat = 0;
list = hook_list;
@@ -592,19 +592,19 @@ plugin_hook_run (session *sess, char *name, char *word[], char *word_eol[],
switch (hook->type)
{
case HOOK_COMMAND:
ret = ((hexchat_cmd_cb *)hook->callback) (word, word_eol, hook->userdata);
ret = ((zoitechat_cmd_cb *)hook->callback) (word, word_eol, hook->userdata);
break;
case HOOK_PRINT_ATTRS:
ret = ((hexchat_print_attrs_cb *)hook->callback) (word, attrs, hook->userdata);
ret = ((zoitechat_print_attrs_cb *)hook->callback) (word, attrs, hook->userdata);
break;
case HOOK_SERVER:
ret = ((hexchat_serv_cb *)hook->callback) (word, word_eol, hook->userdata);
ret = ((zoitechat_serv_cb *)hook->callback) (word, word_eol, hook->userdata);
break;
case HOOK_SERVER_ATTRS:
ret = ((hexchat_serv_attrs_cb *)hook->callback) (word, word_eol, attrs, hook->userdata);
ret = ((zoitechat_serv_attrs_cb *)hook->callback) (word, word_eol, attrs, hook->userdata);
break;
default: /*case HOOK_PRINT:*/
ret = ((hexchat_print_cb *)hook->callback) (word, hook->userdata);
ret = ((zoitechat_print_cb *)hook->callback) (word, hook->userdata);
break;
}
@@ -647,14 +647,14 @@ plugin_emit_command (session *sess, char *name, char *word[], char *word_eol[])
return plugin_hook_run (sess, name, word, word_eol, NULL, HOOK_COMMAND);
}
hexchat_event_attrs *
hexchat_event_attrs_create (hexchat_plugin *ph)
zoitechat_event_attrs *
zoitechat_event_attrs_create (zoitechat_plugin *ph)
{
return g_new0 (hexchat_event_attrs, 1);
return g_new0 (zoitechat_event_attrs, 1);
}
void
hexchat_event_attrs_free (hexchat_plugin *ph, hexchat_event_attrs *attrs)
zoitechat_event_attrs_free (zoitechat_plugin *ph, zoitechat_event_attrs *attrs)
{
g_free (attrs);
}
@@ -665,7 +665,7 @@ int
plugin_emit_server (session *sess, char *name, char *word[], char *word_eol[],
time_t server_time)
{
hexchat_event_attrs attrs;
zoitechat_event_attrs attrs;
attrs.server_time_utc = server_time;
@@ -678,7 +678,7 @@ plugin_emit_server (session *sess, char *name, char *word[], char *word_eol[],
int
plugin_emit_print (session *sess, char *word[], time_t server_time)
{
hexchat_event_attrs attrs;
zoitechat_event_attrs attrs;
attrs.server_time_utc = server_time;
@@ -733,7 +733,7 @@ plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval, gu
}
static int
plugin_timeout_cb (hexchat_hook *hook)
plugin_timeout_cb (zoitechat_hook *hook)
{
int ret;
@@ -741,7 +741,7 @@ plugin_timeout_cb (hexchat_hook *hook)
hook->pl->context = current_sess;
/* call the plugin's timeout function */
ret = ((hexchat_timer_cb *)hook->callback) (hook->userdata);
ret = ((zoitechat_timer_cb *)hook->callback) (hook->userdata);
/* the callback might have already unhooked it! */
if (!g_slist_find (hook_list, hook) || hook->type == HOOK_DELETED)
@@ -750,7 +750,7 @@ plugin_timeout_cb (hexchat_hook *hook)
if (ret == 0)
{
hook->tag = 0; /* avoid fe_timeout_remove, returning 0 is enough! */
hexchat_unhook (hook->pl, hook);
zoitechat_unhook (hook->pl, hook);
}
return ret;
@@ -759,10 +759,10 @@ plugin_timeout_cb (hexchat_hook *hook)
/* insert a hook into hook_list according to its priority */
static void
plugin_insert_hook (hexchat_hook *new_hook)
plugin_insert_hook (zoitechat_hook *new_hook)
{
GSList *list;
hexchat_hook *hook;
zoitechat_hook *hook;
int new_hook_type;
switch (new_hook->type)
@@ -795,10 +795,10 @@ plugin_insert_hook (hexchat_hook *new_hook)
}
static gboolean
plugin_fd_cb (GIOChannel *source, GIOCondition condition, hexchat_hook *hook)
plugin_fd_cb (GIOChannel *source, GIOCondition condition, zoitechat_hook *hook)
{
int flags = 0, ret;
typedef int (hexchat_fd_cb2) (int fd, int flags, void *user_data, GIOChannel *);
typedef int (zoitechat_fd_cb2) (int fd, int flags, void *user_data, GIOChannel *);
if (condition & G_IO_IN)
flags |= HEXCHAT_FD_READ;
@@ -807,7 +807,7 @@ plugin_fd_cb (GIOChannel *source, GIOCondition condition, hexchat_hook *hook)
if (condition & G_IO_PRI)
flags |= HEXCHAT_FD_EXCEPTION;
ret = ((hexchat_fd_cb2 *)hook->callback) (hook->pri, flags, hook->userdata, source);
ret = ((zoitechat_fd_cb2 *)hook->callback) (hook->pri, flags, hook->userdata, source);
/* the callback might have already unhooked it! */
if (!g_slist_find (hook_list, hook) || hook->type == HOOK_DELETED)
@@ -816,7 +816,7 @@ plugin_fd_cb (GIOChannel *source, GIOCondition condition, hexchat_hook *hook)
if (ret == 0)
{
hook->tag = 0; /* avoid fe_input_remove, returning 0 is enough! */
hexchat_unhook (hook->pl, hook);
zoitechat_unhook (hook->pl, hook);
}
return ret;
@@ -824,13 +824,13 @@ plugin_fd_cb (GIOChannel *source, GIOCondition condition, hexchat_hook *hook)
/* allocate and add a hook to our list. Used for all 4 types */
static hexchat_hook *
plugin_add_hook (hexchat_plugin *pl, int type, int pri, const char *name,
static zoitechat_hook *
plugin_add_hook (zoitechat_plugin *pl, int type, int pri, const char *name,
const char *help_text, void *callb, int timeout, void *userdata)
{
hexchat_hook *hook;
zoitechat_hook *hook;
hook = g_new0 (hexchat_hook, 1);
hook = g_new0 (zoitechat_hook, 1);
hook->type = type;
hook->pri = pri;
hook->name = g_strdup (name);
@@ -851,7 +851,7 @@ plugin_add_hook (hexchat_plugin *pl, int type, int pri, const char *name,
GList *
plugin_command_list(GList *tmp_list)
{
hexchat_hook *hook;
zoitechat_hook *hook;
GSList *list = hook_list;
while (list)
@@ -869,7 +869,7 @@ plugin_command_foreach (session *sess, void *userdata,
void (*cb) (session *sess, void *userdata, char *name, char *help))
{
GSList *list;
hexchat_hook *hook;
zoitechat_hook *hook;
list = hook_list;
while (list)
@@ -887,7 +887,7 @@ int
plugin_show_help (session *sess, char *cmd)
{
GSList *list;
hexchat_hook *hook;
zoitechat_hook *hook;
list = plugin_hook_find (hook_list, HOOK_COMMAND, cmd);
if (list)
@@ -969,7 +969,7 @@ plugin_find_context (const char *servname, const char *channel, server *current_
/* ========================================================= */
void *
hexchat_unhook (hexchat_plugin *ph, hexchat_hook *hook)
zoitechat_unhook (zoitechat_plugin *ph, zoitechat_hook *hook)
{
/* perl.c trips this */
if (!g_slist_find (hook_list, hook) || hook->type == HOOK_DELETED)
@@ -989,56 +989,56 @@ hexchat_unhook (hexchat_plugin *ph, hexchat_hook *hook)
return hook->userdata;
}
hexchat_hook *
hexchat_hook_command (hexchat_plugin *ph, const char *name, int pri,
hexchat_cmd_cb *callb, const char *help_text, void *userdata)
zoitechat_hook *
zoitechat_hook_command (zoitechat_plugin *ph, const char *name, int pri,
zoitechat_cmd_cb *callb, const char *help_text, void *userdata)
{
return plugin_add_hook (ph, HOOK_COMMAND, pri, name, help_text, callb, 0,
userdata);
}
hexchat_hook *
hexchat_hook_server (hexchat_plugin *ph, const char *name, int pri,
hexchat_serv_cb *callb, void *userdata)
zoitechat_hook *
zoitechat_hook_server (zoitechat_plugin *ph, const char *name, int pri,
zoitechat_serv_cb *callb, void *userdata)
{
return plugin_add_hook (ph, HOOK_SERVER, pri, name, 0, callb, 0, userdata);
}
hexchat_hook *
hexchat_hook_server_attrs (hexchat_plugin *ph, const char *name, int pri,
hexchat_serv_attrs_cb *callb, void *userdata)
zoitechat_hook *
zoitechat_hook_server_attrs (zoitechat_plugin *ph, const char *name, int pri,
zoitechat_serv_attrs_cb *callb, void *userdata)
{
return plugin_add_hook (ph, HOOK_SERVER_ATTRS, pri, name, 0, callb, 0,
userdata);
}
hexchat_hook *
hexchat_hook_print (hexchat_plugin *ph, const char *name, int pri,
hexchat_print_cb *callb, void *userdata)
zoitechat_hook *
zoitechat_hook_print (zoitechat_plugin *ph, const char *name, int pri,
zoitechat_print_cb *callb, void *userdata)
{
return plugin_add_hook (ph, HOOK_PRINT, pri, name, 0, callb, 0, userdata);
}
hexchat_hook *
hexchat_hook_print_attrs (hexchat_plugin *ph, const char *name, int pri,
hexchat_print_attrs_cb *callb, void *userdata)
zoitechat_hook *
zoitechat_hook_print_attrs (zoitechat_plugin *ph, const char *name, int pri,
zoitechat_print_attrs_cb *callb, void *userdata)
{
return plugin_add_hook (ph, HOOK_PRINT_ATTRS, pri, name, 0, callb, 0,
userdata);
}
hexchat_hook *
hexchat_hook_timer (hexchat_plugin *ph, int timeout, hexchat_timer_cb *callb,
zoitechat_hook *
zoitechat_hook_timer (zoitechat_plugin *ph, int timeout, zoitechat_timer_cb *callb,
void *userdata)
{
return plugin_add_hook (ph, HOOK_TIMER, 0, 0, 0, callb, timeout, userdata);
}
hexchat_hook *
hexchat_hook_fd (hexchat_plugin *ph, int fd, int flags,
hexchat_fd_cb *callb, void *userdata)
zoitechat_hook *
zoitechat_hook_fd (zoitechat_plugin *ph, int fd, int flags,
zoitechat_fd_cb *callb, void *userdata)
{
hexchat_hook *hook;
zoitechat_hook *hook;
hook = plugin_add_hook (ph, HOOK_FD, 0, 0, 0, callb, 0, userdata);
hook->pri = fd;
@@ -1049,11 +1049,11 @@ hexchat_hook_fd (hexchat_plugin *ph, int fd, int flags,
}
void
hexchat_print (hexchat_plugin *ph, const char *text)
zoitechat_print (zoitechat_plugin *ph, const char *text)
{
if (!is_session (ph->context))
{
DEBUG(PrintTextf(0, "%s\thexchat_print called without a valid context.\n", ph->name));
DEBUG(PrintTextf(0, "%s\tzoitechat_print called without a valid context.\n", ph->name));
return;
}
@@ -1061,7 +1061,7 @@ hexchat_print (hexchat_plugin *ph, const char *text)
}
void
hexchat_printf (hexchat_plugin *ph, const char *format, ...)
zoitechat_printf (zoitechat_plugin *ph, const char *format, ...)
{
va_list args;
char *buf;
@@ -1070,18 +1070,18 @@ hexchat_printf (hexchat_plugin *ph, const char *format, ...)
buf = g_strdup_vprintf (format, args);
va_end (args);
hexchat_print (ph, buf);
zoitechat_print (ph, buf);
g_free (buf);
}
void
hexchat_command (hexchat_plugin *ph, const char *command)
zoitechat_command (zoitechat_plugin *ph, const char *command)
{
char *command_utf8;
if (!is_session (ph->context))
{
DEBUG(PrintTextf(0, "%s\thexchat_command called without a valid context.\n", ph->name));
DEBUG(PrintTextf(0, "%s\tzoitechat_command called without a valid context.\n", ph->name));
return;
}
@@ -1092,7 +1092,7 @@ hexchat_command (hexchat_plugin *ph, const char *command)
}
void
hexchat_commandf (hexchat_plugin *ph, const char *format, ...)
zoitechat_commandf (zoitechat_plugin *ph, const char *format, ...)
{
va_list args;
char *buf;
@@ -1101,24 +1101,24 @@ hexchat_commandf (hexchat_plugin *ph, const char *format, ...)
buf = g_strdup_vprintf (format, args);
va_end (args);
hexchat_command (ph, buf);
zoitechat_command (ph, buf);
g_free (buf);
}
int
hexchat_nickcmp (hexchat_plugin *ph, const char *s1, const char *s2)
zoitechat_nickcmp (zoitechat_plugin *ph, const char *s1, const char *s2)
{
return ((session *)ph->context)->server->p_cmp (s1, s2);
}
hexchat_context *
hexchat_get_context (hexchat_plugin *ph)
zoitechat_context *
zoitechat_get_context (zoitechat_plugin *ph)
{
return ph->context;
}
int
hexchat_set_context (hexchat_plugin *ph, hexchat_context *context)
zoitechat_set_context (zoitechat_plugin *ph, zoitechat_context *context)
{
if (is_session (context))
{
@@ -1128,14 +1128,14 @@ hexchat_set_context (hexchat_plugin *ph, hexchat_context *context)
return 0;
}
hexchat_context *
hexchat_find_context (hexchat_plugin *ph, const char *servname, const char *channel)
zoitechat_context *
zoitechat_find_context (zoitechat_plugin *ph, const char *servname, const char *channel)
{
return plugin_find_context (servname, channel, ph->context->server);
}
const char *
hexchat_get_info (hexchat_plugin *ph, const char *id)
zoitechat_get_info (zoitechat_plugin *ph, const char *id)
{
session *sess;
guint32 hash;
@@ -1171,7 +1171,7 @@ hexchat_get_info (hexchat_plugin *ph, const char *id)
sess = ph->context;
if (!is_session (sess))
{
DEBUG(PrintTextf(0, "%s\thexchat_get_info called without a valid context.\n", ph->name));
DEBUG(PrintTextf(0, "%s\tzoitechat_get_info called without a valid context.\n", ph->name));
return NULL;
}
@@ -1246,7 +1246,7 @@ hexchat_get_info (hexchat_plugin *ph, const char *id)
}
int
hexchat_get_prefs (hexchat_plugin *ph, const char *name, const char **string, int *integer)
zoitechat_get_prefs (zoitechat_plugin *ph, const char *name, const char **string, int *integer)
{
int i = 0;
@@ -1292,12 +1292,12 @@ hexchat_get_prefs (hexchat_plugin *ph, const char *name, const char **string, in
return 0;
}
hexchat_list *
hexchat_list_get (hexchat_plugin *ph, const char *name)
zoitechat_list *
zoitechat_list_get (zoitechat_plugin *ph, const char *name)
{
hexchat_list *list;
zoitechat_list *list;
list = g_new0 (hexchat_list, 1);
list = g_new0 (zoitechat_list, 1);
switch (str_hash (name))
{
@@ -1340,7 +1340,7 @@ hexchat_list_get (hexchat_plugin *ph, const char *name)
}
void
hexchat_list_free (hexchat_plugin *ph, hexchat_list *xlist)
zoitechat_list_free (zoitechat_plugin *ph, zoitechat_list *xlist)
{
if (xlist->type == LIST_USERS)
g_slist_free (xlist->head);
@@ -1348,7 +1348,7 @@ hexchat_list_free (hexchat_plugin *ph, hexchat_list *xlist)
}
int
hexchat_list_next (hexchat_plugin *ph, hexchat_list *xlist)
zoitechat_list_next (zoitechat_plugin *ph, zoitechat_list *xlist)
{
if (xlist->next == NULL)
return 0;
@@ -1370,7 +1370,7 @@ hexchat_list_next (hexchat_plugin *ph, hexchat_list *xlist)
}
const char * const *
hexchat_list_fields (hexchat_plugin *ph, const char *name)
zoitechat_list_fields (zoitechat_plugin *ph, const char *name)
{
static const char * const dcc_fields[] =
{
@@ -1420,7 +1420,7 @@ hexchat_list_fields (hexchat_plugin *ph, const char *name)
}
time_t
hexchat_list_time (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
zoitechat_list_time (zoitechat_plugin *ph, zoitechat_list *xlist, const char *name)
{
guint32 hash = str_hash (name);
gpointer data;
@@ -1454,7 +1454,7 @@ hexchat_list_time (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
}
const char *
hexchat_list_str (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
zoitechat_list_str (zoitechat_plugin *ph, zoitechat_list *xlist, const char *name)
{
guint32 hash = str_hash (name);
gpointer data = ph->context;
@@ -1544,7 +1544,7 @@ hexchat_list_str (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
}
int
hexchat_list_int (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
zoitechat_list_int (zoitechat_plugin *ph, zoitechat_list *xlist, const char *name)
{
guint32 hash = str_hash (name);
gpointer data = ph->context;
@@ -1683,7 +1683,7 @@ hexchat_list_int (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
}
void *
hexchat_plugingui_add (hexchat_plugin *ph, const char *filename,
zoitechat_plugingui_add (zoitechat_plugin *ph, const char *filename,
const char *name, const char *desc,
const char *version, char *reserved)
{
@@ -1697,7 +1697,7 @@ hexchat_plugingui_add (hexchat_plugin *ph, const char *filename,
}
void
hexchat_plugingui_remove (hexchat_plugin *ph, void *handle)
zoitechat_plugingui_remove (zoitechat_plugin *ph, void *handle)
{
#ifdef USE_PLUGIN
plugin_free (handle, FALSE, FALSE);
@@ -1705,7 +1705,7 @@ hexchat_plugingui_remove (hexchat_plugin *ph, void *handle)
}
int
hexchat_emit_print (hexchat_plugin *ph, const char *event_name, ...)
zoitechat_emit_print (zoitechat_plugin *ph, const char *event_name, ...)
{
va_list args;
/* currently only 4 because no events use more than 4.
@@ -1732,7 +1732,7 @@ hexchat_emit_print (hexchat_plugin *ph, const char *event_name, ...)
}
int
hexchat_emit_print_attrs (hexchat_plugin *ph, hexchat_event_attrs *attrs,
zoitechat_emit_print_attrs (zoitechat_plugin *ph, zoitechat_event_attrs *attrs,
const char *event_name, ...)
{
va_list args;
@@ -1760,15 +1760,15 @@ hexchat_emit_print_attrs (hexchat_plugin *ph, hexchat_event_attrs *attrs,
}
char *
hexchat_gettext (hexchat_plugin *ph, const char *msgid)
zoitechat_gettext (zoitechat_plugin *ph, const char *msgid)
{
/* so that plugins can use HexChat's internal gettext strings. */
/* so that plugins can use ZoiteChat's internal gettext strings. */
/* e.g. The EXEC plugin uses this on Windows. */
return _(msgid);
}
void
hexchat_send_modes (hexchat_plugin *ph, const char **targets, int ntargets, int modes_per_line, char sign, char mode)
zoitechat_send_modes (zoitechat_plugin *ph, const char **targets, int ntargets, int modes_per_line, char sign, char mode)
{
char tbuf[514]; /* modes.c needs 512 + null */
@@ -1776,19 +1776,19 @@ hexchat_send_modes (hexchat_plugin *ph, const char **targets, int ntargets, int
}
char *
hexchat_strip (hexchat_plugin *ph, const char *str, int len, int flags)
zoitechat_strip (zoitechat_plugin *ph, const char *str, int len, int flags)
{
return strip_color ((char *)str, len, flags);
}
void
hexchat_free (hexchat_plugin *ph, void *ptr)
zoitechat_free (zoitechat_plugin *ph, void *ptr)
{
g_free (ptr);
}
static int
hexchat_pluginpref_set_str_real (hexchat_plugin *pl, const char *var, const char *value, int mode) /* mode: 0 = delete, 1 = save */
zoitechat_pluginpref_set_str_real (zoitechat_plugin *pl, const char *var, const char *value, int mode) /* mode: 0 = delete, 1 = save */
{
FILE *fpIn;
int fhOut;
@@ -1808,8 +1808,8 @@ hexchat_pluginpref_set_str_real (hexchat_plugin *pl, const char *var, const char
g_free (canon);
confname_tmp = g_strdup_printf ("%s.new", confname);
fhOut = hexchat_open_file (confname_tmp, O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
fpIn = hexchat_fopen_file (confname, "r", 0);
fhOut = zoitechat_open_file (confname_tmp, O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
fpIn = zoitechat_fopen_file (confname, "r", 0);
if (fhOut == -1) /* unable to save, abort */
{
@@ -1933,13 +1933,13 @@ hexchat_pluginpref_set_str_real (hexchat_plugin *pl, const char *var, const char
}
int
hexchat_pluginpref_set_str (hexchat_plugin *pl, const char *var, const char *value)
zoitechat_pluginpref_set_str (zoitechat_plugin *pl, const char *var, const char *value)
{
return hexchat_pluginpref_set_str_real (pl, var, value, 1);
return zoitechat_pluginpref_set_str_real (pl, var, value, 1);
}
static int
hexchat_pluginpref_get_str_real (hexchat_plugin *pl, const char *var, char *dest, int dest_len)
zoitechat_pluginpref_get_str_real (zoitechat_plugin *pl, const char *var, char *dest, int dest_len)
{
char *confname, *canon, *cfg, *unescaped_value;
char buf[512];
@@ -1971,27 +1971,27 @@ hexchat_pluginpref_get_str_real (hexchat_plugin *pl, const char *var, char *dest
}
int
hexchat_pluginpref_get_str (hexchat_plugin *pl, const char *var, char *dest)
zoitechat_pluginpref_get_str (zoitechat_plugin *pl, const char *var, char *dest)
{
/* All users of this must ensure dest is >= 512... */
return hexchat_pluginpref_get_str_real (pl, var, dest, 512);
return zoitechat_pluginpref_get_str_real (pl, var, dest, 512);
}
int
hexchat_pluginpref_set_int (hexchat_plugin *pl, const char *var, int value)
zoitechat_pluginpref_set_int (zoitechat_plugin *pl, const char *var, int value)
{
char buffer[12];
g_snprintf (buffer, sizeof (buffer), "%d", value);
return hexchat_pluginpref_set_str_real (pl, var, buffer, 1);
return zoitechat_pluginpref_set_str_real (pl, var, buffer, 1);
}
int
hexchat_pluginpref_get_int (hexchat_plugin *pl, const char *var)
zoitechat_pluginpref_get_int (zoitechat_plugin *pl, const char *var)
{
char buffer[12];
if (hexchat_pluginpref_get_str_real (pl, var, buffer, sizeof(buffer)))
if (zoitechat_pluginpref_get_str_real (pl, var, buffer, sizeof(buffer)))
{
int ret = atoi (buffer);
@@ -2008,13 +2008,13 @@ hexchat_pluginpref_get_int (hexchat_plugin *pl, const char *var)
}
int
hexchat_pluginpref_delete (hexchat_plugin *pl, const char *var)
zoitechat_pluginpref_delete (zoitechat_plugin *pl, const char *var)
{
return hexchat_pluginpref_set_str_real (pl, var, 0, 0);
return zoitechat_pluginpref_set_str_real (pl, var, 0, 0);
}
int
hexchat_pluginpref_list (hexchat_plugin *pl, char* dest)
zoitechat_pluginpref_list (zoitechat_plugin *pl, char* dest)
{
FILE *fpIn;
char confname[64];
@@ -2027,7 +2027,7 @@ hexchat_pluginpref_list (hexchat_plugin *pl, char* dest)
sprintf (confname, "addon_%s.conf", token);
g_free (token);
fpIn = hexchat_fopen_file (confname, "r", 0);
fpIn = zoitechat_fopen_file (confname, "r", 0);
if (fpIn == NULL) /* no existing config file, no parsing */
{