34 |
#include "weeconfig.h" |
#include "weeconfig.h" |
35 |
#include "../irc/irc.h" |
#include "../irc/irc.h" |
36 |
#include "../gui/gui.h" |
#include "../gui/gui.h" |
37 |
|
#include "../plugins/plugins.h" |
38 |
|
|
39 |
|
|
40 |
/* WeeChat internal commands */ |
/* WeeChat internal commands */ |
60 |
{ "help", N_("display help about commands"), |
{ "help", N_("display help about commands"), |
61 |
N_("[command]"), N_("command: name of a WeeChat or IRC command"), |
N_("[command]"), N_("command: name of a WeeChat or IRC command"), |
62 |
0, 1, weechat_cmd_help, NULL }, |
0, 1, weechat_cmd_help, NULL }, |
63 |
|
{ "perl", N_("list/load/unload Perl scripts"), |
64 |
|
N_("[load filename] | [unload scriptname]"), |
65 |
|
N_("filename: Perl script (file) to load\n" |
66 |
|
"scriptname: name of script to unload\n" |
67 |
|
"Without argument, /perl command lists all loaded Perl scripts."), |
68 |
|
0, 2, weechat_cmd_perl, NULL }, |
69 |
{ "server", N_("list, add or remove servers"), |
{ "server", N_("list, add or remove servers"), |
70 |
N_("[list] | " |
N_("[list] | " |
71 |
"[servername hostname port [-auto | -noauto] [-pwd password] [-nicks nick1 " |
"[servername hostname port [-auto | -noauto] [-pwd password] [-nicks nick1 " |
538 |
gui_printf (NULL, |
gui_printf (NULL, |
539 |
_("%s wrong argument count for %s command \"%s\" " |
_("%s wrong argument count for %s command \"%s\" " |
540 |
"(expected: %d arg%s)\n"), |
"(expected: %d arg%s)\n"), |
541 |
WEECHAT_ERROR, PACKAGE_NAME, |
WEECHAT_ERROR, PACKAGE_NAME, |
542 |
command + 1, |
command + 1, |
543 |
weechat_commands[i].max_arg, |
weechat_commands[i].max_arg, |
544 |
(weechat_commands[i].max_arg > |
(weechat_commands[i].max_arg > |
981 |
} |
} |
982 |
|
|
983 |
/* |
/* |
984 |
|
* weechat_cmd_perl: list/load/unload Perl scripts |
985 |
|
*/ |
986 |
|
|
987 |
|
int |
988 |
|
weechat_cmd_perl (int argc, char **argv) |
989 |
|
{ |
990 |
|
#ifdef PLUGIN_PERL |
991 |
|
switch (argc) |
992 |
|
{ |
993 |
|
case 0: |
994 |
|
/* list all Perl scripts */ |
995 |
|
/* TODO: get list and display it */ |
996 |
|
break; |
997 |
|
case 2: |
998 |
|
if (strcmp (argv[0], "load") == 0) |
999 |
|
{ |
1000 |
|
/* load Perl script */ |
1001 |
|
plugins_load (PLUGIN_PERL, argv[1]); |
1002 |
|
} |
1003 |
|
else |
1004 |
|
{ |
1005 |
|
if (strcmp (argv[0], "unload") == 0) |
1006 |
|
{ |
1007 |
|
/* unload Perl script */ |
1008 |
|
} |
1009 |
|
else |
1010 |
|
{ |
1011 |
|
gui_printf (NULL, |
1012 |
|
_("%s unknown option for \"%s\" command\n"), |
1013 |
|
WEECHAT_ERROR, "perl"); |
1014 |
|
} |
1015 |
|
} |
1016 |
|
break; |
1017 |
|
default: |
1018 |
|
gui_printf (NULL, |
1019 |
|
_("%s wrong argument count for \"%s\" command\n"), |
1020 |
|
WEECHAT_ERROR, "perl"); |
1021 |
|
} |
1022 |
|
#else |
1023 |
|
gui_printf (NULL, |
1024 |
|
_("WeeChat was build without Perl support.\n" |
1025 |
|
"Please rebuild WeeChat with " |
1026 |
|
"\"--enable-perl\" option for ./configure script\n"); |
1027 |
|
#endif |
1028 |
|
return 0; |
1029 |
|
} |
1030 |
|
|
1031 |
|
/* |
1032 |
|
* weechat_cmd_save: save options to disk |
1033 |
|
*/ |
1034 |
|
|
1035 |
|
int |
1036 |
|
weechat_cmd_save (int argc, char **argv) |
1037 |
|
{ |
1038 |
|
return (config_write ((argc == 1) ? argv[0] : NULL)); |
1039 |
|
} |
1040 |
|
|
1041 |
|
/* |
1042 |
* weechat_cmd_server: list, add or remove server(s) |
* weechat_cmd_server: list, add or remove server(s) |
1043 |
*/ |
*/ |
1044 |
|
|
1344 |
} |
} |
1345 |
|
|
1346 |
/* |
/* |
|
* weechat_cmd_save: set options |
|
|
*/ |
|
|
|
|
|
int |
|
|
weechat_cmd_save (int argc, char **argv) |
|
|
{ |
|
|
return (config_write ((argc == 1) ? argv[0] : NULL)); |
|
|
} |
|
|
|
|
|
/* |
|
1347 |
* weechat_cmd_set: set options |
* weechat_cmd_set: set options |
1348 |
*/ |
*/ |
1349 |
|
|