47 |
{ "buffer", N_("manage buffers"), |
{ "buffer", N_("manage buffers"), |
48 |
N_("[action | number]"), |
N_("[action | number]"), |
49 |
N_("action: action to do:\n" |
N_("action: action to do:\n" |
50 |
" move: move buffer in the list (may be relative, for example -1)\n" |
" move: move buffer in the list (may be relative, for example -1)\n" |
51 |
" close: close buffer (for channel: same as /part without part message)\n" |
" close: close buffer (for channel: same as /part without part message)\n" |
52 |
" list: list opened buffers (no parameter implies this list)\n" |
" list: list opened buffers (no parameter implies this list)\n" |
53 |
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n" |
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n" |
54 |
"number: jump to buffer by number"), |
"number: jump to buffer by number"), |
55 |
0, MAX_ARGS, weechat_cmd_buffer, NULL }, |
0, MAX_ARGS, weechat_cmd_buffer, NULL }, |
56 |
{ "clear", N_("clear window(s)"), |
{ "clear", N_("clear window(s)"), |
57 |
N_("[-all]"), |
N_("[-all]"), |
72 |
{ "help", N_("display help about commands"), |
{ "help", N_("display help about commands"), |
73 |
N_("[command]"), N_("command: name of a WeeChat or IRC command"), |
N_("[command]"), N_("command: name of a WeeChat or IRC command"), |
74 |
0, 1, weechat_cmd_help, NULL }, |
0, 1, weechat_cmd_help, NULL }, |
75 |
|
{ "key", N_("bind/unbind keys"), |
76 |
|
N_("[key function/command] [unbind key] [functions] [reset -yes]"), |
77 |
|
N_("key: bind this key to an internal function or a command (beginning by \"/\")\n" |
78 |
|
"unbind: unbind a key (if \"all\", default bindings are restored)\n" |
79 |
|
"functions: list internal functions for key bindings\n" |
80 |
|
"reset: restore bindings to the default values and delete ALL personal binding (use carefully!)"), |
81 |
|
0, MAX_ARGS, NULL, weechat_cmd_key }, |
82 |
{ "perl", N_("list/load/unload Perl scripts"), |
{ "perl", N_("list/load/unload Perl scripts"), |
83 |
N_("[load filename] | [autoload] | [reload] | [unload]"), |
N_("[load filename] | [autoload] | [reload] | [unload]"), |
84 |
N_("filename: Perl script (file) to load\n" |
N_("filename: Perl script (file) to load\n" |
85 |
"Without argument, /perl command lists all loaded Perl scripts."), |
"Without argument, /perl command lists all loaded Perl scripts."), |
86 |
0, 2, weechat_cmd_perl, NULL }, |
0, 2, weechat_cmd_perl, NULL }, |
87 |
{ "python", N_("list/load/unload Python scripts"), |
{ "python", N_("list/load/unload Python scripts"), |
88 |
N_("[load filename] | [autoload] | [reload] | [unload]"), |
N_("[load filename] | [autoload] | [reload] | [unload]"), |
89 |
N_("filename: Python script (file) to load\n" |
N_("filename: Python script (file) to load\n" |
90 |
"Without argument, /python command lists all loaded Python scripts."), |
"Without argument, /python command lists all loaded Python scripts."), |
91 |
0, 2, weechat_cmd_python, NULL }, |
0, 2, weechat_cmd_python, NULL }, |
92 |
{ "server", N_("list, add or remove servers"), |
{ "server", N_("list, add or remove servers"), |
93 |
N_("[servername] | " |
N_("[servername] | " |
94 |
"[servername hostname port [-auto | -noauto] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 " |
"[servername hostname port [-auto | -noauto] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 " |
95 |
"[nick2 [nick3]]] [-username username] [-realname realname] " |
"[nick2 [nick3]]] [-username username] [-realname realname] " |
96 |
"[-command command] [-autojoin channel[,channel]] ] | " |
"[-command command] [-autojoin channel[,channel]] ] | " |
97 |
"[del servername]"), |
"[del servername]"), |
98 |
N_("servername: server name, for internal & display use\n" |
N_("servername: server name, for internal & display use\n" |
99 |
"hostname: name or IP address of server\n" |
"hostname: name or IP address of server\n" |
100 |
"port: port for server (integer)\n" |
"port: port for server (integer)\n" |
101 |
"ipv6: use IPv6 protocol\n" |
"ipv6: use IPv6 protocol\n" |
102 |
"ssl: use SSL protocol\n" |
"ssl: use SSL protocol\n" |
103 |
"password: password for server\n" |
"password: password for server\n" |
104 |
"nick1: first nick for server\n" |
"nick1: first nick for server\n" |
105 |
"nick2: alternate nick for server\n" |
"nick2: alternate nick for server\n" |
106 |
"nick3: second alternate nick for server\n" |
"nick3: second alternate nick for server\n" |
107 |
"username: user name\n" |
"username: user name\n" |
108 |
"realname: real name of user"), |
"realname: real name of user"), |
109 |
0, MAX_ARGS, weechat_cmd_server, NULL }, |
0, MAX_ARGS, weechat_cmd_server, NULL }, |
110 |
{ "save", N_("save config to disk"), |
{ "save", N_("save config to disk"), |
111 |
N_("[file]"), N_("file: filename for writing config"), |
N_("[file]"), N_("file: filename for writing config"), |
118 |
1, 1, NULL, weechat_cmd_unalias }, |
1, 1, NULL, weechat_cmd_unalias }, |
119 |
{ "window", N_("manage windows"), |
{ "window", N_("manage windows"), |
120 |
N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"), |
N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"), |
121 |
N_( |
N_("list: list opened windows (no parameter implies this list)\n" |
122 |
"list: list opened windows (no parameter implies this list)\n" |
"splith: split current window horizontally\n" |
123 |
"splith: split current window horizontally\n" |
"splitv: split current window vertically\n" |
124 |
"splitv: split current window vertically\n" |
"merge: merge window with another"), |
|
"merge: merge window with another"), |
|
125 |
0, 2, weechat_cmd_window, NULL }, |
0, 2, weechat_cmd_window, NULL }, |
126 |
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL } |
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL } |
127 |
}; |
}; |
883 |
t_irc_channel *ptr_channel; |
t_irc_channel *ptr_channel; |
884 |
long number; |
long number; |
885 |
char *error; |
char *error; |
886 |
|
int target_buffer; |
887 |
|
|
888 |
if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0))) |
if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0))) |
889 |
{ |
{ |
1056 |
{ |
{ |
1057 |
/* jump to buffer by number */ |
/* jump to buffer by number */ |
1058 |
|
|
1059 |
error = NULL; |
if (argv[0][0] == '-') |
|
number = strtol (argv[0], &error, 10); |
|
|
if ((error) && (error[0] == '\0')) |
|
1060 |
{ |
{ |
1061 |
if (!gui_switch_to_buffer_by_number (gui_current_window, (int) number)) |
/* relative jump '-' */ |
1062 |
|
error = NULL; |
1063 |
|
number = strtol (argv[0] + 1, &error, 10); |
1064 |
|
if ((error) && (error[0] == '\0')) |
1065 |
{ |
{ |
1066 |
irc_display_prefix (NULL, PREFIX_ERROR); |
target_buffer = gui_current_window->buffer->number - (int) number; |
1067 |
gui_printf (NULL, |
if (target_buffer < 1) |
1068 |
_("%s buffer \"%s\" not found for \"%s\" command\n"), |
target_buffer = (last_gui_buffer) ? last_gui_buffer->number + target_buffer : 1; |
1069 |
WEECHAT_ERROR, argv[0], "buffer"); |
gui_switch_to_buffer_by_number (gui_current_window, |
1070 |
return -1; |
target_buffer); |
1071 |
|
} |
1072 |
|
} |
1073 |
|
else if (argv[0][0] == '+') |
1074 |
|
{ |
1075 |
|
/* relative jump '+' */ |
1076 |
|
error = NULL; |
1077 |
|
number = strtol (argv[0] + 1, &error, 10); |
1078 |
|
if ((error) && (error[0] == '\0')) |
1079 |
|
{ |
1080 |
|
target_buffer = gui_current_window->buffer->number + (int) number; |
1081 |
|
if (last_gui_buffer && target_buffer > last_gui_buffer->number) |
1082 |
|
target_buffer -= last_gui_buffer->number; |
1083 |
|
gui_switch_to_buffer_by_number (gui_current_window, |
1084 |
|
target_buffer); |
1085 |
} |
} |
1086 |
} |
} |
1087 |
else |
else |
1088 |
{ |
{ |
1089 |
/* invalid number */ |
/* absolute jump by number */ |
1090 |
irc_display_prefix (NULL, PREFIX_ERROR); |
error = NULL; |
1091 |
gui_printf (NULL, _("%s incorrect buffer number\n"), |
number = strtol (argv[0], &error, 10); |
1092 |
WEECHAT_ERROR); |
if ((error) && (error[0] == '\0')) |
1093 |
return -1; |
gui_switch_to_buffer_by_number (gui_current_window, (int) number); |
1094 |
} |
} |
1095 |
|
|
1096 |
} |
} |
1345 |
} |
} |
1346 |
|
|
1347 |
/* |
/* |
1348 |
|
* weechat_cmd_key_display: display a key binding |
1349 |
|
*/ |
1350 |
|
|
1351 |
|
void |
1352 |
|
weechat_cmd_key_display (t_gui_key *key, int new_key) |
1353 |
|
{ |
1354 |
|
char *expanded_name; |
1355 |
|
|
1356 |
|
expanded_name = gui_key_get_expanded_name (key->key); |
1357 |
|
if (new_key) |
1358 |
|
{ |
1359 |
|
gui_printf (NULL, _("New key binding:\n")); |
1360 |
|
gui_printf (NULL, " %s", (expanded_name) ? expanded_name : key->key); |
1361 |
|
} |
1362 |
|
else |
1363 |
|
gui_printf (NULL, " %20s", (expanded_name) ? expanded_name : key->key); |
1364 |
|
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " => "); |
1365 |
|
gui_printf (NULL, "%s\n", |
1366 |
|
(key->function) ? |
1367 |
|
gui_key_function_search_by_ptr (key->function) : key->command); |
1368 |
|
if (expanded_name) |
1369 |
|
free (expanded_name); |
1370 |
|
} |
1371 |
|
|
1372 |
|
/* |
1373 |
|
* weechat_cmd_key: bind/unbind keys |
1374 |
|
*/ |
1375 |
|
|
1376 |
|
int |
1377 |
|
weechat_cmd_key (char *arguments) |
1378 |
|
{ |
1379 |
|
char *pos; |
1380 |
|
int i; |
1381 |
|
t_gui_key *ptr_key; |
1382 |
|
|
1383 |
|
if (arguments) |
1384 |
|
{ |
1385 |
|
while (arguments[0] == ' ') |
1386 |
|
arguments++; |
1387 |
|
} |
1388 |
|
|
1389 |
|
if (!arguments || (arguments[0] == '\0')) |
1390 |
|
{ |
1391 |
|
gui_printf (NULL, "\n"); |
1392 |
|
gui_printf (NULL, _("Key bindings:\n")); |
1393 |
|
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) |
1394 |
|
{ |
1395 |
|
weechat_cmd_key_display (ptr_key, 0); |
1396 |
|
} |
1397 |
|
} |
1398 |
|
else if (strncasecmp (arguments, "unbind ", 7) == 0) |
1399 |
|
{ |
1400 |
|
arguments += 7; |
1401 |
|
while (arguments[0] == ' ') |
1402 |
|
arguments++; |
1403 |
|
if (gui_key_unbind (arguments)) |
1404 |
|
gui_printf (NULL, _("Key \"%s\" unbinded\n"), arguments); |
1405 |
|
else |
1406 |
|
{ |
1407 |
|
irc_display_prefix (NULL, PREFIX_ERROR); |
1408 |
|
gui_printf (NULL, |
1409 |
|
_("%s unable to unbind key \"%s\"\n"), |
1410 |
|
WEECHAT_ERROR, arguments); |
1411 |
|
return -1; |
1412 |
|
} |
1413 |
|
} |
1414 |
|
else if (strcasecmp (arguments, "functions") == 0) |
1415 |
|
{ |
1416 |
|
gui_printf (NULL, "\n"); |
1417 |
|
gui_printf (NULL, _("Internal key functions:\n")); |
1418 |
|
i = 0; |
1419 |
|
while (gui_key_functions[i].function_name) |
1420 |
|
{ |
1421 |
|
gui_printf (NULL, " %s\n", |
1422 |
|
gui_key_functions[i].function_name); |
1423 |
|
i++; |
1424 |
|
} |
1425 |
|
} |
1426 |
|
else if (strncasecmp (arguments, "reset", 5) == 0) |
1427 |
|
{ |
1428 |
|
arguments += 5; |
1429 |
|
while (arguments[0] == ' ') |
1430 |
|
arguments++; |
1431 |
|
if (strcmp (arguments, "-yes") == 0) |
1432 |
|
{ |
1433 |
|
gui_key_free_all (); |
1434 |
|
gui_key_init (); |
1435 |
|
gui_printf (NULL, _("Default key bindings restored\n")); |
1436 |
|
} |
1437 |
|
else |
1438 |
|
{ |
1439 |
|
irc_display_prefix (NULL, PREFIX_ERROR); |
1440 |
|
gui_printf (NULL, |
1441 |
|
_("%s \"-yes\" argument is required for keys reset (securuty reason)\n"), |
1442 |
|
WEECHAT_ERROR); |
1443 |
|
return -1; |
1444 |
|
} |
1445 |
|
} |
1446 |
|
else |
1447 |
|
{ |
1448 |
|
while (arguments[0] == ' ') |
1449 |
|
arguments++; |
1450 |
|
pos = strchr (arguments, ' '); |
1451 |
|
if (!pos) |
1452 |
|
{ |
1453 |
|
irc_display_prefix (NULL, PREFIX_ERROR); |
1454 |
|
gui_printf (NULL, |
1455 |
|
_("%s wrong argument count for \"%s\" command\n"), |
1456 |
|
WEECHAT_ERROR, "key"); |
1457 |
|
return -1; |
1458 |
|
} |
1459 |
|
pos[0] = '\0'; |
1460 |
|
pos++; |
1461 |
|
while (pos[0] == ' ') |
1462 |
|
pos++; |
1463 |
|
ptr_key = gui_key_bind (arguments, pos); |
1464 |
|
if (ptr_key) |
1465 |
|
weechat_cmd_key_display (ptr_key, 1); |
1466 |
|
else |
1467 |
|
{ |
1468 |
|
irc_display_prefix (NULL, PREFIX_ERROR); |
1469 |
|
gui_printf (NULL, |
1470 |
|
_("%s unable to bind key \"%s\"\n"), |
1471 |
|
WEECHAT_ERROR, arguments); |
1472 |
|
return -1; |
1473 |
|
} |
1474 |
|
} |
1475 |
|
|
1476 |
|
return 0; |
1477 |
|
} |
1478 |
|
|
1479 |
|
/* |
1480 |
* weechat_cmd_perl: list/load/unload Perl scripts |
* weechat_cmd_perl: list/load/unload Perl scripts |
1481 |
*/ |
*/ |
1482 |
|
|
2046 |
} |
} |
2047 |
|
|
2048 |
/* |
/* |
2049 |
* weechat_set_cmd_display_option: display config option |
* weechat_cmd_set_display_option: display config option |
2050 |
*/ |
*/ |
2051 |
|
|
2052 |
void |
void |
2053 |
weechat_set_cmd_display_option (t_config_option *option, char *prefix, void *value) |
weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *value) |
2054 |
{ |
{ |
2055 |
char *color_name, *pos_nickserv, *pos_pwd, *value2; |
char *color_name, *pos_nickserv, *pos_pwd, *value2; |
2056 |
|
|
2193 |
{ |
{ |
2194 |
ptr_option_value = config_get_server_option_ptr (ptr_server, |
ptr_option_value = config_get_server_option_ptr (ptr_server, |
2195 |
weechat_options[CONFIG_SECTION_SERVER][i].option_name); |
weechat_options[CONFIG_SECTION_SERVER][i].option_name); |
2196 |
weechat_set_cmd_display_option (&weechat_options[CONFIG_SECTION_SERVER][i], |
weechat_cmd_set_display_option (&weechat_options[CONFIG_SECTION_SERVER][i], |
2197 |
ptr_server->name, |
ptr_server->name, |
2198 |
ptr_option_value); |
ptr_option_value); |
2199 |
} |
} |
2234 |
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, |
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, |
2235 |
"%s", config_get_section (ptr_option)); |
"%s", config_get_section (ptr_option)); |
2236 |
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n"); |
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n"); |
2237 |
weechat_set_cmd_display_option (ptr_option, NULL, NULL); |
weechat_cmd_set_display_option (ptr_option, NULL, NULL); |
2238 |
} |
} |
2239 |
else |
else |
2240 |
{ |
{ |
2258 |
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++) |
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++) |
2259 |
{ |
{ |
2260 |
section_displayed = 0; |
section_displayed = 0; |
2261 |
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER)) |
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS) |
2262 |
|
&& (i != CONFIG_SECTION_SERVER)) |
2263 |
{ |
{ |
2264 |
for (j = 0; weechat_options[i][j].option_name; j++) |
for (j = 0; weechat_options[i][j].option_name; j++) |
2265 |
{ |
{ |
2277 |
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n"); |
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n"); |
2278 |
section_displayed = 1; |
section_displayed = 1; |
2279 |
} |
} |
2280 |
weechat_set_cmd_display_option (&weechat_options[i][j], NULL, NULL); |
weechat_cmd_set_display_option (&weechat_options[i][j], NULL, NULL); |
2281 |
number_found++; |
number_found++; |
2282 |
} |
} |
2283 |
} |
} |
2310 |
weechat_options[CONFIG_SECTION_SERVER][i].option_name); |
weechat_options[CONFIG_SECTION_SERVER][i].option_name); |
2311 |
if (ptr_option_value) |
if (ptr_option_value) |
2312 |
{ |
{ |
2313 |
weechat_set_cmd_display_option (&weechat_options[CONFIG_SECTION_SERVER][i], |
weechat_cmd_set_display_option (&weechat_options[CONFIG_SECTION_SERVER][i], |
2314 |
ptr_server->name, |
ptr_server->name, |
2315 |
ptr_option_value); |
ptr_option_value); |
2316 |
number_found++; |
number_found++; |
2443 |
else |
else |
2444 |
gui_window_merge_auto (gui_current_window); |
gui_window_merge_auto (gui_current_window); |
2445 |
} |
} |
2446 |
|
else if (strcasecmp (argv[0], "-1") == 0) |
2447 |
|
gui_switch_to_previous_window (); |
2448 |
|
else if (strcasecmp (argv[0], "+1") == 0) |
2449 |
|
gui_switch_to_next_window (); |
2450 |
else |
else |
2451 |
{ |
{ |
2452 |
irc_display_prefix (NULL, PREFIX_ERROR); |
irc_display_prefix (NULL, PREFIX_ERROR); |