1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-06 09:43:13 +02:00

Added Perl message handlers

This commit is contained in:
Sebastien Helleu
2003-11-17 21:07:17 +00:00
parent fe4ca01615
commit edcc01bcf0
18 changed files with 124 additions and 20 deletions
+4 -2
View File
@@ -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 =
{
+1
View File
@@ -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 ();
+31
View File
@@ -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
}
/*
@@ -173,6 +177,33 @@ plugins_msg_handlers_free_all ()
plugins_msg_handler_free (plugins_msg_handlers);
}
/*
* 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
*/
+1
View File
@@ -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 */