summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2003-11-22 16:55:56 +0000
committerSebastien Helleu <flashcode@flashtux.org>2003-11-22 16:55:56 +0000
commitba65f5ec3056b73cbde03475b8b02463cc1a355f (patch)
tree29e1e9bca1db927de4bcbe5d5e4ce626910dc7d7 /src/plugins
parent7779b2f78eb11fe3ae81e8352864802c02ce0634 (diff)
downloadweechat-ba65f5ec3056b73cbde03475b8b02463cc1a355f.zip
Renamed PLUGIN_* macros and fixed bug in "IRC::add_message_handler" function
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/perl/wee-perl.c13
-rw-r--r--src/plugins/plugins.c16
-rw-r--r--src/plugins/plugins.h8
3 files changed, 19 insertions, 18 deletions
diff --git a/src/plugins/perl/wee-perl.c b/src/plugins/perl/wee-perl.c
index 21926bf4a..eb5941944 100644
--- a/src/plugins/perl/wee-perl.c
+++ b/src/plugins/perl/wee-perl.c
@@ -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;
}
diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c
index 704ccf474..c78f2fe3e 100644
--- a/src/plugins/plugins.c
+++ b/src/plugins/plugins.c
@@ -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
diff --git a/src/plugins/plugins.h b/src/plugins/plugins.h
index 9c9fea300..96c7ca130 100644
--- a/src/plugins/plugins.h
+++ b/src/plugins/plugins.h
@@ -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;