summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/perl/wee-perl.c6
-rw-r--r--src/plugins/perl/wee-perl.h1
-rw-r--r--src/plugins/plugins.c31
-rw-r--r--src/plugins/plugins.h1
4 files changed, 37 insertions, 2 deletions
diff --git a/src/plugins/perl/wee-perl.c b/src/plugins/perl/wee-perl.c
index f0d105843..2433e8fab 100644
--- a/src/plugins/perl/wee-perl.c
+++ b/src/plugins/perl/wee-perl.c
@@ -101,7 +101,9 @@ static XS (XS_IRC_print)
for (i = 0; i < items; i++)
{
message = SvPV (ST (i), integer);
- gui_printf (NULL, "%s\n", message);
+ gui_printf (gui_current_window, "%s%s",
+ message,
+ (message[strlen (message) - 1] == '\n') ? "" : "\n");
}
XSRETURN_EMPTY;
@@ -144,7 +146,7 @@ void
wee_perl_init ()
{
char *perl_args[] = { "", "-e", "0" };
- /* This Perl code is extracted/modified from X-Chat IRC client */
+ /* Following Perl code is extracted/modified from X-Chat IRC client */
/* X-Chat is (c) 1998-2002 Peter Zelezny */
char *weechat_perl_func =
{
diff --git a/src/plugins/perl/wee-perl.h b/src/plugins/perl/wee-perl.h
index 5898285ca..c018bf44a 100644
--- a/src/plugins/perl/wee-perl.h
+++ b/src/plugins/perl/wee-perl.h
@@ -37,6 +37,7 @@ struct t_perl_script
extern void wee_perl_init ();
extern t_perl_script *wee_perl_search (char *);
+extern int wee_perl_exec (char *, char *);
extern int wee_perl_load (char *);
extern void wee_perl_unload (t_perl_script *);
extern void wee_perl_unload_all ();
diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c
index f7cde6d6d..8ef0627e4 100644
--- a/src/plugins/plugins.c
+++ b/src/plugins/plugins.c
@@ -62,6 +62,7 @@ plugins_init ()
void
plugins_load (int plugin_type, char *filename)
{
+ #ifdef PLUGINS
switch (plugin_type)
{
case PLUGIN_PERL:
@@ -76,6 +77,7 @@ plugins_load (int plugin_type, char *filename)
/* TODO: load Ruby script */
break;
}
+ #endif
}
/*
@@ -85,6 +87,7 @@ plugins_load (int plugin_type, char *filename)
void
plugins_unload (int plugin_type, char *scriptname)
{
+ #ifdef PLUGINS
switch (plugin_type)
{
case PLUGIN_PERL:
@@ -99,6 +102,7 @@ plugins_unload (int plugin_type, char *scriptname)
/* TODO: load Ruby script */
break;
}
+ #endif
}
/*
@@ -174,6 +178,33 @@ plugins_msg_handlers_free_all ()
}
/*
+ * plugins_event_msg: IRC message received => call all handlers for this message
+ */
+
+void
+plugins_event_msg (char *command, char *arguments)
+{
+ #ifdef PLUGINS
+ t_plugin_handler *ptr_plugin_handler;
+
+ for (ptr_plugin_handler = plugins_msg_handlers; ptr_plugin_handler;
+ ptr_plugin_handler = ptr_plugin_handler->next_handler)
+ {
+ if (strcasecmp (ptr_plugin_handler->name, command) == 0)
+ {
+ #ifdef PLUGIN_PERL
+ if (ptr_plugin_handler->plugin_type == PLUGIN_PERL)
+ wee_perl_exec (ptr_plugin_handler->function_name, arguments);
+ #endif
+ }
+ }
+ #else
+ /* make gcc happy */
+ (void) command;
+ #endif
+}
+
+/*
* plugins_end: shutdown plugin interface
*/
diff --git a/src/plugins/plugins.h b/src/plugins/plugins.h
index 68ea44c27..aa1553f1e 100644
--- a/src/plugins/plugins.h
+++ b/src/plugins/plugins.h
@@ -44,6 +44,7 @@ extern void plugins_init ();
extern void plugins_load (int, char *);
extern void plugins_unload (int, char *);
extern void plugins_msg_handler_add (int, char *, char *);
+extern void plugins_event_msg (char *, char *);
extern void plugins_end ();
#endif /* plugins.h */