summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-05-05 16:26:34 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-05-05 16:26:34 +0000
commitc8ad30020ba80fa1a27d21385a6f2869830b91c0 (patch)
tree589fcc057b4641a348a0b2ca7277770069a107c1 /src/common
parentc6fc8bd1479a046e5a0e9ba5f344ebfdc9ce4bd1 (diff)
downloadweechat-c8ad30020ba80fa1a27d21385a6f2869830b91c0.zip
Improved Perl interface and some changes in Python:
- function "print_with_channel" was removed - function "command" now runs weechat command or send text to channel - Perl functions are now called with weechat::name (instead of IRC::name) - IRC::xxx functions are still active for compatibility with old scripts
Diffstat (limited to 'src/common')
-rw-r--r--src/common/command.c44
-rw-r--r--src/common/completion.c16
-rw-r--r--src/common/weechat.c2
-rw-r--r--src/common/weeconfig.c4
4 files changed, 30 insertions, 36 deletions
diff --git a/src/common/command.c b/src/common/command.c
index d2a8c14f6..61d65db7e 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -73,12 +73,12 @@ t_weechat_command weechat_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] | [autoload] | [unload]"),
+ N_("[load filename] | [autoload] | [reload] | [unload]"),
N_("filename: Perl script (file) to load\n"
"Without argument, /perl command lists all loaded Perl scripts."),
0, 2, weechat_cmd_perl, NULL },
{ "python", N_("list/load/unload Python scripts"),
- N_("[load filename] | [autoload] | [unload]"),
+ N_("[load filename] | [autoload] | [reload] | [unload]"),
N_("filename: Python script (file) to load\n"
"Without argument, /python command lists all loaded Python scripts."),
0, 2, weechat_cmd_python, NULL },
@@ -1302,7 +1302,7 @@ weechat_cmd_perl (int argc, char **argv)
case 0:
/* list registered Perl scripts */
gui_printf (NULL, "\n");
- gui_printf (NULL, _("Registered Perl scripts:\n"));
+ gui_printf (NULL, _("Registered %s scripts:\n"), "Perl");
if (perl_scripts)
{
for (ptr_plugin_script = perl_scripts; ptr_plugin_script;
@@ -1324,7 +1324,7 @@ weechat_cmd_perl (int argc, char **argv)
/* list Perl message handlers */
gui_printf (NULL, "\n");
- gui_printf (NULL, _("Perl message handlers:\n"));
+ gui_printf (NULL, _("%s message handlers:\n"), "Perl");
handler_found = 0;
for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler;
ptr_plugin_handler = ptr_plugin_handler->next_handler)
@@ -1333,8 +1333,9 @@ weechat_cmd_perl (int argc, char **argv)
{
handler_found = 1;
irc_display_prefix (NULL, PREFIX_PLUGIN);
- gui_printf (NULL, _(" IRC(%s) => Perl(%s)\n"),
+ gui_printf (NULL, _(" IRC(%s) => %s(%s)\n"),
ptr_plugin_handler->name,
+ "Perl",
ptr_plugin_handler->function_name);
}
}
@@ -1346,7 +1347,7 @@ weechat_cmd_perl (int argc, char **argv)
/* list Perl command handlers */
gui_printf (NULL, "\n");
- gui_printf (NULL, _("Perl command handlers:\n"));
+ gui_printf (NULL, _("%s command handlers:\n"), "Perl");
handler_found = 0;
for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler;
ptr_plugin_handler = ptr_plugin_handler->next_handler)
@@ -1355,8 +1356,9 @@ weechat_cmd_perl (int argc, char **argv)
{
handler_found = 1;
irc_display_prefix (NULL, PREFIX_PLUGIN);
- gui_printf (NULL, _(" Command /%s => Perl(%s)\n"),
+ gui_printf (NULL, _(" Command /%s => %s(%s)\n"),
ptr_plugin_handler->name,
+ "Perl",
ptr_plugin_handler->function_name);
}
}
@@ -1370,13 +1372,13 @@ weechat_cmd_perl (int argc, char **argv)
case 1:
if (strcasecmp (argv[0], "autoload") == 0)
plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload");
- if (strcasecmp (argv[0], "unload") == 0)
+ else if (strcasecmp (argv[0], "reload") == 0)
{
- /* unload all Perl scripts */
plugin_unload (PLUGIN_TYPE_PERL, NULL);
- irc_display_prefix (NULL, PREFIX_PLUGIN);
- gui_printf (NULL, _("Perl scripts unloaded\n"));
+ plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload");
}
+ else if (strcasecmp (argv[0], "unload") == 0)
+ plugin_unload (PLUGIN_TYPE_PERL, NULL);
break;
case 2:
if (strcasecmp (argv[0], "load") == 0)
@@ -1443,7 +1445,7 @@ weechat_cmd_python (int argc, char **argv)
case 0:
/* list registered Python scripts */
gui_printf (NULL, "\n");
- gui_printf (NULL, _("Registered Python scripts:\n"));
+ gui_printf (NULL, _("Registered %s scripts:\n"), "Python");
if (python_scripts)
{
for (ptr_plugin_script = python_scripts; ptr_plugin_script;
@@ -1465,7 +1467,7 @@ weechat_cmd_python (int argc, char **argv)
/* list Python message handlers */
gui_printf (NULL, "\n");
- gui_printf (NULL, _("Python message handlers:\n"));
+ gui_printf (NULL, _("%s message handlers:\n"), "Python");
handler_found = 0;
for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler;
ptr_plugin_handler = ptr_plugin_handler->next_handler)
@@ -1474,8 +1476,9 @@ weechat_cmd_python (int argc, char **argv)
{
handler_found = 1;
irc_display_prefix (NULL, PREFIX_PLUGIN);
- gui_printf (NULL, _(" IRC(%s) => Python(%s)\n"),
+ gui_printf (NULL, _(" IRC(%s) => %s(%s)\n"),
ptr_plugin_handler->name,
+ "Python",
ptr_plugin_handler->function_name);
}
}
@@ -1487,7 +1490,7 @@ weechat_cmd_python (int argc, char **argv)
/* list Python command handlers */
gui_printf (NULL, "\n");
- gui_printf (NULL, _("Python command handlers:\n"));
+ gui_printf (NULL, _("%s command handlers:\n"), "Python");
handler_found = 0;
for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler;
ptr_plugin_handler = ptr_plugin_handler->next_handler)
@@ -1496,8 +1499,9 @@ weechat_cmd_python (int argc, char **argv)
{
handler_found = 1;
irc_display_prefix (NULL, PREFIX_PLUGIN);
- gui_printf (NULL, _(" Command /%s => Python(%s)\n"),
+ gui_printf (NULL, _(" Command /%s => %s(%s)\n"),
ptr_plugin_handler->name,
+ "Python",
ptr_plugin_handler->function_name);
}
}
@@ -1511,13 +1515,13 @@ weechat_cmd_python (int argc, char **argv)
case 1:
if (strcasecmp (argv[0], "autoload") == 0)
plugin_auto_load (PLUGIN_TYPE_PYTHON, "python/autoload");
- if (strcasecmp (argv[0], "unload") == 0)
+ else if (strcasecmp (argv[0], "reload") == 0)
{
- /* unload all Python scripts */
plugin_unload (PLUGIN_TYPE_PYTHON, NULL);
- irc_display_prefix (NULL, PREFIX_PLUGIN);
- gui_printf (NULL, _("Python scripts unloaded\n"));
+ plugin_auto_load (PLUGIN_TYPE_PYTHON, "python/autoload");
}
+ else if (strcasecmp (argv[0], "unload") == 0)
+ plugin_unload (PLUGIN_TYPE_PYTHON, NULL);
break;
case 2:
if (strcasecmp (argv[0], "load") == 0)
diff --git a/src/common/completion.c b/src/common/completion.c
index 03b6ada59..1975415f1 100644
--- a/src/common/completion.c
+++ b/src/common/completion.c
@@ -193,7 +193,8 @@ completion_build_list (t_completion *completion, void *channel)
}
return;
}
- if ((strcasecmp (completion->base_command, "perl") == 0)
+ if (((strcasecmp (completion->base_command, "perl") == 0)
+ || (strcasecmp (completion->base_command, "python") == 0))
&& (completion->base_command_arg == 1))
{
weelist_add (&completion->completion_list,
@@ -204,18 +205,7 @@ completion_build_list (t_completion *completion, void *channel)
"autoload");
weelist_add (&completion->completion_list,
&completion->last_completion,
- "unload");
- return;
- }
- if ((strcasecmp (completion->base_command, "python") == 0)
- && (completion->base_command_arg == 1))
- {
- weelist_add (&completion->completion_list,
- &completion->last_completion,
- "load");
- weelist_add (&completion->completion_list,
- &completion->last_completion,
- "autoload");
+ "reload");
weelist_add (&completion->completion_list,
&completion->last_completion,
"unload");
diff --git a/src/common/weechat.c b/src/common/weechat.c
index 66d5fea4d..1e45eda04 100644
--- a/src/common/weechat.c
+++ b/src/common/weechat.c
@@ -632,7 +632,7 @@ wee_dump (int crash)
if (crash)
{
sigsegv = 1;
- wee_log_printf ("very bad, WeeChat is crashing (SIGSEGV received)...\n");
+ wee_log_printf ("Very bad, WeeChat is crashing (SIGSEGV received)...\n");
}
wee_log_printf ("\n");
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index b341a7fcb..be77d5447 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -1389,7 +1389,7 @@ config_create_default ()
}
printf (_("%s: creating default config file...\n"), PACKAGE_NAME);
- wee_log_printf (_("creating default config file\n"));
+ wee_log_printf (_("Creating default config file\n"));
current_time = time (NULL);
fprintf (file, _("#\n# %s configuration file, created by "
@@ -1561,7 +1561,7 @@ config_write (char *config_name)
return -1;
}
- wee_log_printf (_("saving config to disk\n"));
+ wee_log_printf (_("Saving config to disk\n"));
current_time = time (NULL);
fprintf (file, _("#\n# %s configuration file, created by "