1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-07 02:03:13 +02:00

irc: display account messages in buffers

This commit is contained in:
Max Teufel
2018-09-16 08:20:35 +02:00
committed by Sébastien Helleu
parent 1f2d90b643
commit 0027c23b7e
5 changed files with 65 additions and 5 deletions
+6 -3
View File
@@ -1158,8 +1158,8 @@ void
irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
const char *nick)
{
int i, unmask_delay, length_tags, nick_found, join, chghost;
int nick_changed, smart_filtered, remove_smart_filter;
int i, unmask_delay, length_tags, nick_found, join, account;
int chghost, nick_changed, smart_filtered, remove_smart_filter;
time_t *ptr_time, date_min;
struct t_hdata *hdata_line, *hdata_line_data;
struct t_gui_line *own_lines;
@@ -1235,6 +1235,7 @@ irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
length_tags = 0;
nick_found = 0;
join = 0;
account = 0;
chghost = 0;
nick_changed = 0;
irc_nick1 = NULL;
@@ -1249,6 +1250,8 @@ irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
}
else if (strcmp (tags[i], "irc_join") == 0)
join = 1;
else if (strcmp (tags[i], "irc_account") == 0)
account = 1;
else if (strcmp (tags[i], "irc_chghost") == 0)
chghost = 1;
else if (strcmp (tags[i], "irc_nick") == 0)
@@ -1274,7 +1277,7 @@ irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
break;
remove_smart_filter = 1;
}
else if (nick_found && (join || chghost) && smart_filtered)
else if (nick_found && (join || account || chghost) && smart_filtered)
{
remove_smart_filter = 1;
}
+1
View File
@@ -84,6 +84,7 @@
#define IRC_COLOR_STATUS_NAME weechat_color("status_name")
#define IRC_COLOR_STATUS_NAME_SSL weechat_color("status_name_ssl")
#define IRC_COLOR_MESSAGE_JOIN weechat_color(weechat_config_string(irc_config_color_message_join))
#define IRC_COLOR_MESSAGE_ACCOUNT weechat_color(weechat_config_string(irc_config_color_message_account))
#define IRC_COLOR_MESSAGE_CHGHOST weechat_color(weechat_config_string(irc_config_color_message_chghost))
#define IRC_COLOR_MESSAGE_KICK weechat_color(weechat_config_string(irc_config_color_message_kick))
#define IRC_COLOR_MESSAGE_QUIT weechat_color(weechat_config_string(irc_config_color_message_quit))
+16
View File
@@ -98,6 +98,7 @@ struct t_config_option *irc_config_look_pv_tags;
struct t_config_option *irc_config_look_raw_messages;
struct t_config_option *irc_config_look_server_buffer;
struct t_config_option *irc_config_look_smart_filter;
struct t_config_option *irc_config_look_smart_filter_account;
struct t_config_option *irc_config_look_smart_filter_chghost;
struct t_config_option *irc_config_look_smart_filter_delay;
struct t_config_option *irc_config_look_smart_filter_join;
@@ -115,6 +116,8 @@ struct t_config_option *irc_config_color_item_channel_modes;
struct t_config_option *irc_config_color_item_lag_counting;
struct t_config_option *irc_config_color_item_lag_finished;
struct t_config_option *irc_config_color_item_nick_modes;
struct t_config_option *irc_config_color_message_account;
struct t_config_option *irc_config_color_message_join;
struct t_config_option *irc_config_color_message_chghost;
struct t_config_option *irc_config_color_message_join;
struct t_config_option *irc_config_color_message_kick;
@@ -3071,6 +3074,13 @@ irc_config_init ()
"\"irc_smart_filter\", see /help filter)"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_smart_filter_account = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter_account", "boolean",
/* TRANSLATORS: please do not translate "account" */
N_("enable smart filter for \"account\" messages"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_smart_filter_chghost = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter_chghost", "boolean",
@@ -3200,6 +3210,12 @@ irc_config_init ()
NULL, NULL, NULL,
&irc_config_change_color_item_nick_modes, NULL, NULL,
NULL, NULL, NULL);
irc_config_color_message_account = weechat_config_new_option (
irc_config_file, ptr_section,
"message_account", "color",
N_("color for text in account messages"),
NULL, -1, 0, "cyan", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_color_message_chghost = weechat_config_new_option (
irc_config_file, ptr_section,
"message_chghost", "color",
+2
View File
@@ -138,6 +138,7 @@ extern struct t_config_option *irc_config_look_pv_tags;
extern struct t_config_option *irc_config_look_raw_messages;
extern struct t_config_option *irc_config_look_server_buffer;
extern struct t_config_option *irc_config_look_smart_filter;
extern struct t_config_option *irc_config_look_smart_filter_account;
extern struct t_config_option *irc_config_look_smart_filter_chghost;
extern struct t_config_option *irc_config_look_smart_filter_delay;
extern struct t_config_option *irc_config_look_smart_filter_join;
@@ -153,6 +154,7 @@ extern struct t_config_option *irc_config_color_item_channel_modes;
extern struct t_config_option *irc_config_color_item_lag_counting;
extern struct t_config_option *irc_config_color_item_lag_finished;
extern struct t_config_option *irc_config_color_item_nick_modes;
extern struct t_config_option *irc_config_color_message_account;
extern struct t_config_option *irc_config_color_message_chghost;
extern struct t_config_option *irc_config_color_message_join;
extern struct t_config_option *irc_config_color_message_kick;
+40 -2
View File
@@ -331,13 +331,25 @@ IRC_PROTOCOL_CALLBACK(account)
{
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
char *pos_account;
int cap_account_notify;
struct t_irc_channel_speaking *ptr_nick_speaking;
char *pos_account, str_account[512];
int cap_account_notify, local_account, smart_filter;
IRC_PROTOCOL_MIN_ARGS(3);
local_account = (irc_server_strcasecmp (server, nick, server->nick) == 0);
pos_account = (strcmp (argv[2], "*") != 0) ? argv[2] : NULL;
str_account[0] = '\0';
if (pos_account)
{
snprintf (str_account, sizeof (str_account),
"%s%s",
irc_nick_color_for_msg (server, 1, NULL, pos_account),
pos_account);
}
cap_account_notify = weechat_hashtable_has_key (server->cap_list,
"account-notify");
@@ -347,6 +359,32 @@ IRC_PROTOCOL_CALLBACK(account)
ptr_nick = irc_nick_search (server, ptr_channel, nick);
if (ptr_nick)
{
if (!ignored)
{
ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter))
&& (weechat_config_boolean (irc_config_look_smart_filter_account))) ?
irc_channel_nick_speaking_time_search (server, ptr_channel, nick, 1) : NULL;
smart_filter = (!local_account
&& weechat_config_boolean (irc_config_look_smart_filter)
&& weechat_config_boolean (irc_config_look_smart_filter_account)
&& !ptr_nick_speaking);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, NULL, ptr_channel->buffer),
date,
irc_protocol_tags (
command,
smart_filter ? "irc_smart_filter" : NULL,
nick, address),
(pos_account) ? _("%s%s%s%s has identified as %s") : _("%s%s%s%s has unidentified"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
nick,
IRC_COLOR_MESSAGE_ACCOUNT,
(pos_account) ? str_account : NULL);
}
if (ptr_nick->account)
free (ptr_nick->account);
ptr_nick->account = (cap_account_notify && pos_account) ?