mirror of
https://github.com/weechat/weechat.git
synced 2026-06-24 20:06:38 +02:00
Renamed PLUGIN_* macros and fixed bug in "IRC::add_message_handler" function
This commit is contained in:
@@ -1026,8 +1026,12 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
gui_printf (NULL,
|
||||
_("WeeChat was build without Perl support.\n"
|
||||
"Please rebuild WeeChat with "
|
||||
"\"--enable-perl\" option for ./configure script\n");
|
||||
"\"--enable-perl\" option for ./configure script\n"));
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,21 +135,22 @@ static XS (XS_IRC_add_command_handler)
|
||||
{
|
||||
char *name, *function;
|
||||
int integer;
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
dXSARGS;
|
||||
|
||||
name = SvPV (ST (0), integer);
|
||||
function = SvPV (ST (1), integer);
|
||||
if (index_command_search (name))
|
||||
if (!index_command_search (name))
|
||||
index_command_new (name);
|
||||
ptr_plugin_handler = plugin_handler_search (plugin_cmd_handlers, name);
|
||||
if (ptr_plugin_handler)
|
||||
{
|
||||
gui_printf (gui_current_window,
|
||||
_("Perl error: alias or command \"%s\" already exists!\n"),
|
||||
name);
|
||||
free (ptr_plugin_handler->function_name);
|
||||
ptr_plugin_handler->function_name = strdup (function);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin_handler_add (&plugin_cmd_handlers, &last_plugin_cmd_handler,
|
||||
PLUGIN_PERL, name, function);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,15 +66,15 @@ plugin_load (int plugin_type, char *filename)
|
||||
#ifdef PLUGINS
|
||||
switch (plugin_type)
|
||||
{
|
||||
case PLUGIN_PERL:
|
||||
case PLUGIN_TYPE_PERL:
|
||||
#ifdef PLUGIN_PERL
|
||||
wee_perl_load (filename);
|
||||
#endif
|
||||
break;
|
||||
case PLUGIN_PYTHON:
|
||||
case PLUGIN_TYPE_PYTHON:
|
||||
/* TODO: load Python script */
|
||||
break;
|
||||
case PLUGIN_RUBY:
|
||||
case PLUGIN_TYPE_RUBY:
|
||||
/* TODO: load Ruby script */
|
||||
break;
|
||||
}
|
||||
@@ -91,15 +91,15 @@ plugin_unload (int plugin_type, char *scriptname)
|
||||
#ifdef PLUGINS
|
||||
switch (plugin_type)
|
||||
{
|
||||
case PLUGIN_PERL:
|
||||
case PLUGIN_TYPE_PERL:
|
||||
#ifdef PLUGIN_PERL
|
||||
wee_perl_unload (wee_perl_search (scriptname));
|
||||
#endif
|
||||
break;
|
||||
case PLUGIN_PYTHON:
|
||||
case PLUGIN_TYPE_PYTHON:
|
||||
/* TODO: load Python script */
|
||||
break;
|
||||
case PLUGIN_RUBY:
|
||||
case PLUGIN_TYPE_RUBY:
|
||||
/* TODO: load Ruby script */
|
||||
break;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ plugin_event_msg (char *irc_command, char *arguments)
|
||||
if (strcasecmp (ptr_plugin_handler->name, irc_command) == 0)
|
||||
{
|
||||
#ifdef PLUGIN_PERL
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_PERL)
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
wee_perl_exec (ptr_plugin_handler->function_name, arguments);
|
||||
#endif
|
||||
}
|
||||
@@ -248,7 +248,7 @@ plugin_exec_command (char *user_command, char *arguments)
|
||||
if (strcasecmp (ptr_plugin_handler->name, user_command) == 0)
|
||||
{
|
||||
#ifdef PLUGIN_PERL
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_PERL)
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
wee_perl_exec (ptr_plugin_handler->function_name, arguments);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
#ifndef __WEECHAT_PLUGINS_H
|
||||
#define __WEECHAT_PLUGINS_H 1
|
||||
|
||||
#define PLUGIN_UNKNOWN 0
|
||||
#define PLUGIN_PERL 1
|
||||
#define PLUGIN_PYTHON 2
|
||||
#define PLUGIN_RUBY 3
|
||||
#define PLUGIN_TYPE_UNKNOWN 0
|
||||
#define PLUGIN_TYPE_PERL 1
|
||||
#define PLUGIN_TYPE_PYTHON 2
|
||||
#define PLUGIN_TYPE_RUBY 3
|
||||
|
||||
typedef struct t_plugin_handler t_plugin_handler;
|
||||
|
||||
|
||||
@@ -1026,8 +1026,12 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
gui_printf (NULL,
|
||||
_("WeeChat was build without Perl support.\n"
|
||||
"Please rebuild WeeChat with "
|
||||
"\"--enable-perl\" option for ./configure script\n");
|
||||
"\"--enable-perl\" option for ./configure script\n"));
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,21 +135,22 @@ static XS (XS_IRC_add_command_handler)
|
||||
{
|
||||
char *name, *function;
|
||||
int integer;
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
dXSARGS;
|
||||
|
||||
name = SvPV (ST (0), integer);
|
||||
function = SvPV (ST (1), integer);
|
||||
if (index_command_search (name))
|
||||
if (!index_command_search (name))
|
||||
index_command_new (name);
|
||||
ptr_plugin_handler = plugin_handler_search (plugin_cmd_handlers, name);
|
||||
if (ptr_plugin_handler)
|
||||
{
|
||||
gui_printf (gui_current_window,
|
||||
_("Perl error: alias or command \"%s\" already exists!\n"),
|
||||
name);
|
||||
free (ptr_plugin_handler->function_name);
|
||||
ptr_plugin_handler->function_name = strdup (function);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin_handler_add (&plugin_cmd_handlers, &last_plugin_cmd_handler,
|
||||
PLUGIN_PERL, name, function);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,15 +66,15 @@ plugin_load (int plugin_type, char *filename)
|
||||
#ifdef PLUGINS
|
||||
switch (plugin_type)
|
||||
{
|
||||
case PLUGIN_PERL:
|
||||
case PLUGIN_TYPE_PERL:
|
||||
#ifdef PLUGIN_PERL
|
||||
wee_perl_load (filename);
|
||||
#endif
|
||||
break;
|
||||
case PLUGIN_PYTHON:
|
||||
case PLUGIN_TYPE_PYTHON:
|
||||
/* TODO: load Python script */
|
||||
break;
|
||||
case PLUGIN_RUBY:
|
||||
case PLUGIN_TYPE_RUBY:
|
||||
/* TODO: load Ruby script */
|
||||
break;
|
||||
}
|
||||
@@ -91,15 +91,15 @@ plugin_unload (int plugin_type, char *scriptname)
|
||||
#ifdef PLUGINS
|
||||
switch (plugin_type)
|
||||
{
|
||||
case PLUGIN_PERL:
|
||||
case PLUGIN_TYPE_PERL:
|
||||
#ifdef PLUGIN_PERL
|
||||
wee_perl_unload (wee_perl_search (scriptname));
|
||||
#endif
|
||||
break;
|
||||
case PLUGIN_PYTHON:
|
||||
case PLUGIN_TYPE_PYTHON:
|
||||
/* TODO: load Python script */
|
||||
break;
|
||||
case PLUGIN_RUBY:
|
||||
case PLUGIN_TYPE_RUBY:
|
||||
/* TODO: load Ruby script */
|
||||
break;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ plugin_event_msg (char *irc_command, char *arguments)
|
||||
if (strcasecmp (ptr_plugin_handler->name, irc_command) == 0)
|
||||
{
|
||||
#ifdef PLUGIN_PERL
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_PERL)
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
wee_perl_exec (ptr_plugin_handler->function_name, arguments);
|
||||
#endif
|
||||
}
|
||||
@@ -248,7 +248,7 @@ plugin_exec_command (char *user_command, char *arguments)
|
||||
if (strcasecmp (ptr_plugin_handler->name, user_command) == 0)
|
||||
{
|
||||
#ifdef PLUGIN_PERL
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_PERL)
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
wee_perl_exec (ptr_plugin_handler->function_name, arguments);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
#ifndef __WEECHAT_PLUGINS_H
|
||||
#define __WEECHAT_PLUGINS_H 1
|
||||
|
||||
#define PLUGIN_UNKNOWN 0
|
||||
#define PLUGIN_PERL 1
|
||||
#define PLUGIN_PYTHON 2
|
||||
#define PLUGIN_RUBY 3
|
||||
#define PLUGIN_TYPE_UNKNOWN 0
|
||||
#define PLUGIN_TYPE_PERL 1
|
||||
#define PLUGIN_TYPE_PYTHON 2
|
||||
#define PLUGIN_TYPE_RUBY 3
|
||||
|
||||
typedef struct t_plugin_handler t_plugin_handler;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user