diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-11-01 19:30:30 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-11-01 19:30:30 +0100 |
commit | d16d11b392c0dca80f273644cece9bee8a1ba63a (patch) | |
tree | c99525424bb8b9910d56acce49f3af65990456f1 | |
parent | 239b48a644bc4cabb4fc339991f02baa0a041399 (diff) | |
download | weechat-d16d11b392c0dca80f273644cece9bee8a1ba63a.zip |
core: add option weechat.history.max_minutes: maximum number of minutes in history per buffer (task #10900) (patch from Quentin Pradet)
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | doc/de/autogen/user/weechat_options.txt | 5 | ||||
-rw-r--r-- | doc/en/autogen/user/weechat_options.txt | 5 | ||||
-rw-r--r-- | doc/fr/autogen/user/weechat_options.txt | 7 | ||||
-rw-r--r-- | doc/it/autogen/user/weechat_options.txt | 5 | ||||
-rw-r--r-- | po/cs.po | 8 | ||||
-rw-r--r-- | po/de.po | 10 | ||||
-rw-r--r-- | po/es.po | 8 | ||||
-rw-r--r-- | po/fr.po | 15 | ||||
-rw-r--r-- | po/hu.po | 9 | ||||
-rw-r--r-- | po/it.po | 9 | ||||
-rw-r--r-- | po/pl.po | 8 | ||||
-rw-r--r-- | po/pt_BR.po | 8 | ||||
-rw-r--r-- | po/ru.po | 8 | ||||
-rw-r--r-- | po/weechat.pot | 7 | ||||
-rw-r--r-- | src/core/wee-config.c | 8 | ||||
-rw-r--r-- | src/core/wee-config.h | 1 | ||||
-rw-r--r-- | src/gui/gui-line.c | 34 |
18 files changed, 140 insertions, 19 deletions
@@ -1,12 +1,14 @@ WeeChat ChangeLog ================= Sébastien Helleu <flashcode@flashtux.org> -v0.3.7-dev, 2011-10-30 +v0.3.7-dev, 2011-11-01 Version 0.3.7 (under dev!) -------------------------- +* core: add option weechat.history.max_minutes: maximum number of minutes in + history per buffer (task #10900) * core: fix help on plugin option when config_set_desc_plugin is called to set help on newly created option * core: add WEECHAT_HOME option in cmake and configure to setup default diff --git a/doc/de/autogen/user/weechat_options.txt b/doc/de/autogen/user/weechat_options.txt index 9a8bee296..9d7aa47d9 100644 --- a/doc/de/autogen/user/weechat_options.txt +++ b/doc/de/autogen/user/weechat_options.txt @@ -328,6 +328,11 @@ ** Typ: integer ** Werte: 0 .. 2147483647 (Standardwert: `4096`) +* *weechat.history.max_minutes* +** Beschreibung: `maximum number of minutes in history per buffer (0 = unlimited, examples: 1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)` +** Typ: integer +** Werte: 0 .. 2147483647 (Standardwert: `0`) + * *weechat.history.max_visited_buffers* ** Beschreibung: `maximale Anzahl an besuchten Buffern welche im Speicher gehalten werden sollen` ** Typ: integer diff --git a/doc/en/autogen/user/weechat_options.txt b/doc/en/autogen/user/weechat_options.txt index 056f1d811..3ed8e3929 100644 --- a/doc/en/autogen/user/weechat_options.txt +++ b/doc/en/autogen/user/weechat_options.txt @@ -328,6 +328,11 @@ ** type: integer ** values: 0 .. 2147483647 (default value: `4096`) +* *weechat.history.max_minutes* +** description: `maximum number of minutes in history per buffer (0 = unlimited, examples: 1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)` +** type: integer +** values: 0 .. 2147483647 (default value: `0`) + * *weechat.history.max_visited_buffers* ** description: `maximum number of visited buffers to keep in memory` ** type: integer diff --git a/doc/fr/autogen/user/weechat_options.txt b/doc/fr/autogen/user/weechat_options.txt index 3be4bf6da..106dc7a37 100644 --- a/doc/fr/autogen/user/weechat_options.txt +++ b/doc/fr/autogen/user/weechat_options.txt @@ -324,10 +324,15 @@ ** valeurs: 0 .. 2147483647 (valeur par défaut: `100`) * *weechat.history.max_lines* -** description: `nombre maximum de lignes dans l'historique (0 = sans limite)` +** description: `nombre maximum de lignes dans l'historique par tampon (0 = sans limite)` ** type: entier ** valeurs: 0 .. 2147483647 (valeur par défaut: `4096`) +* *weechat.history.max_minutes* +** description: `nombre maximum de minutes dans l'historique par tampon (0 = sans limite, exemples: 1440 = une journée, 10080 = une semaine, 43200 = un mois, 525600 = une année)` +** type: entier +** valeurs: 0 .. 2147483647 (valeur par défaut: `0`) + * *weechat.history.max_visited_buffers* ** description: `nombre maximum de tampons visités à garder en mémoire` ** type: entier diff --git a/doc/it/autogen/user/weechat_options.txt b/doc/it/autogen/user/weechat_options.txt index bb1b41f9f..ac27669a2 100644 --- a/doc/it/autogen/user/weechat_options.txt +++ b/doc/it/autogen/user/weechat_options.txt @@ -328,6 +328,11 @@ ** tipo: intero ** valori: 0 .. 2147483647 (valore predefinito: `4096`) +* *weechat.history.max_minutes* +** descrizione: `maximum number of minutes in history per buffer (0 = unlimited, examples: 1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)` +** tipo: intero +** valori: 0 .. 2147483647 (valore predefinito: `0`) + * *weechat.history.max_visited_buffers* ** descrizione: `numero massimo di buffer visitati da memorizzare` ** tipo: intero @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-31 10:03+0100\n" +"POT-Creation-Date: 2011-11-01 19:23+0100\n" "PO-Revision-Date: 2011-10-22 12:21+0200\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2842,6 +2842,12 @@ msgstr "zobrazit počet každého částečného doplnění v položce pole" msgid "maximum number of lines in history per buffer (0 = unlimited)" msgstr "maximální počet řádků v historii bufferu (0 = nekonečně)" +#, fuzzy +msgid "" +"maximum number of minutes in history per buffer (0 = unlimited, examples: " +"1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)" +msgstr "maximální počet řádků v historii bufferu (0 = nekonečně)" + msgid "maximum number of user commands in history (0 = unlimited)" msgstr "maximální počet uživatelských příkazů v historii (0 = nekonečně)" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-31 10:03+0100\n" +"POT-Creation-Date: 2011-11-01 19:23+0100\n" "PO-Revision-Date: 2011-10-27 11:56+0200\n" "Last-Translator: Nils Görs\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3105,6 +3105,14 @@ msgstr "" "maximale Anzahl an Zeilen im Verlaufsspeicher. Dies gilt pro Buffer (0: " "keine Zeilenbegrenzung)" +#, fuzzy +msgid "" +"maximum number of minutes in history per buffer (0 = unlimited, examples: " +"1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)" +msgstr "" +"maximale Anzahl an Zeilen im Verlaufsspeicher. Dies gilt pro Buffer (0: " +"keine Zeilenbegrenzung)" + msgid "maximum number of user commands in history (0 = unlimited)" msgstr "maximale Anzahl an Befehlen im Verlauf (0: kein Begrenzung)" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-31 10:03+0100\n" +"POT-Creation-Date: 2011-11-01 19:23+0100\n" "PO-Revision-Date: 2011-10-27 11:56+0200\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3001,6 +3001,12 @@ msgstr "mostrar contador para cada completado parcial en la barra" msgid "maximum number of lines in history per buffer (0 = unlimited)" msgstr "número máximo de líneas para cada buffer (0 = ilimitado)" +#, fuzzy +msgid "" +"maximum number of minutes in history per buffer (0 = unlimited, examples: " +"1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)" +msgstr "número máximo de líneas para cada buffer (0 = ilimitado)" + msgid "maximum number of user commands in history (0 = unlimited)" msgstr "número máximo de comandos en el historial (0 = ilimitado)" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-31 10:03+0100\n" -"PO-Revision-Date: 2011-10-31 10:03+0100\n" +"POT-Creation-Date: 2011-11-01 19:23+0100\n" +"PO-Revision-Date: 2011-11-01 08:47+0100\n" "Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: French\n" @@ -3016,7 +3016,16 @@ msgstr "" "afficher le compteur pour chaque complétion partielle dans l'objet de barre" msgid "maximum number of lines in history per buffer (0 = unlimited)" -msgstr "nombre maximum de lignes dans l'historique (0 = sans limite)" +msgstr "" +"nombre maximum de lignes dans l'historique par tampon (0 = sans limite)" + +msgid "" +"maximum number of minutes in history per buffer (0 = unlimited, examples: " +"1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)" +msgstr "" +"nombre maximum de minutes dans l'historique par tampon (0 = sans limite, " +"exemples: 1440 = une journée, 10080 = une semaine, 43200 = un mois, 525600 = " +"une année)" msgid "maximum number of user commands in history (0 = unlimited)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-31 10:03+0100\n" +"POT-Creation-Date: 2011-11-01 19:23+0100\n" "PO-Revision-Date: 2011-10-22 12:21+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2506,6 +2506,13 @@ msgid "maximum number of lines in history per buffer (0 = unlimited)" msgstr "" "felhasználói parancsok maximális száma az előzményekben (0 = korlátlan)" +#, fuzzy +msgid "" +"maximum number of minutes in history per buffer (0 = unlimited, examples: " +"1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)" +msgstr "" +"felhasználói parancsok maximális száma az előzményekben (0 = korlátlan)" + msgid "maximum number of user commands in history (0 = unlimited)" msgstr "" "felhasználói parancsok maximális száma az előzményekben (0 = korlátlan)" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-31 10:03+0100\n" +"POT-Creation-Date: 2011-11-01 19:23+0100\n" "PO-Revision-Date: 2011-10-27 11:56+0200\n" "Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2997,6 +2997,13 @@ msgid "maximum number of lines in history per buffer (0 = unlimited)" msgstr "" "numero massimo di righe nella cronologia per buffer (0 = nessun limite)" +#, fuzzy +msgid "" +"maximum number of minutes in history per buffer (0 = unlimited, examples: " +"1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)" +msgstr "" +"numero massimo di righe nella cronologia per buffer (0 = nessun limite)" + msgid "maximum number of user commands in history (0 = unlimited)" msgstr "numero massimo di comandi utente nella cronologia (0 = nessun limite)" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-31 10:03+0100\n" +"POT-Creation-Date: 2011-11-01 19:23+0100\n" "PO-Revision-Date: 2011-10-27 11:56+0200\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2991,6 +2991,12 @@ msgstr "wyświetlaj ilość wszystkich częściowych dopełnień w elemencie pas msgid "maximum number of lines in history per buffer (0 = unlimited)" msgstr "maksymalna ilość linii w historii każdego bufora (0 = bez ograniczeń)" +#, fuzzy +msgid "" +"maximum number of minutes in history per buffer (0 = unlimited, examples: " +"1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)" +msgstr "maksymalna ilość linii w historii każdego bufora (0 = bez ograniczeń)" + msgid "maximum number of user commands in history (0 = unlimited)" msgstr "maksymalna ilość komend użytkownika w historii (0 = bez ograniczeń)" diff --git a/po/pt_BR.po b/po/pt_BR.po index df34f743f..efcf52095 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-31 10:03+0100\n" +"POT-Creation-Date: 2011-11-01 19:23+0100\n" "PO-Revision-Date: 2011-10-26 19:30+0200\n" "Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2954,6 +2954,12 @@ msgstr "mostra contagem para cada completação parcial em um item de barra" msgid "maximum number of lines in history per buffer (0 = unlimited)" msgstr "número máximo de linhas no histórico por buffer (0 = ilimitado)" +#, fuzzy +msgid "" +"maximum number of minutes in history per buffer (0 = unlimited, examples: " +"1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)" +msgstr "número máximo de linhas no histórico por buffer (0 = ilimitado)" + msgid "maximum number of user commands in history (0 = unlimited)" msgstr "número máximo de comandos de usuário no histórico (0 = ilimitado)" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-31 10:03+0100\n" +"POT-Creation-Date: 2011-11-01 19:23+0100\n" "PO-Revision-Date: 2011-10-22 12:21+0200\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2523,6 +2523,12 @@ msgstr "" msgid "maximum number of lines in history per buffer (0 = unlimited)" msgstr "максимальное количество команд в истории (0 = не ограничено)" +#, fuzzy +msgid "" +"maximum number of minutes in history per buffer (0 = unlimited, examples: " +"1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)" +msgstr "максимальное количество команд в истории (0 = не ограничено)" + msgid "maximum number of user commands in history (0 = unlimited)" msgstr "максимальное количество команд в истории (0 = не ограничено)" diff --git a/po/weechat.pot b/po/weechat.pot index df8193870..552025f90 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-31 10:03+0100\n" +"POT-Creation-Date: 2011-11-01 19:23+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -2189,6 +2189,11 @@ msgstr "" msgid "maximum number of lines in history per buffer (0 = unlimited)" msgstr "" +msgid "" +"maximum number of minutes in history per buffer (0 = unlimited, examples: " +"1440 = one day, 10080 = one week, 43200 = one month, 525600 = one year)" +msgstr "" + msgid "maximum number of user commands in history (0 = unlimited)" msgstr "" diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 147ee728d..863b2942e 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -216,6 +216,7 @@ struct t_config_option *config_completion_partial_completion_count; /* config, history section */ struct t_config_option *config_history_max_lines; +struct t_config_option *config_history_max_minutes; struct t_config_option *config_history_max_commands; struct t_config_option *config_history_max_visited_buffers; struct t_config_option *config_history_display_default; @@ -2500,6 +2501,13 @@ config_weechat_init_options () N_("maximum number of lines in history per buffer " "(0 = unlimited)"), NULL, 0, INT_MAX, "4096", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + config_history_max_minutes = config_file_new_option ( + weechat_config_file, ptr_section, + "max_minutes", "integer", + N_("maximum number of minutes in history per buffer " + "(0 = unlimited, examples: 1440 = one day, 10080 = one week, " + "43200 = one month, 525600 = one year)"), + NULL, 0, INT_MAX, "0", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_history_max_commands = config_file_new_option ( weechat_config_file, ptr_section, "max_commands", "integer", diff --git a/src/core/wee-config.h b/src/core/wee-config.h index 85245c638..ba87792cb 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -234,6 +234,7 @@ extern struct t_config_option *config_completion_partial_completion_other; extern struct t_config_option *config_completion_partial_completion_count; extern struct t_config_option *config_history_max_lines; +extern struct t_config_option *config_history_max_minutes; extern struct t_config_option *config_history_max_commands; extern struct t_config_option *config_history_max_visited_buffers; extern struct t_config_option *config_history_display_default; diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c index 20df53b53..00f5c2699 100644 --- a/src/gui/gui-line.c +++ b/src/gui/gui-line.c @@ -28,6 +28,7 @@ #include <stdlib.h> #include <stddef.h> #include <string.h> +#include <time.h> #include "../core/weechat.h" #include "../core/wee-config.h" @@ -794,8 +795,28 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date, struct t_gui_window *ptr_win; char *message_for_signal, buffer_full_name[512]; const char *nick; - int notify_level, *max_notify_level; + int notify_level, *max_notify_level, lines_removed; + time_t current_time; + /* + * remove line(s) if necessary, according to history options: + * max_lines: if > 0, keep only N lines in buffer + * max_minutes: if > 0, keep only lines from last N minutes + */ + lines_removed = 0; + current_time = time (NULL); + while (buffer->own_lines->first_line + && (((CONFIG_INTEGER(config_history_max_lines) > 0) + && (buffer->own_lines->lines_count + 1 > CONFIG_INTEGER(config_history_max_lines))) + || ((CONFIG_INTEGER(config_history_max_minutes) > 0) + && (current_time - buffer->own_lines->first_line->data->date_printed > + CONFIG_INTEGER(config_history_max_minutes) * 60)))) + { + gui_line_free (buffer, buffer->own_lines->first_line); + lines_removed++; + } + + /* create new line */ new_line = malloc (sizeof (*new_line)); if (!new_line) { @@ -803,6 +824,7 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date, return NULL; } + /* create data for line */ new_line_data = malloc (sizeof (*(new_line->data))); if (!new_line_data) { @@ -914,11 +936,13 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date, gui_line_mixed_add (buffer->mixed_lines, new_line->data); } - /* remove one line if necessary */ - if ((CONFIG_INTEGER(config_history_max_lines) > 0) - && (buffer->own_lines->lines_count > CONFIG_INTEGER(config_history_max_lines))) + /* + * if some lines were removed, force a full refresh if at least one window + * is displaying buffer and that number of lines in buffer is lower than + * window height + */ + if (lines_removed > 0) { - gui_line_free (buffer, buffer->own_lines->first_line); for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) { if ((ptr_win->buffer == buffer) |