summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimmo Saan <simmo.saan@gmail.com>2015-05-18 19:21:03 +0300
committerSimmo Saan <simmo.saan@gmail.com>2015-05-18 19:21:03 +0300
commit8d1d2c0321e9773e2a361e311f1a209f96120ffd (patch)
treeb6fa04697453ec2afc8d6415b75a1ce1930cddf7 /src
parent3262599413e5928dad5ae87c78967560cc144527 (diff)
downloadweechat-8d1d2c0321e9773e2a361e311f1a209f96120ffd.zip
xfer: correctly use and parse \r\n line endings in CHAT (closes #425)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/xfer/xfer-chat.c8
-rw-r--r--src/plugins/xfer/xfer-command.c2
2 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c
index 058f00ecf..94af315b1 100644
--- a/src/plugins/xfer/xfer-chat.c
+++ b/src/plugins/xfer/xfer-chat.c
@@ -160,6 +160,12 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
{
ctcp_action = 0;
length = strlen (ptr_buf);
+ if (ptr_buf[length - 1] == '\r')
+ {
+ ptr_buf[length - 1] = '\0';
+ length--;
+ }
+
if ((ptr_buf[0] == '\01')
&& (ptr_buf[length - 1] == '\01'))
{
@@ -268,7 +274,7 @@ xfer_chat_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
{
if (!XFER_HAS_ENDED(ptr_xfer->status))
{
- xfer_chat_sendf (ptr_xfer, "%s\n", input_data);
+ xfer_chat_sendf (ptr_xfer, "%s\r\n", input_data);
if (!XFER_HAS_ENDED(ptr_xfer->status))
{
str_color = xfer_chat_color_for_tags (weechat_config_color (weechat_config_get ("weechat.color.chat_nick_self")));
diff --git a/src/plugins/xfer/xfer-command.c b/src/plugins/xfer/xfer-command.c
index 728440b22..ff5f18f01 100644
--- a/src/plugins/xfer/xfer-command.c
+++ b/src/plugins/xfer/xfer-command.c
@@ -58,7 +58,7 @@ xfer_command_me (void *data, struct t_gui_buffer *buffer, int argc,
if (!XFER_HAS_ENDED(ptr_xfer->status))
{
- xfer_chat_sendf (ptr_xfer, "\01ACTION %s\01\n",
+ xfer_chat_sendf (ptr_xfer, "\01ACTION %s\01\r\n",
(argv_eol[1]) ? argv_eol[1] : "");
weechat_printf_tags (buffer,
"no_highlight",