void relay_command_init () { weechat_hook_command ("relay", N_("relay control"), N_("list|listfull|listrelay" " || add [ipv4.][ipv6.][ssl.]<protocol.name> <port>" " || del [ipv4.][ipv6.][ssl.]<protocol.name>" " || raw" " || sslcertkey"), N_(" list: list relay clients (only active " "relays)\n" " listfull: list relay clients (verbose, all " "relays)\n" " listrelay: list relays (name and port)\n" " add: add relay for a protocol + name\n" " del: remove relay for a protocol + name\n" " ipv4: force use of IPv4\n" " ipv6: force use of IPv6\n" " ssl: enable SSL\n" "protocol.name: protocol and name to relay:\n" " - protocol \"irc\": name is the " "server to share (optional, if not given, the server " "name must be sent by client in command \"PASS\", " "with format: \"PASS server:password\")\n" " - protocol \"weechat\" (name is " "not used)\n" " port: port used for relay\n" " raw: open buffer with raw Relay data\n" " sslcertkey: set SSL certificate/key using path " "in option relay.network.ssl_cert_key\n\n" "Without argument, this command opens buffer " "with list of relay clients.\n\n" "Examples:\n" " irc proxy, for server \"freenode\":\n" " /relay add irc.freenode 8000\n" " irc proxy, for server \"freenode\", with SSL:\n" " /relay add ssl.irc.freenode 8001\n" " irc proxy, for all servers (client will choose), " "with SSL:\n" " /relay add ssl.irc 8002\n" " weechat protocol:\n" " /relay add weechat 9000\n" " weechat protocol with SSL:\n" " /relay add ssl.weechat 9001\n" " weechat protocol with SSL, using only IPv4:\n" " /relay add ipv4.ssl.weechat 9001\n" " weechat protocol with SSL, using only IPv6:\n" " /relay add ipv6.ssl.weechat 9001\n" " weechat protocol with SSL, using IPv4 + IPv6:\n" " /relay add ipv4.ipv6.ssl.weechat 9001"), "list %(relay_relays)" " || listfull %(relay_relays)" " || listrelay" " || add %(relay_protocol_name) %(relay_free_port)" " || del %(relay_relays)" " || raw" " || sslcertkey", &relay_command_relay, NULL); }
int weechat_plugin_init(struct t_weechat_plugin *plugin, int argc, char *argv[]) { weechat_plugin = plugin; weechat_hook_command("recommand", "Resend the automatic command(s) for the current buffer's server", "", "", "", &command_recommand, NULL); return WEECHAT_RC_OK; }
void relay_command_init () { weechat_hook_command ("relay", N_("relay control"), "[list | listfull]", N_(" list: list relay clients\n" "listfull: list relay clients (verbose)\n\n" "Without argument, this command opens buffer " "with list of relay clients."), "list|listfull", &relay_command_relay, NULL); }
int weechat_plugin_init(struct t_weechat_plugin *plugin, int argc, char *argv[]) { weechat_plugin = plugin; SilcClientParams params; if (silc_plugin_config_init() < 0) { weechat_log_printf("could not initialize SILC plugin config"); return WEECHAT_RC_ERROR; } if (silc_plugin_config_read() < 0) { weechat_log_printf("could not read SILC plugin config file"); return WEECHAT_RC_ERROR; } memset(¶ms, 0, sizeof(params)); params.threads = TRUE; silc_plugin = silc_calloc(1, sizeof(*silc_plugin)); if (!silc_plugin) { weechat_log_printf("could not allocate plugin context"); return WEECHAT_RC_ERROR; } weechat_log_printf("SILC plugin context allocated"); silc_plugin->client = silc_client_alloc(&ops, ¶ms, silc_plugin, NULL); if (!silc_plugin->client) { weechat_log_printf("could not allocate SILC client"); return WEECHAT_RC_ERROR; } weechat_log_printf("SILC client allocated"); if (!silc_client_init(silc_plugin->client, weechat_config_string(option_default_username), silc_net_localhost(), weechat_config_string(option_default_realname), silc_running, silc_plugin)) { weechat_log_printf("could not initialize SILC client"); return WEECHAT_RC_ERROR; } // tick the client once to complete the initialization silc_client_run_one(silc_plugin->client); weechat_log_printf("SILC client initialized"); silc_plugin_get_keypair("weechat", "", 1, &silc_plugin->public_key, &silc_plugin->private_key); server_list = malloc(sizeof(struct SilcPluginServer)); memset(server_list, 0, sizeof(struct SilcPluginServer)); weechat_hook_command("silc", "This is the SILC plugin", "", "", NULL, &command_silc, NULL); weechat_hook_timer(50, 0, 0, &timer_silc, NULL); silc_bar_init(); return WEECHAT_RC_OK; }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { weechat_plugin = plugin; weechat_hook_command ("currentsong", "Affiche le morceau que vous écoutez", "[host <ip|url> [port <port>]]", "si mpd n'est pas en local : [host <ip|url> [port <port>]]", "host %(the_host) port %(the_port)", &cb_currentsong_plugin, NULL); return WEECHAT_RC_OK; }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { /* make C compiler happy */ (void) argc; (void) argv; weechat_plugin = plugin; if (!weechat_aspell_config_init ()) return WEECHAT_RC_ERROR; if (weechat_aspell_config_read () < 0) return WEECHAT_RC_ERROR; /* command /aspell */ weechat_hook_command ("aspell", N_("aspell plugin configuration"), N_("dictlist | enable lang | disable | " "addword [lang] word"), N_("dictlist: show installed dictionaries\n" " enable: enable aspell on current buffer\n" " disable: disable aspell on current buffer\n" " addword: add a word in your personal aspell " "dictionary\n" "\n" "Input line beginning with a '/' is not checked, " "except for some commands."), "dictlist" " || enable %(aspell_langs)" " || disable" " || addword", &weechat_aspell_command_cb, NULL); weechat_hook_completion ("aspell_langs", N_("list of supported langs for aspell"), &weechat_aspell_completion_langs_cb, NULL); /* callback for buffer_switch */ weechat_hook_signal ("buffer_switch", &weechat_aspell_buffer_switch_cb, NULL); /* callback for spell checking input text */ weechat_hook_modifier ("input_text_display", &weechat_aspell_modifier_cb, NULL); weechat_aspell_create_spellers (weechat_current_buffer ()); return WEECHAT_RC_OK; }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { weechat_plugin = plugin; weechat_hook_command ("double", "Display two times a message " "or execute two times a command", "message | command", "message: message to display two times\n" "command: command to execute two times", NULL, &command_double_cb, NULL); return WEECHAT_RC_OK; }
int weechat_plugin_init(struct t_weechat_plugin *plugin, gint argc, gchar *argv[]) { weechat_plugin = plugin; _wec_context.blacklist = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); _wec_config_init(); _wec_context.client = eventc_light_connection_new(NULL); _wec_connect(); _wec_context.print_hook = weechat_hook_print(NULL, NULL, NULL, 1, _wec_print_callback, NULL, NULL); _wec_context.command_hook = weechat_hook_command("eventc", "Control eventc", "connect | disconnect", "", "connect || disconnect", _wec_command, NULL, NULL); return WEECHAT_RC_OK; }
void alias_hook_command (struct t_alias *alias) { char *str_priority_name, *str_completion; int length; /* * build string with priority and name: the alias priority is 2000, which * is higher than default one (1000), so the alias is executed before a * command (if a command with same name exists in core or in another plugin) */ length = strlen (alias->name) + 16 + 1; str_priority_name = malloc (length); if (str_priority_name) snprintf (str_priority_name, length, "2000|%s", alias->name); /* * if alias has no custom completion, then default is to complete with * completion template of target command, for example if alias is * "/alias test /buffer", then str_completion will be "%%buffer" */ str_completion = NULL; if (!alias->completion) { length = 2 + strlen (alias->command) + 1; str_completion = malloc (length); if (str_completion) { snprintf (str_completion, length, "%%%%%s", (weechat_string_is_command_char (alias->command)) ? weechat_utf8_next_char (alias->command) : alias->command); } } alias->hook = weechat_hook_command ((str_priority_name) ? str_priority_name : alias->name, alias->command, NULL, NULL, (str_completion) ? str_completion : alias->completion, &alias_cb, alias); if (str_priority_name) free (str_priority_name); if (str_completion) free (str_completion); }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { /* make C compiler happy */ (void) argc; (void) argv; weechat_plugin = plugin; /* get terminal & internal charsets */ charset_terminal = weechat_info_get ("charset_terminal", ""); charset_internal = weechat_info_get ("charset_internal", ""); /* display message */ if (weechat_charset_plugin->debug >= 1) charset_display_charsets (); if (!charset_config_init ()) { weechat_printf (NULL, _("%s%s: error creating configuration file"), weechat_prefix("error"), CHARSET_PLUGIN_NAME); return WEECHAT_RC_OK; } charset_config_read (); /* /charset command */ weechat_hook_command ("charset", N_("change charset for current buffer"), N_("decode|encode <charset>" " || reset"), N_(" decode: change decoding charset\n" " encode: change encoding charset\n" "charset: new charset for current buffer\n" " reset: reset charsets for current buffer"), "decode|encode|reset", &charset_command_cb, NULL); /* modifiers hooks */ weechat_hook_modifier ("charset_decode", &charset_decode_cb, NULL); weechat_hook_modifier ("charset_encode", &charset_encode_cb, NULL); return WEECHAT_RC_OK; }
void weechat_aspell_command_init () { weechat_hook_command ( "aspell", N_("aspell plugin configuration"), N_("enable|disable|toggle" " || listdict" " || setdict <dict>[,<dict>...]" " || deldict" " || addword [<dict>] <word>"), N_(" enable: enable aspell\n" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" " setdict: set dictionary for current buffer (multiple dictionaries " "can be separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" "Input line beginning with a '/' is not checked, except for some " "commands (see /set aspell.check.commands).\n" "\n" "To enable aspell on all buffers, use option \"default_dict\", then " "enable aspell, for example:\n" " /set aspell.check.default_dict \"en\"\n" " /aspell enable\n" "\n" "To display a list of suggestions in a bar, use item " "\"aspell_suggest\".\n" "\n" "Default key to toggle aspell is alt-s."), "enable" " || disable" " || toggle" " || listdict" " || setdict %(aspell_dicts)" " || deldict" " || addword", &weechat_aspell_command_cb, NULL); }
void trigger_hook (struct t_trigger *trigger) { char **argv, **argv_eol, *tags, *message, *error1, *error2, *error3; int i, argc, strip_colors; long interval, align_second, max_calls; trigger_unhook (trigger); argv = weechat_string_split (weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]), ";", 0, 0, &argc); argv_eol = weechat_string_split (weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]), ";", 1, 0, NULL); switch (weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])) { case TRIGGER_HOOK_SIGNAL: if (argv && (argc >= 1)) { trigger->hooks = malloc (argc * sizeof (trigger->hooks[0])); if (trigger->hooks) { trigger->hooks_count = argc; for (i = 0; i < argc; i++) { trigger->hooks[i] = weechat_hook_signal ( argv[i], &trigger_callback_signal_cb, trigger); } } } break; case TRIGGER_HOOK_HSIGNAL: if (argv && (argc >= 1)) { trigger->hooks = malloc (argc * sizeof (trigger->hooks[0])); if (trigger->hooks) { trigger->hooks_count = argc; for (i = 0; i < argc; i++) { trigger->hooks[i] = weechat_hook_hsignal ( argv[i], &trigger_callback_hsignal_cb, trigger); } } } break; case TRIGGER_HOOK_MODIFIER: if (argv && (argc >= 1)) { trigger->hooks = malloc (argc * sizeof (trigger->hooks[0])); if (trigger->hooks) { trigger->hooks_count = argc; for (i = 0; i < argc; i++) { trigger->hooks[i] = weechat_hook_modifier ( argv[i], &trigger_callback_modifier_cb, trigger); } } } break; case TRIGGER_HOOK_PRINT: tags = NULL; message = NULL; strip_colors = 0; if (argv && (argc >= 1)) { if (strcmp (argv[0], "*") != 0) trigger->hook_print_buffers = strdup (argv[0]); if ((argc >= 2) && (strcmp (argv[1], "*") != 0)) tags = argv[1]; if ((argc >= 3) && (strcmp (argv[2], "*") != 0)) message = argv[2]; if (argc >= 4) strip_colors = (strcmp (argv[3], "0") != 0) ? 1 : 0; } trigger->hooks = malloc (sizeof (trigger->hooks[0])); if (trigger->hooks) { trigger->hooks_count = 1; trigger->hooks[0] = weechat_hook_print ( NULL, tags, message, strip_colors, &trigger_callback_print_cb, trigger); } break; case TRIGGER_HOOK_COMMAND: if (argv && (argc >= 1)) { trigger->hooks = malloc (sizeof (trigger->hooks[0])); if (trigger->hooks) { trigger->hooks_count = 1; trigger->hooks[0] = weechat_hook_command ( argv[0], /* command */ (argc > 1) ? argv[1] : "", /* description */ (argc > 2) ? argv[2] : "", /* arguments */ (argc > 3) ? argv[3] : "", /* description of args */ (argc > 4) ? argv[4] : "", /* completion */ &trigger_callback_command_cb, trigger); } } break; case TRIGGER_HOOK_COMMAND_RUN: if (argv && (argc >= 1)) { trigger->hooks = malloc (argc * sizeof (trigger->hooks[0])); if (trigger->hooks) { trigger->hooks_count = argc; for (i = 0; i < argc; i++) { trigger->hooks[i] = weechat_hook_command_run ( argv[i], &trigger_callback_command_run_cb, trigger); } } } break; case TRIGGER_HOOK_TIMER: if (argv && (argc >= 1)) { error1 = NULL; error2 = NULL; error3 = NULL; interval = strtol (argv[0], &error1, 10); align_second = strtol ((argc >= 2) ? argv[1] : "0", &error2, 10); max_calls = strtol ((argc >= 3) ? argv[2] : "0", &error3, 10); if (error1 && !error1[0] && error2 && !error2[0] && error3 && !error3[0] && (interval > 0) && (align_second >= 0) && (max_calls >= 0)) { trigger->hooks = malloc (sizeof (trigger->hooks[0])); if (trigger->hooks) { trigger->hooks_count = 1; trigger->hooks[0] = weechat_hook_timer ( interval, (int)align_second, (int)max_calls, &trigger_callback_timer_cb, trigger); } } } break; case TRIGGER_HOOK_CONFIG: if (argv && (argc >= 1)) { trigger->hooks = malloc (argc * sizeof (trigger->hooks[0])); if (trigger->hooks) { trigger->hooks_count = argc; for (i = 0; i < argc; i++) { trigger->hooks[i] = weechat_hook_config ( argv[i], &trigger_callback_config_cb, trigger); } } } break; case TRIGGER_HOOK_FOCUS: if (argv && (argc >= 1)) { trigger->hooks = malloc (argc * sizeof (trigger->hooks[0])); if (trigger->hooks) { trigger->hooks_count = argc; for (i = 0; i < argc; i++) { trigger->hooks[i] = weechat_hook_focus ( argv[i], &trigger_callback_focus_cb, trigger); } } } break; } if (!trigger->hooks) { weechat_printf (NULL, _("%s%s: unable to create hook for trigger \"%s\" " "(bad arguments)"), weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, trigger->name); } if (argv) weechat_string_free_split (argv); if (argv_eol) weechat_string_free_split (argv_eol); }
void trigger_command_init () { weechat_hook_command ( "trigger", N_("manage triggers, the Swiss Army knife for WeeChat"), N_("list|listfull|listdefault" " || add|addoff|addreplace <name> <hook> [\"<arguments>\" " "[\"<conditions>\" [\"<regex>\" [\"<command>\" " "[\"<return_code>\"]]]]]" " || addinput [<hook>]" " || input|output|recreate <name>" " || set <name> <option> <value>" " || rename|copy <name> <new_name>" " || enable|disable|toggle [<name>|-all [<name>...]]" " || restart <name>|-all [<name>...]" " || show <name>" " || del <name>|-all [<name>...]" " || default -yes" " || monitor [<filter>]"), N_(" list: list triggers (without argument, this list is displayed)\n" " listfull: list triggers with detailed info for each trigger\n" "listdefault: list default triggers\n" " add: add a trigger\n" " addoff: add a trigger (disabled)\n" " addreplace: add or replace an existing trigger\n" " name: name of trigger\n" " hook: signal, hsignal, modifier, print, command, command_run, " "timer, config, focus\n" " arguments: arguments for the hook, depending on hook (separated " "by semicolons):\n" " signal: name(s) of signal (required)\n" " hsignal: name(s) of hsignal (required)\n" " modifier: name(s) of modifier (required)\n" " print: buffer, tags, message, strip colors\n" " command: command (required), description, arguments, " "description of arguments, completion\n" " command_run: command(s) (required)\n" " timer: interval (required), align on second, max calls\n" " config: name(s) of option (required)\n" " focus: name(s) of area (required)\n" " conditions: evaluated conditions for the trigger\n" " regex: one or more regular expressions to replace strings " "in variables\n" " command: command to execute (many commands can be separated by " "\";\"\n" "return_code: return code in callback (ok (default), ok_eat, error)\n" " addinput: set input with default arguments to create a trigger\n" " input: set input with the command used to create the trigger\n" " output: send the command to create the trigger on the buffer\n" " recreate: same as \"input\", with option \"addreplace\" instead " "of \"add\"\n" " set: set an option in a trigger\n" " option: name of option: name, hook, arguments, conditions, " "regex, command, return_code\n" " (for help on option, you can type: /help " "trigger.trigger.<name>.<option>)\n" " value: new value for the option\n" " rename: rename a trigger\n" " copy: copy a trigger\n" " enable: enable trigger(s) (without arguments: enable triggers " "globally)\n" " disable: disable trigger(s) (without arguments: disable triggers " "globally)\n" " toggle: toggle trigger(s) (without arguments: toggle triggers " "globally)\n" " restart: restart trigger(s) (recreate the hooks)\n" " show: show detailed info on a trigger (with some stats)\n" " del: delete a trigger\n" " -all: do action on all triggers\n" " default: restore default triggers\n" " monitor: open the trigger monitor buffer, with optional filter:\n" " filter: filter hooks/triggers to display (a hook must start " "with \"@\", for example \"@signal\"), many filters can be separated " "by commas; wildcard \"*\" is allowed in each trigger name\n" "\n" "When a trigger callback is called, following actions are performed, " "in this order:\n" " 1. check conditions; if false, exit\n" " 2. replace text using POSIX extended regular expression(s) (if " "defined in trigger)\n" " 3. execute command(s) (if defined in trigger)\n" " 4. exit with a return code (except for modifiers and focus)\n" "\n" "Examples (you can also look at default triggers with /trigger " "listdefault):\n" " add text attributes *bold*, _underline_ and /italic/ (only in " "user messages):\n" " /trigger add effects modifier weechat_print \"${tg_tag_nick}\" " "\"==\\*(\\S+)\\*==*${color:bold}$1${color:-bold}*== " "==_(\\S+)_==_${color:underline}$1${color:-underline}_== " "==/(\\S+)/==/${color:italic}$1${color:-italic}/\"\n" " hide nicklist bar on small terminals:\n" " /trigger add resize_small signal signal_sigwinch " "\"${info:term_width} < 100\" \"\" \"/bar hide nicklist\"\n" " /trigger add resize_big signal signal_sigwinch " "\"${info:term_width} >= 100\" \"\" \"/bar show nicklist\"\n" " silently save config each hour:\n" " /trigger add cfgsave timer 3600000;0;0 \"\" \"\" \"/mute /save\"\n" " open trigger monitor and show only modifiers and triggers whose " "name starts with \"resize\":\n" " /trigger monitor @modifier,resize*"), "list|listfull|listdefault" " || add|addoff|addreplace %(trigger_names) %(trigger_hooks) " "%(trigger_hook_arguments) %(trigger_hook_conditions) " "%(trigger_hook_regex) %(trigger_hook_command) %(trigger_hook_rc)" " || addinput %(trigger_hooks)" " || input|output|recreate %(trigger_names)" " || set %(trigger_names) %(trigger_options)|name %(trigger_option_value)" " || rename|copy %(trigger_names) %(trigger_names)" " || enable|disable|toggle|restart|del %(trigger_names)|-all " "%(trigger_names)|%*" " || show %(trigger_names)" " || default" " || monitor %(trigger_names)|%(trigger_hooks_filter)", &trigger_command_trigger, NULL); }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { /* make C compiler happy */ (void) argc; (void) argv; weechat_plugin = plugin; if (!logger_config_init ()) return WEECHAT_RC_ERROR; logger_config_read (); /* command /logger */ weechat_hook_command ( "logger", N_("logger plugin configuration"), N_("list" " || set <level>" " || flush" " || disable"), N_(" list: show logging status for opened buffers\n" " set: set logging level on current buffer\n" " level: level for messages to be logged (0 = logging disabled, " "1 = a few messages (most important) .. 9 = all messages)\n" " flush: write all log files now\n" "disable: disable logging on current buffer (set level to 0)\n" "\n" "Options \"logger.level.*\" and \"logger.mask.*\" can be used to set " "level or mask for a buffer, or buffers beginning with name.\n" "\n" "Log levels used by IRC plugin:\n" " 1: user message, notice, private\n" " 2: nick change\n" " 3: server message\n" " 4: join/part/quit\n" " 9: all other messages\n" "\n" "Examples:\n" " set level to 5 for current buffer:\n" " /logger set 5\n" " disable logging for current buffer:\n" " /logger disable\n" " set level to 3 for all IRC buffers:\n" " /set logger.level.irc 3\n" " disable logging for main WeeChat buffer:\n" " /set logger.level.core.weechat 0\n" " use a directory per IRC server and a file per channel inside:\n" " /set logger.mask.irc \"$server/$channel.weechatlog\""), "list" " || set 1|2|3|4|5|6|7|8|9" " || flush" " || disable", &logger_command_cb, NULL); logger_start_buffer_all (1); weechat_hook_signal ("buffer_opened", &logger_buffer_opened_signal_cb, NULL); weechat_hook_signal ("buffer_closing", &logger_buffer_closing_signal_cb, NULL); weechat_hook_signal ("buffer_renamed", &logger_buffer_renamed_signal_cb, NULL); weechat_hook_signal ("logger_backlog", &logger_backlog_signal_cb, NULL); weechat_hook_signal ("logger_start", &logger_start_signal_cb, NULL); weechat_hook_signal ("logger_stop", &logger_stop_signal_cb, NULL); weechat_hook_signal ("day_changed", &logger_day_changed_signal_cb, NULL); weechat_hook_print (NULL, NULL, NULL, 1, &logger_print_cb, NULL); logger_info_init (); return WEECHAT_RC_OK; }
void exec_command_init () { weechat_hook_command ( "exec", N_("execute external commands"), N_("-list" " || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] " "[-l|-o|-n|-nf] [-cl|-nocl] [-sw|-nosw] [-ln|-noln] " "[-flush|-noflush] [-color ansi|auto|irc|weechat|strip] [-rc|-norc] " "[-timeout <timeout>] [-name <name>] [-pipe <command>] " "[-hsignal <name>] <command>" " || -in <id> <text>" " || -inclose <id> [<text>]" " || -signal <id> <signal>" " || -kill <id>" " || -killall" " || -set <id> <property> <value>" " || -del <id>|-all [<id>...]"), N_(" -list: list commands\n" " -sh: use the shell to execute the command (WARNING: use this " "option ONLY if all arguments are safe, see option -nosh)\n" " -nosh: do not use the shell to execute the command (required if " "the command has some unsafe data, for example the content of a " "message from another user) (default)\n" " -bg: run process in background: do not display process output " "neither return code (not compatible with options -o/-n)\n" " -nobg: catch process output and display return code (default)\n" " -stdin: create a pipe for sending data to the process (with " "/exec -in/-inclose)\n" "-nostdin: do not create a pipe for stdin (default)\n" " -buffer: display/send output of command on this buffer (if the " "buffer is not found, a new buffer with name \"exec.exec.xxx\" is " "created)\n" " -l: display locally output of command on buffer (default)\n" " -o: send output of command to the buffer " "(not compatible with option -bg)\n" " -n: display output of command in a new buffer (not compatible " "with option -bg)\n" " -nf: display output of command in a new buffer with free " "content (no word-wrap, no limit on number of lines) (not compatible " "with option -bg)\n" " -cl: clear the new buffer before displaying output\n" " -nocl: append to the new buffer without clear (default)\n" " -sw: switch to the output buffer (default)\n" " -nosw: don't switch to the output buffer\n" " -ln: display line numbers (default in new buffer only)\n" " -noln: don't display line numbers\n" " -flush: display output of command in real time (default)\n" "-noflush: display output of command after its end\n" " -color: action on ANSI colors in output:\n" " ansi: keep ANSI codes as-is\n" " auto: convert ANSI colors to WeeChat/IRC (default)\n" " irc: convert ANSI colors to IRC colors\n" " weechat: convert ANSI colors to WeeChat colors\n" " strip: remove ANSI colors\n" " -rc: display return code (default)\n" " -norc: don't display return code\n" "-timeout: set a timeout for the command (in seconds)\n" " -name: set a name for the command (to name it later with /exec)\n" " -pipe: send the output to a WeeChat/plugin command (line by " "line); if there are spaces in command/arguments, enclose them with " "double quotes; variable $line is replaced by the line (by default " "the line is added after the command, separated by a space) " "(not compatible with options -bg/-o/-n)\n" "-hsignal: send the output as a hsignal (to be used for example in " "a trigger) (not compatible with options -bg/-o/-n)\n" " command: the command to execute; if beginning with \"url:\", the " "shell is disabled and the content of URL is downloaded and sent as " "output\n" " id: command identifier: either its number or name (if set " "with \"-name xxx\")\n" " -in: send text on standard input of process\n" "-inclose: same as -in, but stdin is closed after (and text is " "optional: without text, the stdin is just closed)\n" " -signal: send a signal to the process; the signal can be an integer " "or one of these names: hup, int, quit, kill, term, usr1, usr2\n" " -kill: alias of \"-signal <id> kill\"\n" "-killall: kill all running processes\n" " -set: set a hook property (see function hook_set in plugin API " "reference)\n" "property: hook property\n" " value: new value for hook property\n" " -del: delete a terminated command\n" " -all: delete all terminated commands\n" "\n" "Default options can be set in the option " "exec.command.default_options.\n" "\n" "Examples:\n" " /exec -n ls -l /tmp\n" " /exec -n ps xu | grep weechat\n" " /exec -n -norc url:http://pastebin.com/raw.php?i=xxxxxxxx\n" " /exec -nf -noln links -dump " "https://weechat.org/files/doc/devel/weechat_user.en.html\n" " /exec -o uptime\n" " /exec -pipe \"/print Machine uptime:\" uptime\n" " /exec -n tail -f /var/log/messages\n" " /exec -kill 0"), "-list" " || -sh|-nosh|-bg|-nobg|-stdin|-nostdin|-buffer|-l|-o|-n|-nf|" "-cl|-nocl|-sw|-nosw|-ln|-noln|-flush|-noflush|-color|-timeout|-name|" "-pipe|-hsignal|%*" " || -in|-inclose|-signal|-kill %(exec_commands_ids)" " || -killall" " || -set %(exec_commands_ids) stdin|stdin_close|signal" " || -del %(exec_commands_ids)|-all %(exec_commands_ids)|%*", &exec_command_exec, NULL); }
void script_command_init () { weechat_hook_command ("script", N_("WeeChat scripts manager"), N_("list [-o|-i] || search <text> || show <script>" " || load|unload|reload <script> [<script>...]" " || install|remove|installremove|hold [-q] <script> [<script>...]" " || upgrade || update"), N_(" list: list loaded scripts (all languages)\n" " -o: send list of loaded scripts to buffer\n" " -i: copy list of loaded scripts in " "command line (for sending to buffer)\n" " search: search scripts by tags or text and " "display result on scripts buffer\n" " show: show detailed info about a script\n" " load: load script(s)\n" " unload: unload script(s)\n" " reload: reload script(s)\n" " install: install/upgrade script(s)\n" " remove: remove script(s)\n" "installremove: install or remove script(s), " "depending on current state\n" " hold: hold/unhold script(s) (a script held " "will not be upgraded any more and cannot be " "removed)\n" " -q: quiet mode: do not display messages\n" " upgrade: upgrade all installed scripts which " "are obsolete (new version available)\n" " update: update local scripts cache\n\n" "Without argument, this command opens a buffer " "with list of scripts.\n\n" "On script buffer, the possible status for each " "script are:\n" " * i a H r N\n" " | | | | | |\n" " | | | | | obsolete (new version available)\n" " | | | | running (loaded)\n" " | | | held\n" " | | autoloaded\n" " | installed\n" " popular script\n\n" "Keys on script buffer:\n" " alt+i install script\n" " alt+r remove script\n" " alt+l load script\n" " alt+L reload script\n" " alt+u unload script\n" " alt+h (un)hold script\n" " alt+v view script\n\n" "Input allowed on script buffer:\n" " i/r/l/L/u/h action on script (same as keys above)\n" " q close buffer\n" " $ refresh buffer\n" " s:x,y sort buffer using keys x and y (see /help " "script.look.sort)\n" " s: reset sort (use default sort)\n" " word(s) filter scripts: search word(s) in " "scripts (description, tags, ...)\n" " * remove filter\n\n" "Mouse actions on script buffer:\n" " wheel scroll list\n" " left button select script\n" " right button install/remove script\n\n" "Examples:\n" " /script search url\n" " /script install iset.pl buffers.pl\n" " /script remove iset.pl\n" " /script hold urlserver.py\n" " /script reload urlserver\n" " /script upgrade"), "list -o|-i" " || search %(script_tags)" " || show %(script_scripts)" " || load %(script_files)|%*" " || unload %(python_script)|%(perl_script)|" "%(ruby_script)|%(tcl_script)|%(lua_script)|" "%(guile_script)|%*" " || reload %(python_script)|%(perl_script)|" "%(ruby_script)|%(tcl_script)|%(lua_script)|" "%(guile_script)|%*" " || install %(script_scripts)|%*" " || remove %(script_scripts_installed)|%*" " || installremove %(script_scripts)|%*" " || hold %(script_scripts)|%*" " || update" " || upgrade", &script_command_script, NULL); }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { /* make C compiler happy */ (void) argc; (void) argv; weechat_plugin = plugin; if (!weechat_aspell_config_init ()) return WEECHAT_RC_ERROR; if (weechat_aspell_config_read () < 0) return WEECHAT_RC_ERROR; /* command /aspell */ weechat_hook_command ("aspell", N_("aspell plugin configuration"), N_("enable|disable|toggle" " || listdict" " || setdict <lang>" " || deldict" " || addword [<lang>] <word>"), N_(" enable: enable aspell\n" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" " setdict: set dictionary for current buffer\n" " deldict: delete dictionary used on current " "buffer\n" " addword: add a word in personal aspell " "dictionary\n" "\n" "Input line beginning with a '/' is not checked, " "except for some commands (see /set " "aspell.check.commands).\n\n" "To enable aspell on all buffers, use option " "\"default_dict\", then enable aspell, for " "example:\n" " /set aspell.check.default_dict \"en\"\n" " /aspell enable\n\n" "Default key to toggle aspell is alt-s."), "enable" " || disable" " || toggle" " || listdict" " || setdict %(aspell_langs)" " || deldict" " || addword", &weechat_aspell_command_cb, NULL); weechat_hook_completion ("aspell_langs", N_("list of supported langs for aspell"), &weechat_aspell_completion_langs_cb, NULL); /* * callback for spell checking input text * we use a low priority here, so that other modifiers "input_text_display" * (from other plugins) will be called before this one */ weechat_hook_modifier ("500|input_text_display", &weechat_aspell_modifier_cb, NULL); return WEECHAT_RC_OK; }