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

Perl plugin support

This commit is contained in:
Sebastien Helleu
2003-11-16 19:40:36 +00:00
parent fd9512bbbc
commit d4ec2e46aa
48 changed files with 6986 additions and 5844 deletions
+66 -11
View File
@@ -34,6 +34,7 @@
#include "weeconfig.h"
#include "../irc/irc.h"
#include "../gui/gui.h"
#include "../plugins/plugins.h"
/* WeeChat internal commands */
@@ -59,6 +60,12 @@ t_weechat_command weechat_commands[] =
{ "help", N_("display help about commands"),
N_("[command]"), N_("command: name of a WeeChat or IRC command"),
0, 1, weechat_cmd_help, NULL },
{ "perl", N_("list/load/unload Perl scripts"),
N_("[load filename] | [unload scriptname]"),
N_("filename: Perl script (file) to load\n"
"scriptname: name of script to unload\n"
"Without argument, /perl command lists all loaded Perl scripts."),
0, 2, weechat_cmd_perl, NULL },
{ "server", N_("list, add or remove servers"),
N_("[list] | "
"[servername hostname port [-auto | -noauto] [-pwd password] [-nicks nick1 "
@@ -531,7 +538,7 @@ exec_weechat_command (t_irc_server *server, char *string)
gui_printf (NULL,
_("%s wrong argument count for %s command \"%s\" "
"(expected: %d arg%s)\n"),
WEECHAT_ERROR, PACKAGE_NAME,
WEECHAT_ERROR, PACKAGE_NAME,
command + 1,
weechat_commands[i].max_arg,
(weechat_commands[i].max_arg >
@@ -973,6 +980,64 @@ weechat_cmd_help (int argc, char **argv)
return 0;
}
/*
* weechat_cmd_perl: list/load/unload Perl scripts
*/
int
weechat_cmd_perl (int argc, char **argv)
{
#ifdef PLUGIN_PERL
switch (argc)
{
case 0:
/* list all Perl scripts */
/* TODO: get list and display it */
break;
case 2:
if (strcmp (argv[0], "load") == 0)
{
/* load Perl script */
plugins_load (PLUGIN_PERL, argv[1]);
}
else
{
if (strcmp (argv[0], "unload") == 0)
{
/* unload Perl script */
}
else
{
gui_printf (NULL,
_("%s unknown option for \"%s\" command\n"),
WEECHAT_ERROR, "perl");
}
}
break;
default:
gui_printf (NULL,
_("%s wrong argument count for \"%s\" command\n"),
WEECHAT_ERROR, "perl");
}
#else
gui_printf (NULL,
_("WeeChat was build without Perl support.\n"
"Please rebuild WeeChat with "
"\"--enable-perl\" option for ./configure script\n");
#endif
return 0;
}
/*
* weechat_cmd_save: save options to disk
*/
int
weechat_cmd_save (int argc, char **argv)
{
return (config_write ((argc == 1) ? argv[0] : NULL));
}
/*
* weechat_cmd_server: list, add or remove server(s)
*/
@@ -1278,16 +1343,6 @@ weechat_cmd_server (int argc, char **argv)
return 0;
}
/*
* weechat_cmd_save: set options
*/
int
weechat_cmd_save (int argc, char **argv)
{
return (config_write ((argc == 1) ? argv[0] : NULL));
}
/*
* weechat_cmd_set: set options
*/
+2 -1
View File
@@ -72,8 +72,9 @@ extern int weechat_cmd_clear (int, char **);
extern int weechat_cmd_connect (int, char **);
extern int weechat_cmd_disconnect (int, char **);
extern int weechat_cmd_help (int, char **);
extern int weechat_cmd_server (int, char **);
extern int weechat_cmd_perl (int, char **);
extern int weechat_cmd_save (int, char **);
extern int weechat_cmd_server (int, char **);
extern int weechat_cmd_set (int, char **);
extern int weechat_cmd_unalias (char *);
+13 -2
View File
@@ -56,6 +56,7 @@
#include "command.h"
#include "../irc/irc.h"
#include "../gui/gui.h"
#include "../plugins/plugins.h"
/* char *display_name; */
@@ -65,11 +66,11 @@ FILE *log_file; /* WeeChat log file (~/.weechat/weechat.log */
/*
* log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
*/
void
log_printf (char *message, ...)
wee_log_printf (char *message, ...)
{
static char buffer[4096];
va_list argptr;
@@ -271,6 +272,9 @@ main (int argc, char *argv[])
/* init gui */
gui_init ();
/* init plugin interface(s) */
plugins_init ();
/* Welcome message - yeah! */
if (cfg_look_startup_logo)
{
@@ -315,7 +319,14 @@ main (int argc, char *argv[])
irc_login (ptr_server);
}
}
/* WeeChat main loop */
gui_main_loop ();
/* end plugin interface(s) */
plugins_end ();
/* disconnect from all servers */
server_disconnect_all ();
/* save config file */
+1 -1
View File
@@ -97,7 +97,7 @@ int quit_weechat;
extern int quit_weechat;
extern void log_printf (char *, ...);
extern void wee_log_printf (char *, ...);
extern void wee_shutdown ();
#endif /* weechat.h */
+2 -2
View File
@@ -948,7 +948,7 @@ config_create_default ()
}
printf (_("%s: creating default config file...\n"), PACKAGE_NAME);
log_printf (_("creating default config file\n"));
wee_log_printf (_("creating default config file\n"));
current_time = time (NULL);
sprintf (line, _("#\n# %s configuration file, created by "
@@ -1081,7 +1081,7 @@ config_write (char *config_name)
return -1;
}
log_printf (_("saving config to disk\n"));
wee_log_printf (_("saving config to disk\n"));
current_time = time (NULL);
sprintf (line, _("#\n# %s configuration file, created by "