summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimmo Saan <simmo.saan@gmail.com>2015-11-18 19:49:10 +0200
committerSimmo Saan <simmo.saan@gmail.com>2017-06-17 18:38:37 +0300
commitd12e29620b8ec2e6cfda047ec7f67762e1e07c67 (patch)
tree90e451d1a2aac928f5c48916d5f116ea92d82503 /src
parent48a3baedd5119798cbc0030eb4ea0ff661f58cbb (diff)
downloadweechat-d12e29620b8ec2e6cfda047ec7f67762e1e07c67.zip
irc: make command characters optional in server's command option
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-protocol.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 67b0109cd..72bfb1776 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -2455,7 +2455,7 @@ IRC_PROTOCOL_CALLBACK(wallops)
IRC_PROTOCOL_CALLBACK(001)
{
char *server_command, **commands, **ptr_command, *vars_replaced, *away_msg;
- char *usermode;
+ char *usermode, *slash_command;
IRC_PROTOCOL_MIN_ARGS(3);
@@ -2523,8 +2523,23 @@ IRC_PROTOCOL_CALLBACK(001)
{
vars_replaced = irc_message_replace_vars (server, NULL,
*ptr_command);
- weechat_command (server->buffer,
- (vars_replaced) ? vars_replaced : *ptr_command);
+ if (weechat_string_is_command_char (*ptr_command))
+ {
+ weechat_command (server->buffer,
+ (vars_replaced) ? vars_replaced : *ptr_command);
+ }
+ else
+ {
+ slash_command = malloc (1 + strlen((vars_replaced) ? vars_replaced : *ptr_command) + 1);
+ if (slash_command)
+ {
+ strcpy (slash_command, "/");
+ strcat (slash_command, (vars_replaced) ? vars_replaced : *ptr_command);
+ weechat_command (server->buffer, slash_command);
+ free (slash_command);
+ }
+ }
+
if (vars_replaced)
free (vars_replaced);
}