xfer: add option xfer.look.pv_tags

This commit is contained in:
Sebastien Helleu 2013-07-11 22:43:13 +02:00
parent 2cbdbb45d6
commit bd3a12378e
4 changed files with 19 additions and 2 deletions

View File

@ -43,6 +43,7 @@ Version 0.4.2 (under dev!)
buffer per nick buffer per nick
* relay: add command "ping" in weechat protocol (task #12689) * relay: add command "ping" in weechat protocol (task #12689)
* relay: fix binding to an IP address (bug #39119) * relay: fix binding to an IP address (bug #39119)
* xfer: add option xfer.look.pv_tags
* xfer: fix compilation on OpenBSD (bug #39071) * xfer: fix compilation on OpenBSD (bug #39071)
Version 0.4.1 (2013-05-20) Version 0.4.1 (2013-05-20)

View File

@ -30,6 +30,7 @@
#include "xfer.h" #include "xfer.h"
#include "xfer-chat.h" #include "xfer-chat.h"
#include "xfer-buffer.h" #include "xfer-buffer.h"
#include "xfer-config.h"
/* /*
@ -110,6 +111,7 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
char *buf2, *pos, *ptr_buf, *ptr_buf2, *next_ptr_buf; char *buf2, *pos, *ptr_buf, *ptr_buf2, *next_ptr_buf;
char *ptr_buf_decoded, *ptr_buf_without_weechat_colors, *ptr_buf_color; char *ptr_buf_decoded, *ptr_buf_without_weechat_colors, *ptr_buf_color;
char str_tags[256], *str_color; char str_tags[256], *str_color;
const char *pv_tags;
int num_read, length, ctcp_action; int num_read, length, ctcp_action;
/* make C compiler happy */ /* make C compiler happy */
@ -183,10 +185,13 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
ptr_buf2 = (ptr_buf_color) ? ptr_buf2 = (ptr_buf_color) ?
ptr_buf_color : ((ptr_buf_without_weechat_colors) ? ptr_buf_color : ((ptr_buf_without_weechat_colors) ?
ptr_buf_without_weechat_colors : ((ptr_buf_decoded) ? ptr_buf_decoded : ptr_buf)); ptr_buf_without_weechat_colors : ((ptr_buf_decoded) ? ptr_buf_decoded : ptr_buf));
pv_tags = weechat_config_string (xfer_config_look_pv_tags);
if (ctcp_action) if (ctcp_action)
{ {
snprintf (str_tags, sizeof (str_tags), snprintf (str_tags, sizeof (str_tags),
"irc_privmsg,irc_action,notify_message,nick_%s,log1", "irc_privmsg,irc_action,%s%snick_%s,log1",
(pv_tags && pv_tags[0]) ? pv_tags : "",
(pv_tags && pv_tags[0]) ? "," : "",
xfer->remote_nick); xfer->remote_nick);
weechat_printf_tags (xfer->buffer, weechat_printf_tags (xfer->buffer,
str_tags, str_tags,
@ -205,7 +210,9 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
(xfer->remote_nick_color) ? (xfer->remote_nick_color) ?
xfer->remote_nick_color : weechat_config_color (weechat_config_get ("weechat.color.chat_nick_other"))); xfer->remote_nick_color : weechat_config_color (weechat_config_get ("weechat.color.chat_nick_other")));
snprintf (str_tags, sizeof (str_tags), snprintf (str_tags, sizeof (str_tags),
"irc_privmsg,notify_message,prefix_nick_%s,nick_%s,log1", "irc_privmsg,%s%sprefix_nick_%s,nick_%s,log1",
(pv_tags && pv_tags[0]) ? pv_tags : "",
(pv_tags && pv_tags[0]) ? "," : "",
(str_color) ? str_color : "default", (str_color) ? str_color : "default",
xfer->remote_nick); xfer->remote_nick);
if (str_color) if (str_color)

View File

@ -34,6 +34,7 @@ struct t_config_file *xfer_config_file = NULL;
struct t_config_option *xfer_config_look_auto_open_buffer; struct t_config_option *xfer_config_look_auto_open_buffer;
struct t_config_option *xfer_config_look_progress_bar_size; struct t_config_option *xfer_config_look_progress_bar_size;
struct t_config_option *xfer_config_look_pv_tags;
/* xfer config, color section */ /* xfer config, color section */
@ -134,6 +135,13 @@ xfer_config_init ()
N_("size of progress bar, in chars (if 0, progress bar is disabled)"), N_("size of progress bar, in chars (if 0, progress bar is disabled)"),
NULL, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL, 0, NULL, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
xfer_config_look_pv_tags = weechat_config_new_option (
xfer_config_file, ptr_section,
"pv_tags", "string",
N_("comma separated list of tags used in private messages, for example: "
"\"notify_message\", \"notify_private\" or \"notify_highlight\""),
NULL, 0, 0, "notify_private", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "color", ptr_section = weechat_config_new_section (xfer_config_file, "color",
0, 0, 0, 0,

View File

@ -28,6 +28,7 @@ extern struct t_config_file *xfer_config;
extern struct t_config_option *xfer_config_look_auto_open_buffer; extern struct t_config_option *xfer_config_look_auto_open_buffer;
extern struct t_config_option *xfer_config_look_progress_bar_size; extern struct t_config_option *xfer_config_look_progress_bar_size;
extern struct t_config_option *xfer_config_look_pv_tags;
extern struct t_config_option *xfer_config_color_status[]; extern struct t_config_option *xfer_config_color_status[];
extern struct t_config_option *xfer_config_color_text; extern struct t_config_option *xfer_config_color_text;