1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 14:26:39 +02:00

xfer: add missing tags in DCC chat messages: nick_xxx, prefix_nick_ccc, logN

This commit is contained in:
Sebastien Helleu
2012-12-17 23:30:37 +01:00
parent d37184e450
commit 491e31ff55
4 changed files with 42 additions and 13 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.0-dev, 2012-12-16
v0.4.0-dev, 2012-12-17
Version 0.4.0 (under dev!)
@@ -78,6 +78,7 @@ Version 0.4.0 (under dev!)
"ipv4." and/or "ipv6." before protocol name, to force IPv4/IPv6 (task #12270)
* relay: add missing "ssl." in output of /relay listrelay
* script: fix compilation on OS X
* xfer: add missing tags in DCC chat messages: nick_xxx, prefix_nick_ccc, logN
* xfer: display remote IP address for DCC chat/file (task #12289)
* xfer: limit bytes received to file size (for DCC file received), fix crash
when displaying a xfer file with pos greater than size
+37 -9
View File
@@ -32,6 +32,21 @@
#include "xfer-buffer.h"
/*
* Returns color name for tags (replace "," by ":").
*
* Note: result must be freed after use.
*/
char *
xfer_chat_color_for_tags (const char *color)
{
if (!color)
return NULL;
return weechat_string_replace (color, ",", ":");
}
/*
* Sends data to remote host via xfer chat.
*/
@@ -94,7 +109,7 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
static char buffer[4096 + 2];
char *buf2, *pos, *ptr_buf, *ptr_buf2, *next_ptr_buf;
char *ptr_buf_decoded, *ptr_buf_without_weechat_colors, *ptr_buf_color;
char str_tags[256];
char str_tags[256], *str_color;
int num_read, length, ctcp_action;
/* make C compiler happy */
@@ -171,14 +186,14 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
if (ctcp_action)
{
snprintf (str_tags, sizeof (str_tags),
"irc_privmsg,irc_action,notify_message,nick_%s",
"irc_privmsg,irc_action,notify_message,nick_%s,log1",
xfer->remote_nick);
weechat_printf_tags (xfer->buffer,
str_tags,
"%s%s%s%s%s%s",
weechat_prefix ("action"),
(xfer->remote_nick_color) ?
xfer->remote_nick_color : weechat_color ("chat_nick_other"),
weechat_color ((xfer->remote_nick_color) ?
xfer->remote_nick_color : "chat_nick_other"),
xfer->remote_nick,
weechat_color ("chat"),
(ptr_buf2[0]) ? " " : "",
@@ -186,14 +201,20 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
}
else
{
str_color = xfer_chat_color_for_tags (
(xfer->remote_nick_color) ?
xfer->remote_nick_color : weechat_config_color (weechat_config_get ("weechat.color.chat_nick_other")));
snprintf (str_tags, sizeof (str_tags),
"irc_privmsg,notify_message,nick_%s",
"irc_privmsg,notify_message,prefix_nick_%s,nick_%s,log1",
(str_color) ? str_color : "default",
xfer->remote_nick);
if (str_color)
free (str_color);
weechat_printf_tags (xfer->buffer,
str_tags,
"%s%s\t%s",
(xfer->remote_nick_color) ?
xfer->remote_nick_color : weechat_color ("chat_nick_other"),
weechat_color ((xfer->remote_nick_color) ?
xfer->remote_nick_color : "chat_nick_other"),
xfer->remote_nick,
ptr_buf2);
}
@@ -229,7 +250,7 @@ xfer_chat_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
struct t_xfer *ptr_xfer;
char *input_data_color;
char *input_data_color, str_tags[256], *str_color;
/* make C compiler happy */
(void) data;
@@ -243,11 +264,18 @@ xfer_chat_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
xfer_chat_sendf (ptr_xfer, "%s\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")));
snprintf (str_tags, sizeof (str_tags),
"irc_privmsg,no_highlight,prefix_nick_%s,nick_%s,log1",
(str_color) ? str_color : "default",
ptr_xfer->local_nick);
if (str_color)
free (str_color);
input_data_color = weechat_hook_modifier_exec ("irc_color_decode",
"1",
input_data);
weechat_printf_tags (buffer,
"irc_privmsg,no_highlight",
str_tags,
"%s%s\t%s",
weechat_color ("chat_nick_self"),
ptr_xfer->local_nick,
+1 -1
View File
@@ -556,7 +556,7 @@ xfer_new (const char *plugin_name, const char *plugin_id,
new_xfer->type = type;
new_xfer->protocol = protocol;
new_xfer->remote_nick = strdup (remote_nick);
ptr_color = weechat_info_get ("irc_nick_color", remote_nick);
ptr_color = weechat_info_get ("irc_nick_color_name", remote_nick);
new_xfer->remote_nick_color = (ptr_color) ? strdup (ptr_color) : NULL;
new_xfer->local_nick = (local_nick) ? strdup (local_nick) : NULL;
new_xfer->charset_modifier = (charset_modifier) ? strdup (charset_modifier) : NULL;
+2 -2
View File
@@ -126,8 +126,8 @@ struct t_xfer
/* internal data */
enum t_xfer_status status; /* xfer status (waiting, sending,..) */
struct t_gui_buffer *buffer; /* buffer (for chat only) */
char *remote_nick_color; /* color for remote nick (given by */
/* IRC plugin) */
char *remote_nick_color; /* color name for remote nick */
/* (returned by IRC plugin) */
int fast_send; /* fast send file: does not wait ACK */
int blocksize; /* block size for sending file */
time_t start_time; /* time when xfer started */