Rebrand Perl plugin to HexChat,
Add /pl and plugin_pref Add help messages
This commit is contained in:
@@ -323,11 +323,11 @@ array2av (char *array[])
|
||||
return av;
|
||||
}
|
||||
|
||||
/* sets $Xchat::Embed::current_package */
|
||||
/* sets $HexChat::Embed::current_package */
|
||||
static void
|
||||
set_current_package (SV *package)
|
||||
{
|
||||
SV *current_package = get_sv ("Xchat::Embed::current_package", 1);
|
||||
SV *current_package = get_sv ("HexChat::Embed::current_package", 1);
|
||||
SvSetSV_nosteal (current_package, package);
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ fd_cb (int fd, int flags, void *userdata)
|
||||
XPUSHs (sv_2mortal (newSViv (PTR2IV (data->hook))));
|
||||
PUTBACK;
|
||||
|
||||
call_pv ("Xchat::unhook", G_EVAL);
|
||||
call_pv ("HexChat::unhook", G_EVAL);
|
||||
SPAGAIN;
|
||||
|
||||
SvREFCNT_dec (data->callback);
|
||||
@@ -429,7 +429,7 @@ timer_cb (void *userdata)
|
||||
XPUSHs (sv_mortalcopy (data->package));
|
||||
PUTBACK;
|
||||
|
||||
call_pv ("Xchat::unhook", G_EVAL);
|
||||
call_pv ("HexChat::unhook", G_EVAL);
|
||||
SPAGAIN;
|
||||
}
|
||||
}
|
||||
@@ -619,19 +619,19 @@ print_cb (char *word[], void *userdata)
|
||||
|
||||
/* custom IRC perl functions for scripting */
|
||||
|
||||
/* Xchat::Internal::register (scriptname, version, desc, shutdowncallback, filename)
|
||||
/* HexChat::Internal::register (scriptname, version, desc, shutdowncallback, filename)
|
||||
*
|
||||
*/
|
||||
|
||||
static
|
||||
XS (XS_Xchat_register)
|
||||
XS (XS_HexChat_register)
|
||||
{
|
||||
char *name, *version, *desc, *filename;
|
||||
void *gui_entry;
|
||||
dXSARGS;
|
||||
if (items != 4) {
|
||||
hexchat_printf (ph,
|
||||
"Usage: Xchat::Internal::register(scriptname, version, desc, filename)");
|
||||
"Usage: HexChat::Internal::register(scriptname, version, desc, filename)");
|
||||
} else {
|
||||
name = SvPV_nolen (ST (0));
|
||||
version = SvPV_nolen (ST (1));
|
||||
@@ -647,16 +647,16 @@ XS (XS_Xchat_register)
|
||||
}
|
||||
|
||||
|
||||
/* Xchat::print(output) */
|
||||
/* HexChat::print(output) */
|
||||
static
|
||||
XS (XS_Xchat_print)
|
||||
XS (XS_HexChat_print)
|
||||
{
|
||||
|
||||
char *text = NULL;
|
||||
|
||||
dXSARGS;
|
||||
if (items != 1) {
|
||||
hexchat_print (ph, "Usage: Xchat::Internal::print(text)");
|
||||
hexchat_print (ph, "Usage: HexChat::Internal::print(text)");
|
||||
} else {
|
||||
text = SvPV_nolen (ST (0));
|
||||
hexchat_print (ph, text);
|
||||
@@ -665,7 +665,7 @@ XS (XS_Xchat_print)
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_emit_print)
|
||||
XS (XS_HexChat_emit_print)
|
||||
{
|
||||
char *event_name;
|
||||
int RETVAL;
|
||||
@@ -673,7 +673,7 @@ XS (XS_Xchat_emit_print)
|
||||
|
||||
dXSARGS;
|
||||
if (items < 1) {
|
||||
hexchat_print (ph, "Usage: Xchat::emit_print(event_name, ...)");
|
||||
hexchat_print (ph, "Usage: HexChat::emit_print(event_name, ...)");
|
||||
} else {
|
||||
event_name = (char *) SvPV_nolen (ST (0));
|
||||
RETVAL = 0;
|
||||
@@ -719,7 +719,7 @@ XS (XS_Xchat_emit_print)
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_send_modes)
|
||||
XS (XS_HexChat_send_modes)
|
||||
{
|
||||
AV *p_targets = NULL;
|
||||
int modes_per_line = 0;
|
||||
@@ -733,7 +733,7 @@ XS (XS_Xchat_send_modes)
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 4) {
|
||||
hexchat_print (ph,
|
||||
"Usage: Xchat::send_modes( targets, sign, mode, modes_per_line)"
|
||||
"Usage: HexChat::send_modes( targets, sign, mode, modes_per_line)"
|
||||
);
|
||||
} else {
|
||||
if (SvROK (ST (0))) {
|
||||
@@ -771,12 +771,12 @@ XS (XS_Xchat_send_modes)
|
||||
}
|
||||
}
|
||||
static
|
||||
XS (XS_Xchat_get_info)
|
||||
XS (XS_HexChat_get_info)
|
||||
{
|
||||
SV *temp = NULL;
|
||||
dXSARGS;
|
||||
if (items != 1) {
|
||||
hexchat_print (ph, "Usage: Xchat::get_info(id)");
|
||||
hexchat_print (ph, "Usage: HexChat::get_info(id)");
|
||||
} else {
|
||||
SV *id = ST (0);
|
||||
const char *RETVAL;
|
||||
@@ -810,13 +810,13 @@ XS (XS_Xchat_get_info)
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_context_info)
|
||||
XS (XS_HexChat_context_info)
|
||||
{
|
||||
const char *const *fields;
|
||||
dXSARGS;
|
||||
|
||||
if (items > 0 ) {
|
||||
hexchat_print (ph, "Usage: Xchat::Internal::context_info()");
|
||||
hexchat_print (ph, "Usage: HexChat::Internal::context_info()");
|
||||
}
|
||||
fields = hexchat_list_fields (ph, "channels" );
|
||||
XPUSHs (list_item_to_sv (NULL, fields));
|
||||
@@ -824,14 +824,14 @@ XS (XS_Xchat_context_info)
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_get_prefs)
|
||||
XS (XS_HexChat_get_prefs)
|
||||
{
|
||||
const char *str;
|
||||
int integer;
|
||||
SV *temp = NULL;
|
||||
dXSARGS;
|
||||
if (items != 1) {
|
||||
hexchat_print (ph, "Usage: Xchat::get_prefs(name)");
|
||||
hexchat_print (ph, "Usage: HexChat::get_prefs(name)");
|
||||
} else {
|
||||
|
||||
|
||||
@@ -860,9 +860,9 @@ XS (XS_Xchat_get_prefs)
|
||||
}
|
||||
}
|
||||
|
||||
/* Xchat::Internal::hook_server(name, priority, callback, userdata) */
|
||||
/* HexChat::Internal::hook_server(name, priority, callback, userdata) */
|
||||
static
|
||||
XS (XS_Xchat_hook_server)
|
||||
XS (XS_HexChat_hook_server)
|
||||
{
|
||||
|
||||
char *name;
|
||||
@@ -877,7 +877,7 @@ XS (XS_Xchat_hook_server)
|
||||
|
||||
if (items != 5) {
|
||||
hexchat_print (ph,
|
||||
"Usage: Xchat::Internal::hook_server(name, priority, callback, userdata, package)");
|
||||
"Usage: HexChat::Internal::hook_server(name, priority, callback, userdata, package)");
|
||||
} else {
|
||||
name = SvPV_nolen (ST (0));
|
||||
pri = (int) SvIV (ST (1));
|
||||
@@ -901,9 +901,9 @@ XS (XS_Xchat_hook_server)
|
||||
}
|
||||
}
|
||||
|
||||
/* Xchat::Internal::hook_command(name, priority, callback, help_text, userdata) */
|
||||
/* HexChat::Internal::hook_command(name, priority, callback, help_text, userdata) */
|
||||
static
|
||||
XS (XS_Xchat_hook_command)
|
||||
XS (XS_HexChat_hook_command)
|
||||
{
|
||||
char *name;
|
||||
int pri;
|
||||
@@ -918,7 +918,7 @@ XS (XS_Xchat_hook_command)
|
||||
|
||||
if (items != 6) {
|
||||
hexchat_print (ph,
|
||||
"Usage: Xchat::Internal::hook_command(name, priority, callback, help_text, userdata, package)");
|
||||
"Usage: HexChat::Internal::hook_command(name, priority, callback, help_text, userdata, package)");
|
||||
} else {
|
||||
name = SvPV_nolen (ST (0));
|
||||
pri = (int) SvIV (ST (1));
|
||||
@@ -950,9 +950,9 @@ XS (XS_Xchat_hook_command)
|
||||
|
||||
}
|
||||
|
||||
/* Xchat::Internal::hook_print(name, priority, callback, [userdata]) */
|
||||
/* HexChat::Internal::hook_print(name, priority, callback, [userdata]) */
|
||||
static
|
||||
XS (XS_Xchat_hook_print)
|
||||
XS (XS_HexChat_hook_print)
|
||||
{
|
||||
|
||||
char *name;
|
||||
@@ -965,7 +965,7 @@ XS (XS_Xchat_hook_print)
|
||||
dXSARGS;
|
||||
if (items != 5) {
|
||||
hexchat_print (ph,
|
||||
"Usage: Xchat::Internal::hook_print(name, priority, callback, userdata, package)");
|
||||
"Usage: HexChat::Internal::hook_print(name, priority, callback, userdata, package)");
|
||||
} else {
|
||||
name = SvPV_nolen (ST (0));
|
||||
pri = (int) SvIV (ST (1));
|
||||
@@ -989,9 +989,9 @@ XS (XS_Xchat_hook_print)
|
||||
}
|
||||
}
|
||||
|
||||
/* Xchat::Internal::hook_timer(timeout, callback, userdata) */
|
||||
/* HexChat::Internal::hook_timer(timeout, callback, userdata) */
|
||||
static
|
||||
XS (XS_Xchat_hook_timer)
|
||||
XS (XS_HexChat_hook_timer)
|
||||
{
|
||||
int timeout;
|
||||
SV *callback;
|
||||
@@ -1004,7 +1004,7 @@ XS (XS_Xchat_hook_timer)
|
||||
|
||||
if (items != 4) {
|
||||
hexchat_print (ph,
|
||||
"Usage: Xchat::Internal::hook_timer(timeout, callback, userdata, package)");
|
||||
"Usage: HexChat::Internal::hook_timer(timeout, callback, userdata, package)");
|
||||
} else {
|
||||
timeout = (int) SvIV (ST (0));
|
||||
callback = ST (1);
|
||||
@@ -1028,9 +1028,9 @@ XS (XS_Xchat_hook_timer)
|
||||
}
|
||||
}
|
||||
|
||||
/* Xchat::Internal::hook_fd(fd, callback, flags, userdata) */
|
||||
/* HexChat::Internal::hook_fd(fd, callback, flags, userdata) */
|
||||
static
|
||||
XS (XS_Xchat_hook_fd)
|
||||
XS (XS_HexChat_hook_fd)
|
||||
{
|
||||
int fd;
|
||||
SV *callback;
|
||||
@@ -1044,7 +1044,7 @@ XS (XS_Xchat_hook_fd)
|
||||
|
||||
if (items != 5) {
|
||||
hexchat_print (ph,
|
||||
"Usage: Xchat::Internal::hook_fd(fd, callback, flags, userdata)");
|
||||
"Usage: HexChat::Internal::hook_fd(fd, callback, flags, userdata)");
|
||||
} else {
|
||||
fd = (int) SvIV (ST (0));
|
||||
callback = ST (1);
|
||||
@@ -1083,14 +1083,14 @@ XS (XS_Xchat_hook_fd)
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_unhook)
|
||||
XS (XS_HexChat_unhook)
|
||||
{
|
||||
hexchat_hook *hook;
|
||||
HookData *userdata;
|
||||
int retCount = 0;
|
||||
dXSARGS;
|
||||
if (items != 1) {
|
||||
hexchat_print (ph, "Usage: Xchat::unhook(hook)");
|
||||
hexchat_print (ph, "Usage: HexChat::unhook(hook)");
|
||||
} else {
|
||||
hook = INT2PTR (hexchat_hook *, SvUV (ST (0)));
|
||||
userdata = (HookData *) hexchat_unhook (ph, hook);
|
||||
@@ -1117,15 +1117,15 @@ XS (XS_Xchat_unhook)
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/* Xchat::Internal::command(command) */
|
||||
/* HexChat::Internal::command(command) */
|
||||
static
|
||||
XS (XS_Xchat_command)
|
||||
XS (XS_HexChat_command)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
|
||||
dXSARGS;
|
||||
if (items != 1) {
|
||||
hexchat_print (ph, "Usage: Xchat::Internal::command(command)");
|
||||
hexchat_print (ph, "Usage: HexChat::Internal::command(command)");
|
||||
} else {
|
||||
cmd = SvPV_nolen (ST (0));
|
||||
hexchat_command (ph, cmd);
|
||||
@@ -1135,7 +1135,7 @@ XS (XS_Xchat_command)
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_find_context)
|
||||
XS (XS_HexChat_find_context)
|
||||
{
|
||||
char *server = NULL;
|
||||
char *chan = NULL;
|
||||
@@ -1143,7 +1143,7 @@ XS (XS_Xchat_find_context)
|
||||
|
||||
dXSARGS;
|
||||
if (items > 2)
|
||||
hexchat_print (ph, "Usage: Xchat::find_context ([channel, [server]])");
|
||||
hexchat_print (ph, "Usage: HexChat::find_context ([channel, [server]])");
|
||||
{
|
||||
|
||||
switch (items) {
|
||||
@@ -1191,23 +1191,23 @@ XS (XS_Xchat_find_context)
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_get_context)
|
||||
XS (XS_HexChat_get_context)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 0) {
|
||||
hexchat_print (ph, "Usage: Xchat::get_context()");
|
||||
hexchat_print (ph, "Usage: HexChat::get_context()");
|
||||
} else {
|
||||
XSRETURN_IV (PTR2IV (hexchat_get_context (ph)));
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_set_context)
|
||||
XS (XS_HexChat_set_context)
|
||||
{
|
||||
hexchat_context *ctx;
|
||||
dXSARGS;
|
||||
if (items != 1) {
|
||||
hexchat_print (ph, "Usage: Xchat::set_context(ctx)");
|
||||
hexchat_print (ph, "Usage: HexChat::set_context(ctx)");
|
||||
} else {
|
||||
ctx = INT2PTR (hexchat_context *, SvUV (ST (0)));
|
||||
XSRETURN_IV ((IV) hexchat_set_context (ph, ctx));
|
||||
@@ -1215,11 +1215,11 @@ XS (XS_Xchat_set_context)
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_nickcmp)
|
||||
XS (XS_HexChat_nickcmp)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2) {
|
||||
hexchat_print (ph, "Usage: Xchat::nickcmp(s1, s2)");
|
||||
hexchat_print (ph, "Usage: HexChat::nickcmp(s1, s2)");
|
||||
} else {
|
||||
XSRETURN_IV ((IV) hexchat_nickcmp (ph, SvPV_nolen (ST (0)),
|
||||
SvPV_nolen (ST (1))));
|
||||
@@ -1227,7 +1227,7 @@ XS (XS_Xchat_nickcmp)
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_get_list)
|
||||
XS (XS_HexChat_get_list)
|
||||
{
|
||||
SV *name;
|
||||
hexchat_list *list;
|
||||
@@ -1236,7 +1236,7 @@ XS (XS_Xchat_get_list)
|
||||
dXSARGS;
|
||||
|
||||
if (items != 1) {
|
||||
hexchat_print (ph, "Usage: Xchat::get_list(name)");
|
||||
hexchat_print (ph, "Usage: HexChat::get_list(name)");
|
||||
} else {
|
||||
SP -= items; /*remove the argument list from the stack */
|
||||
|
||||
@@ -1268,12 +1268,12 @@ XS (XS_Xchat_get_list)
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_Xchat_Embed_plugingui_remove)
|
||||
XS (XS_HexChat_Embed_plugingui_remove)
|
||||
{
|
||||
void *gui_entry;
|
||||
dXSARGS;
|
||||
if (items != 1) {
|
||||
hexchat_print (ph, "Usage: Xchat::Embed::plugingui_remove(handle)");
|
||||
hexchat_print (ph, "Usage: HexChat::Embed::plugingui_remove(handle)");
|
||||
} else {
|
||||
gui_entry = INT2PTR (void *, SvUV (ST (0)));
|
||||
hexchat_plugingui_remove (ph, gui_entry);
|
||||
@@ -1281,6 +1281,72 @@ XS (XS_Xchat_Embed_plugingui_remove)
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_HexChat_plugin_pref_set)
|
||||
{
|
||||
dMARK;
|
||||
dAX;
|
||||
|
||||
XSRETURN_IV ((IV) hexchat_pluginpref_set_str (ph, SvPV_nolen (ST (0)),
|
||||
SvPV_nolen (ST (1))));
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_HexChat_plugin_pref_get)
|
||||
{
|
||||
int result;
|
||||
char value[512];
|
||||
|
||||
dMARK;
|
||||
dAX;
|
||||
|
||||
result = hexchat_pluginpref_get_str (ph, SvPV_nolen (ST (0)), value);
|
||||
|
||||
if (result)
|
||||
XSRETURN_PV (value);
|
||||
|
||||
XSRETURN_UNDEF;
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_HexChat_plugin_pref_delete)
|
||||
{
|
||||
dMARK;
|
||||
dAX;
|
||||
|
||||
XSRETURN_IV ((IV) hexchat_pluginpref_delete (ph, SvPV_nolen (ST (0))));
|
||||
}
|
||||
|
||||
static
|
||||
XS (XS_HexChat_plugin_pref_list)
|
||||
{
|
||||
char list[4096];
|
||||
char value[512];
|
||||
char *token;
|
||||
|
||||
dSP;
|
||||
dMARK;
|
||||
dAX;
|
||||
|
||||
if (!hexchat_pluginpref_list (ph, list))
|
||||
XSRETURN_EMPTY;
|
||||
|
||||
PUSHMARK (SP);
|
||||
|
||||
token = strtok (list, ",");
|
||||
while (token != NULL)
|
||||
{
|
||||
hexchat_pluginpref_get_str (ph, token, value);
|
||||
|
||||
XPUSHs (sv_2mortal (newSVpv (token, 0)));
|
||||
XPUSHs (sv_2mortal (newSVpv (value, 0)));
|
||||
|
||||
token = strtok (NULL, ",");
|
||||
}
|
||||
|
||||
PUTBACK;
|
||||
}
|
||||
|
||||
/* xs_init is the second argument perl_parse. As the name hints, it
|
||||
initializes XS subroutines (see the perlembed manpage) */
|
||||
static void
|
||||
@@ -1292,31 +1358,36 @@ xs_init (pTHX)
|
||||
scripts by the 'use perlmod;' construction */
|
||||
newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
|
||||
/* load up all the custom IRC perl functions */
|
||||
newXS ("Xchat::Internal::register", XS_Xchat_register, __FILE__);
|
||||
newXS ("Xchat::Internal::hook_server", XS_Xchat_hook_server, __FILE__);
|
||||
newXS ("Xchat::Internal::hook_command", XS_Xchat_hook_command, __FILE__);
|
||||
newXS ("Xchat::Internal::hook_print", XS_Xchat_hook_print, __FILE__);
|
||||
newXS ("Xchat::Internal::hook_timer", XS_Xchat_hook_timer, __FILE__);
|
||||
newXS ("Xchat::Internal::hook_fd", XS_Xchat_hook_fd, __FILE__);
|
||||
newXS ("Xchat::Internal::unhook", XS_Xchat_unhook, __FILE__);
|
||||
newXS ("Xchat::Internal::print", XS_Xchat_print, __FILE__);
|
||||
newXS ("Xchat::Internal::command", XS_Xchat_command, __FILE__);
|
||||
newXS ("Xchat::Internal::set_context", XS_Xchat_set_context, __FILE__);
|
||||
newXS ("Xchat::Internal::get_info", XS_Xchat_get_info, __FILE__);
|
||||
newXS ("Xchat::Internal::context_info", XS_Xchat_context_info, __FILE__);
|
||||
newXS ("Xchat::Internal::get_list", XS_Xchat_get_list, __FILE__);
|
||||
|
||||
newXS ("Xchat::find_context", XS_Xchat_find_context, __FILE__);
|
||||
newXS ("Xchat::get_context", XS_Xchat_get_context, __FILE__);
|
||||
newXS ("Xchat::get_prefs", XS_Xchat_get_prefs, __FILE__);
|
||||
newXS ("Xchat::emit_print", XS_Xchat_emit_print, __FILE__);
|
||||
newXS ("Xchat::send_modes", XS_Xchat_send_modes, __FILE__);
|
||||
newXS ("Xchat::nickcmp", XS_Xchat_nickcmp, __FILE__);
|
||||
newXS ("HexChat::Internal::register", XS_HexChat_register, __FILE__);
|
||||
newXS ("HexChat::Internal::hook_server", XS_HexChat_hook_server, __FILE__);
|
||||
newXS ("HexChat::Internal::hook_command", XS_HexChat_hook_command, __FILE__);
|
||||
newXS ("HexChat::Internal::hook_print", XS_HexChat_hook_print, __FILE__);
|
||||
newXS ("HexChat::Internal::hook_timer", XS_HexChat_hook_timer, __FILE__);
|
||||
newXS ("HexChat::Internal::hook_fd", XS_HexChat_hook_fd, __FILE__);
|
||||
newXS ("HexChat::Internal::unhook", XS_HexChat_unhook, __FILE__);
|
||||
newXS ("HexChat::Internal::print", XS_HexChat_print, __FILE__);
|
||||
newXS ("HexChat::Internal::command", XS_HexChat_command, __FILE__);
|
||||
newXS ("HexChat::Internal::set_context", XS_HexChat_set_context, __FILE__);
|
||||
newXS ("HexChat::Internal::get_info", XS_HexChat_get_info, __FILE__);
|
||||
newXS ("HexChat::Internal::context_info", XS_HexChat_context_info, __FILE__);
|
||||
newXS ("HexChat::Internal::get_list", XS_HexChat_get_list, __FILE__);
|
||||
|
||||
newXS ("Xchat::Embed::plugingui_remove", XS_Xchat_Embed_plugingui_remove,
|
||||
newXS ("HexChat::Internal::plugin_pref_set", XS_HexChat_plugin_pref_set, __FILE__);
|
||||
newXS ("HexChat::Internal::plugin_pref_get", XS_HexChat_plugin_pref_get, __FILE__);
|
||||
newXS ("HexChat::Internal::plugin_pref_delete", XS_HexChat_plugin_pref_delete, __FILE__);
|
||||
newXS ("HexChat::Internal::plugin_pref_list", XS_HexChat_plugin_pref_list, __FILE__);
|
||||
|
||||
newXS ("HexChat::find_context", XS_HexChat_find_context, __FILE__);
|
||||
newXS ("HexChat::get_context", XS_HexChat_get_context, __FILE__);
|
||||
newXS ("HexChat::get_prefs", XS_HexChat_get_prefs, __FILE__);
|
||||
newXS ("HexChat::emit_print", XS_HexChat_emit_print, __FILE__);
|
||||
newXS ("HexChat::send_modes", XS_HexChat_send_modes, __FILE__);
|
||||
newXS ("HexChat::nickcmp", XS_HexChat_nickcmp, __FILE__);
|
||||
|
||||
newXS ("HexChat::Embed::plugingui_remove", XS_HexChat_Embed_plugingui_remove,
|
||||
__FILE__);
|
||||
|
||||
stash = get_hv ("Xchat::", TRUE);
|
||||
stash = get_hv ("HexChat::", TRUE);
|
||||
if (stash == NULL) {
|
||||
exit (1);
|
||||
}
|
||||
@@ -1328,7 +1399,8 @@ xs_init (pTHX)
|
||||
newCONSTSUB (stash, "PRI_LOWEST", newSViv (HEXCHAT_PRI_LOWEST));
|
||||
|
||||
newCONSTSUB (stash, "EAT_NONE", newSViv (HEXCHAT_EAT_NONE));
|
||||
newCONSTSUB (stash, "EAT_XCHAT", newSViv (HEXCHAT_EAT_HEXCHAT));
|
||||
newCONSTSUB (stash, "EAT_HEXCHAT", newSViv (HEXCHAT_EAT_HEXCHAT));
|
||||
newCONSTSUB (stash, "EAT_XCHAT", newSViv (HEXCHAT_EAT_HEXCHAT)); /* for compatibility */
|
||||
newCONSTSUB (stash, "EAT_PLUGIN", newSViv (HEXCHAT_EAT_PLUGIN));
|
||||
newCONSTSUB (stash, "EAT_ALL", newSViv (HEXCHAT_EAT_ALL));
|
||||
newCONSTSUB (stash, "FD_READ", newSViv (HEXCHAT_FD_READ));
|
||||
@@ -1338,7 +1410,7 @@ xs_init (pTHX)
|
||||
newCONSTSUB (stash, "KEEP", newSViv (1));
|
||||
newCONSTSUB (stash, "REMOVE", newSViv (0));
|
||||
|
||||
version = get_sv( "Xchat::VERSION", 1 );
|
||||
version = get_sv( "HexChat::VERSION", 1 );
|
||||
sv_setpv( version, PACKAGE_VERSION );
|
||||
}
|
||||
|
||||
@@ -1352,7 +1424,7 @@ perl_init (void)
|
||||
static const char xchat_definitions[] = {
|
||||
/* Redefine the $SIG{__WARN__} handler to have HexChat
|
||||
printing warnings in the main window. (TheHobbit) */
|
||||
#include "xchat.pm.h"
|
||||
#include "hexchat.pm.h"
|
||||
};
|
||||
#ifdef OLD_PERL
|
||||
static const char irc_definitions[] = {
|
||||
@@ -1448,7 +1520,7 @@ perl_load_file (char *filename)
|
||||
perl_init ();
|
||||
}
|
||||
|
||||
return execute_perl (sv_2mortal (newSVpv ("Xchat::Embed::load", 0)),
|
||||
return execute_perl (sv_2mortal (newSVpv ("HexChat::Embed::load", 0)),
|
||||
filename);
|
||||
|
||||
}
|
||||
@@ -1458,7 +1530,7 @@ perl_end (void)
|
||||
{
|
||||
|
||||
if (my_perl != NULL) {
|
||||
execute_perl (sv_2mortal (newSVpv ("Xchat::Embed::unload_all", 0)), "");
|
||||
execute_perl (sv_2mortal (newSVpv ("HexChat::Embed::unload_all", 0)), "");
|
||||
PL_perl_destruct_level = 1;
|
||||
perl_destruct (my_perl);
|
||||
perl_free (my_perl);
|
||||
@@ -1472,7 +1544,7 @@ static int
|
||||
perl_command_unloadall (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
if (my_perl != NULL) {
|
||||
execute_perl (sv_2mortal (newSVpv ("Xchat::Embed::unload_all", 0)), "");
|
||||
execute_perl (sv_2mortal (newSVpv ("HexChat::Embed::unload_all", 0)), "");
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
|
||||
@@ -1483,7 +1555,7 @@ static int
|
||||
perl_command_reloadall (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
if (my_perl != NULL) {
|
||||
execute_perl (sv_2mortal (newSVpv ("Xchat::Embed::reload_all", 0)), "");
|
||||
execute_perl (sv_2mortal (newSVpv ("HexChat::Embed::reload_all", 0)), "");
|
||||
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
} else {
|
||||
@@ -1512,7 +1584,7 @@ perl_command_unload (char *word[], char *word_eol[], void *userdata)
|
||||
char *file = get_filename (word, word_eol);
|
||||
|
||||
if (my_perl != NULL && file != NULL) {
|
||||
execute_perl (sv_2mortal (newSVpv ("Xchat::Embed::unload", 0)), file);
|
||||
execute_perl (sv_2mortal (newSVpv ("HexChat::Embed::unload", 0)), file);
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
|
||||
@@ -1525,7 +1597,7 @@ perl_command_reload (char *word[], char *word_eol[], void *eat)
|
||||
char *file = get_filename (word, word_eol);
|
||||
|
||||
if (my_perl != NULL && file != NULL) {
|
||||
execute_perl (sv_2mortal (newSVpv ("Xchat::Embed::reload", 0)), file);
|
||||
execute_perl (sv_2mortal (newSVpv ("HexChat::Embed::reload", 0)), file);
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
|
||||
@@ -1535,6 +1607,15 @@ perl_command_reload (char *word[], char *word_eol[], void *eat)
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
static int
|
||||
perl_command_eval (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
if (my_perl != NULL)
|
||||
execute_perl (sv_2mortal (newSVpv ("HexChat::Embed::evaluate", 0)), word_eol[2]);
|
||||
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
|
||||
void
|
||||
hexchat_plugin_get_info (char **name, char **desc, char **version,
|
||||
void **reserved)
|
||||
@@ -1572,12 +1653,15 @@ hexchat_plugin_init (hexchat_plugin * plugin_handle, char **plugin_name,
|
||||
0);
|
||||
hexchat_hook_command (ph, "reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
|
||||
0);
|
||||
hexchat_hook_command (ph, "pl_reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
|
||||
(int*)1);
|
||||
hexchat_hook_command (ph, "pl_reload", HEXCHAT_PRI_NORM, perl_command_reload,
|
||||
"Reloads a Perl script. Syntax: /pl_reload <filename.pl>", (int*)1);
|
||||
hexchat_hook_command (ph, "unloadall", HEXCHAT_PRI_NORM,
|
||||
perl_command_unloadall, 0, 0);
|
||||
perl_command_unloadall, "Unloads all loaded Perl scripts.", 0);
|
||||
hexchat_hook_command (ph, "reloadall", HEXCHAT_PRI_NORM,
|
||||
perl_command_reloadall, 0, 0);
|
||||
perl_command_reloadall, "Realoads all loaded Perl scripts.", 0);
|
||||
|
||||
hexchat_hook_command (ph, "pl", HEXCHAT_PRI_NORM,
|
||||
perl_command_eval, "Evaluates Perl code. Syntax: /pl <perl code>", 0);
|
||||
|
||||
/*perl_init (); */
|
||||
hexchat_hook_timer (ph, 0, perl_auto_load, NULL );
|
||||
|
Reference in New Issue
Block a user