summaryrefslogtreecommitdiff
path: root/src/irc/irc-send.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-06-18 09:28:16 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-06-18 09:28:16 +0000
commit70fe8e94723643d24103e0908825b3aa0211341c (patch)
treeac02aabafe0954c94f6928a0f80dab514f5c0d32 /src/irc/irc-send.c
parentb0310b6e78ef3776f85e4ea1a8a71cc1f6bde707 (diff)
downloadweechat-70fe8e94723643d24103e0908825b3aa0211341c.zip
part message now accepts %v (replaced by WeeChat version), like quit message
Diffstat (limited to 'src/irc/irc-send.c')
-rw-r--r--src/irc/irc-send.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index 002747b5a..1809c2c40 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -1138,7 +1138,7 @@ irc_cmd_send_oper (t_irc_server *server, char *arguments)
int
irc_cmd_send_part (t_irc_server *server, char *arguments)
{
- char *channel_name, *pos_args;
+ char *channel_name, *pos_args, *ptr_arg, *pos, buffer[4096];
t_irc_channel *ptr_channel;
if (arguments)
@@ -1192,16 +1192,28 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
pos_args = NULL;
}
- if (pos_args)
- server_sendf (server, "PART %s :%s\r\n", channel_name, pos_args);
- else
+ ptr_arg = (pos_args) ? pos_args :
+ (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0]) ?
+ cfg_irc_default_msg_part : NULL;
+
+ if (ptr_arg)
{
- if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0])
- server_sendf (server, "PART %s :%s\r\n",
- channel_name, cfg_irc_default_msg_part);
+ pos = strstr (ptr_arg, "%v");
+ if (pos)
+ {
+ pos[0] = '\0';
+ snprintf (buffer, sizeof (buffer), "%s%s%s",
+ ptr_arg, PACKAGE_VERSION, pos + 2);
+ pos[0] = '%';
+ }
else
- server_sendf (server, "PART %s\r\n", channel_name);
+ snprintf (buffer, sizeof (buffer), "%s",
+ ptr_arg);
+ server_sendf (server, "PART %s :%s\r\n",
+ channel_name, buffer);
}
+ else
+ server_sendf (server, "PART %s\r\n", channel_name);
return 0;
}