summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/command.c38
-rw-r--r--src/common/weeconfig.c5
-rw-r--r--src/common/weeconfig.h1
3 files changed, 39 insertions, 5 deletions
diff --git a/src/common/command.c b/src/common/command.c
index 3ec009572..fb4c470ed 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -290,6 +290,7 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
char **argv, **argv2, *alias_command;
char **commands, **ptr_cmd, **ptr_next_cmd;
char *args_replaced, *vars_replaced, *new_ptr_cmd;
+ char *unknown_command;
int some_args_replaced;
t_weechat_alias *ptr_alias;
@@ -609,11 +610,38 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
return 1;
}
}
- irc_display_prefix (NULL, NULL, PREFIX_ERROR);
- gui_printf (NULL,
- _("%s unknown command \"%s\" (type /help for help)\n"),
- WEECHAT_ERROR,
- command + 1);
+
+ /* should we send unknown command to IRC server? */
+ if (cfg_irc_send_unknown_commands)
+ {
+ if (ptr_args)
+ unknown_command = (char *)malloc (strlen (command + 1) + 2 + strlen (ptr_args) + 1);
+ else
+ unknown_command = (char *)malloc (strlen (command + 1) + 1);
+
+ if (unknown_command)
+ {
+ strcpy (unknown_command, command + 1);
+ if (ptr_args)
+ {
+ strcat (unknown_command, " :");
+ strcat (unknown_command, ptr_args);
+ }
+ irc_cmd_send_quote (server, channel, unknown_command);
+ free (unknown_command);
+ }
+ }
+ else
+ {
+ irc_display_prefix (NULL, NULL, PREFIX_ERROR);
+ gui_printf (NULL,
+ _("%s unknown command \"%s\" (type /help for help). "
+ "To send unknown commands to IRC server, enable option "
+ "irc_send_unknown_commands.\n"),
+ WEECHAT_ERROR,
+ command + 1);
+ }
+
free_exploded_string (argv);
}
free (command);
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index 308ed64b7..f42d62b2e 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -710,6 +710,7 @@ int cfg_irc_fifo_pipe;
char *cfg_irc_highlight;
int cfg_irc_colors_receive;
int cfg_irc_colors_send;
+int cfg_irc_send_unknown_commands;
t_config_option weechat_options_irc[] =
{ { "irc_display_away", N_("display message for away"),
@@ -772,6 +773,10 @@ t_config_option weechat_options_irc[] =
"%U=underline, %R=reverse)"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_irc_colors_send, NULL, config_change_noop },
+ { "irc_send_unknown_commands", N_("send unknown commands to IRC server"),
+ N_("send unknown commands to IRC server"),
+ OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
+ NULL, NULL, &cfg_irc_send_unknown_commands, NULL, &config_change_noop },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h
index abb230b4c..3eeeb51fd 100644
--- a/src/common/weeconfig.h
+++ b/src/common/weeconfig.h
@@ -212,6 +212,7 @@ extern int cfg_irc_fifo_pipe;
extern char *cfg_irc_highlight;
extern int cfg_irc_colors_receive;
extern int cfg_irc_colors_send;
+extern int cfg_irc_send_unknown_commands;
extern int cfg_dcc_auto_accept_files;
extern int cfg_dcc_auto_accept_chats;