diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-09-30 15:39:25 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-09-30 15:39:25 +0200 |
commit | 12421a67da6c80c1b1cbdbf9241d18263673bdb2 (patch) | |
tree | 59971f3e6f0df7710306d64d9f07610e2fb8d17d | |
parent | 9fa560300ff99bb6f57a0b8350da83d34cd60711 (diff) | |
download | weechat-12421a67da6c80c1b1cbdbf9241d18263673bdb2.zip |
Set unread marker for IRC server/channels/pv buffers when using /away command
-rw-r--r-- | src/gui/gui-buffer.c | 15 | ||||
-rw-r--r-- | src/gui/gui-buffer.h | 1 | ||||
-rw-r--r-- | src/gui/gui-input.c | 14 | ||||
-rw-r--r-- | src/plugins/irc/irc-buffer.c | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-command.c | 15 |
5 files changed, 32 insertions, 15 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 1f1cccfb4..7f4a1ec15 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -506,6 +506,17 @@ gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer, } /* + * gui_buffer_set_unread: set unread marker for a buffer + */ + +void +gui_buffer_set_unread (struct t_gui_buffer *buffer) +{ + if (buffer->type == GUI_BUFFER_TYPE_FORMATED) + buffer->last_read_line = buffer->last_line; +} + +/* * gui_buffer_set: set a buffer property */ @@ -537,6 +548,10 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, gui_hotlist_add (buffer, number, NULL, 1); } } + else if (string_strcasecmp (property, "unread") == 0) + { + gui_buffer_set_unread (buffer); + } if (!buffer) return; diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index 9e1a245f8..3118aedb3 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -207,6 +207,7 @@ extern void gui_buffer_set_highlight_words (struct t_gui_buffer *buffer, const char *new_highlight_words); extern void gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer, const char *new_highlight_tags); +extern void gui_buffer_set_unread (struct t_gui_buffer *buffer); extern void gui_buffer_set (struct t_gui_buffer *buffer, const char *property, void *value); extern struct t_gui_buffer *gui_buffer_search_main (); diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c index f8b9e1191..359a1a1c4 100644 --- a/src/gui/gui-input.c +++ b/src/gui/gui-input.c @@ -1373,8 +1373,7 @@ gui_input_set_unread () for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { - if (ptr_buffer->type == GUI_BUFFER_TYPE_FORMATED) - ptr_buffer->last_read_line = ptr_buffer->last_line; + gui_buffer_set_unread (ptr_buffer); } /* refresh all windows */ @@ -1388,12 +1387,11 @@ gui_input_set_unread () void gui_input_set_unread_current_buffer () { - if (gui_current_window - && (gui_current_window->buffer->type == GUI_BUFFER_TYPE_FORMATED)) - gui_current_window->buffer->last_read_line = gui_current_window->buffer->last_line; - - /* refresh all windows */ - gui_window_redraw_buffer (gui_current_window->buffer); + if (gui_current_window) + { + gui_buffer_set_unread (gui_current_window->buffer); + gui_window_redraw_buffer (gui_current_window->buffer); + } } /* diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c index 2e744dd8b..c20136dd4 100644 --- a/src/plugins/irc/irc-buffer.c +++ b/src/plugins/irc/irc-buffer.c @@ -209,7 +209,7 @@ irc_buffer_split_server () if (irc_buffer_servers) { - weechat_buffer_set (irc_buffer_servers, "key_unbind_meta-s", NULL); + weechat_buffer_set (irc_buffer_servers, "key_unbind_meta-s", ""); } for (ptr_server = irc_servers; ptr_server; diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 5604c4a0b..dd69d7684 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -256,6 +256,7 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments) { char *string, buffer[4096]; time_t time_now, elapsed; + struct t_irc_channel *ptr_channel; if (!server) return; @@ -291,14 +292,16 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments) free (string); } irc_server_set_away (server, server->nick, 1); - /*for (ptr_window = gui_windows; ptr_window; - ptr_window = ptr_window->next_window) + + /* reset "unread" indicator on server and channels/pv buffers */ + if (!weechat_config_boolean (irc_config_look_one_server_buffer)) + weechat_buffer_set (server->buffer, "unread", ""); + for (ptr_channel = server->channels; ptr_channel; + ptr_channel = ptr_channel->next_channel) { - if (strcmp (ptr_window->buffer->category, server->name) == 0) - ptr_window->buffer->last_read_line = - ptr_window->buffer->last_line; + weechat_buffer_set (ptr_channel->buffer, "unread", ""); } - */ + weechat_printf (NULL, "set unread"); } else { |