diff options
-rw-r--r-- | src/plugins/relay/irc/relay-irc.c | 19 | ||||
-rw-r--r-- | src/plugins/relay/relay-config.c | 6 | ||||
-rw-r--r-- | src/plugins/relay/relay-config.h | 1 |
3 files changed, 24 insertions, 2 deletions
diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c index 3facb21e0..bffc70a01 100644 --- a/src/plugins/relay/irc/relay-irc.c +++ b/src/plugins/relay/irc/relay-irc.c @@ -754,7 +754,7 @@ relay_irc_send_channel_backlog (struct t_relay_client *client, void *ptr_own_lines, *ptr_line, *ptr_line_data; void *ptr_hdata_line, *ptr_hdata_line_data; char *tags, *message; - const char *ptr_nick, *ptr_nick1, *ptr_nick2, *ptr_host; + const char *ptr_nick, *ptr_nick1, *ptr_nick2, *ptr_host, *localvar_nick; int irc_command, irc_action, count, max_number, max_minutes; time_t date_min, date_min2, date; @@ -780,6 +780,10 @@ relay_irc_send_channel_backlog (struct t_relay_client *client, if (!ptr_hdata_line_data) return; + localvar_nick = NULL; + if (weechat_config_boolean (relay_config_irc_backlog_since_last_message)) + localvar_nick = weechat_buffer_get_string (buffer, "localvar_nick"); + max_number = weechat_config_integer (relay_config_irc_backlog_max_number); max_minutes = weechat_config_integer (relay_config_irc_backlog_max_minutes); date_min = (max_minutes > 0) ? time (NULL) - (max_minutes * 60) : 0; @@ -810,7 +814,7 @@ relay_irc_send_channel_backlog (struct t_relay_client *client, &irc_command, NULL, /* irc_action */ &date, - NULL, /* nick */ + &ptr_nick, NULL, /* nick1 */ NULL, /* nick2 */ NULL, /* host */ @@ -826,6 +830,17 @@ relay_irc_send_channel_backlog (struct t_relay_client *client, /* if we have reached max number of messages, exit loop */ if ((max_number > 0) && (count > max_number)) break; + + if (localvar_nick && localvar_nick[0] + && ptr_nick && (strcmp (ptr_nick, localvar_nick) == 0)) + { + /* + * stop when we find a line sent by the current nick + * (and include this line) + */ + ptr_line = weechat_hdata_move (ptr_hdata_line, ptr_line, -1); + break; + } } ptr_line = weechat_hdata_move (ptr_hdata_line, ptr_line, -1); } diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c index cd76bd34d..5e9193621 100644 --- a/src/plugins/relay/relay-config.c +++ b/src/plugins/relay/relay-config.c @@ -68,6 +68,7 @@ struct t_config_option *relay_config_network_websocket_allowed_origins; struct t_config_option *relay_config_irc_backlog_max_minutes; struct t_config_option *relay_config_irc_backlog_max_number; struct t_config_option *relay_config_irc_backlog_since_last_disconnect; +struct t_config_option *relay_config_irc_backlog_since_last_message; struct t_config_option *relay_config_irc_backlog_tags; struct t_config_option *relay_config_irc_backlog_time_format; @@ -816,6 +817,11 @@ relay_config_init () "backlog_since_last_disconnect", "boolean", N_("display backlog starting from last client disconnect"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_irc_backlog_since_last_message = weechat_config_new_option ( + relay_config_file, ptr_section, + "backlog_since_last_message", "boolean", + N_("display backlog starting from your last message"), + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); relay_config_irc_backlog_tags = weechat_config_new_option ( relay_config_file, ptr_section, "backlog_tags", "string", diff --git a/src/plugins/relay/relay-config.h b/src/plugins/relay/relay-config.h index 09c1851c8..f0ae50cbb 100644 --- a/src/plugins/relay/relay-config.h +++ b/src/plugins/relay/relay-config.h @@ -50,6 +50,7 @@ extern struct t_config_option *relay_config_network_websocket_allowed_origins; extern struct t_config_option *relay_config_irc_backlog_max_minutes; extern struct t_config_option *relay_config_irc_backlog_max_number; extern struct t_config_option *relay_config_irc_backlog_since_last_disconnect; +extern struct t_config_option *relay_config_irc_backlog_since_last_message; extern struct t_config_option *relay_config_irc_backlog_tags; extern struct t_config_option *relay_config_irc_backlog_time_format; |