summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2004-10-03 01:56:30 +0000
committerSebastien Helleu <flashcode@flashtux.org>2004-10-03 01:56:30 +0000
commit0a6945b6ed451c3277b7c07313412ea7d31aeb50 (patch)
tree92d55aff0d07da4efabb6332969b202809394ed3 /src
parent046452b7e0bc0e48bdab5e2477c13ef993542bf3 (diff)
downloadweechat-0a6945b6ed451c3277b7c07313412ea7d31aeb50.zip
Command "/buffer notify"
Diffstat (limited to 'src')
-rw-r--r--src/common/command.c54
-rw-r--r--src/gui/curses/gui-display.c13
-rw-r--r--src/gui/gui-common.c3
-rw-r--r--src/gui/gui.h6
4 files changed, 70 insertions, 6 deletions
diff --git a/src/common/command.c b/src/common/command.c
index a94cc44d7..f9fbd7828 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -46,8 +46,9 @@ t_weechat_command weechat_commands[] =
{ "buffer", N_("manage buffers"),
N_("[action | number]"),
N_("action: action to do:\n"
- " move move buffer in the list (may be relative, for example -1)\n"
- " list list opened buffers (no parameter implies this list)\n"
+ " move move buffer in the list (may be relative, for example -1)\n"
+ " list list opened buffers (no parameter implies this list)\n"
+ " notify set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
"number: jump to buffer by number"),
0, MAX_ARGS, weechat_cmd_buffer, NULL },
{ "clear", N_("clear window(s)"),
@@ -915,6 +916,55 @@ weechat_cmd_buffer (int argc, char **argv)
return -1;
}
}
+ else if (strcasecmp (argv[0], "notify") == 0)
+ {
+ /* set notify level for buffer */
+
+ if (argc < 2)
+ {
+ /* display notify level for all buffers */
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf (NULL, _("Notify levels: "));
+ for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ {
+ gui_printf (NULL, "%d.%s:",
+ ptr_buffer->number,
+ (ptr_buffer->dcc) ? "DCC" :
+ ((BUFFER_IS_SERVER(ptr_buffer)) ? SERVER(ptr_buffer)->name :
+ CHANNEL(ptr_buffer)->name));
+ if (ptr_buffer->dcc)
+ gui_printf (NULL, "-");
+ else
+ gui_printf (NULL, "%d", ptr_buffer->notify_level);
+ if (ptr_buffer->next_buffer)
+ gui_printf (NULL, " ");
+ }
+ gui_printf (NULL, "\n");
+ }
+ else
+ {
+ error = NULL;
+ number = strtol (argv[1], &error, 10);
+ if ((error) && (error[0] == '\0'))
+ {
+ if ((number < 0) || (number > 3))
+ {
+ /* invalid highlight level */
+ gui_printf (NULL, _("%s incorrect notify level (must be between 0 and 3)\n"),
+ WEECHAT_ERROR);
+ return -1;
+ }
+ gui_current_window->buffer->notify_level = number;
+ }
+ else
+ {
+ /* invalid number */
+ gui_printf (NULL, _("%s incorrect notify level (must be between 0 and 3)\n"),
+ WEECHAT_ERROR);
+ return -1;
+ }
+ }
+ }
else
{
/* jump to buffer by number */
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c
index 1f65fee8c..4c969e625 100644
--- a/src/gui/curses/gui-display.c
+++ b/src/gui/curses/gui-display.c
@@ -1966,10 +1966,15 @@ gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
}
if (buffer->num_displayed == 0)
{
- hotlist_add (buffer->last_line->line_with_message +
- buffer->last_line->line_with_highlight,
- buffer);
- gui_draw_buffer_status (gui_current_window->buffer, 1);
+ if (3 - buffer->last_line->line_with_message -
+ buffer->last_line->line_with_highlight <=
+ buffer->notify_level)
+ {
+ hotlist_add (buffer->last_line->line_with_message +
+ buffer->last_line->line_with_highlight,
+ buffer);
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
+ }
}
}
}
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c
index 43a6297ed..c9076e838 100644
--- a/src/gui/gui-common.c
+++ b/src/gui/gui-common.c
@@ -182,6 +182,9 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
new_buffer->num_lines = 0;
new_buffer->line_complete = 1;
+ /* notify level */
+ new_buffer->notify_level = 3;
+
/* create/append to log file */
new_buffer->log_filename = NULL;
new_buffer->log_file = NULL;
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 20d561677..5dd4fecad 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -150,6 +150,12 @@ struct t_gui_buffer
int num_lines; /* number of lines in the window */
int line_complete; /* current line complete ? (\n ending) */
+ /* notify level: when activity should be displayed? default: 3 (always) */
+ int notify_level; /* 0 = never */
+ /* 1 = highlight only */
+ /* 2 = highlight + message */
+ /* 3 = highlight + message + join/part */
+
/* file to save buffer content */
char *log_filename; /* filename for saving buffer content */
FILE *log_file; /* for logging buffer to file */