core: add buffer property "clear"

v2.8-utf8proc
Sebastien Helleu 2014-03-25 10:55:12 +01:00
parent 8deb0d3612
commit 92ec36eced
7 changed files with 96 additions and 19 deletions

View File

@ -10268,6 +10268,9 @@ Arguments:
0 if buffer is merged and not selected
** 'print_hooks_enabled': 1 if print hooks are enabled, otherwise 0
** 'day_change': 1 if messages for the day change are displayed, otherwise 0
_(WeeChat ≥ 0.4.3)_
** 'clear': 1 if buffer can be cleared with command `/buffer clear`, otherwise 0
_(WeeChat ≥ 0.4.4)_
** 'lines_hidden': 1 if at least one line is hidden on buffer (filtered), or 0
if all lines are displayed
** 'prefix_max_length': max length for prefix in this buffer
@ -10476,7 +10479,8 @@ Properties:
| type | "formatted" or "free" |
Set type for buffer: "formatted" (for printing chat messages), or "free" (for
free content)
free content); when the value is "free", the property 'clear' is forced to "0"
_(WeeChat ≥ 0.4.4)_
| notify | "0", "1", "2", "3" |
Set notify level for buffer: "0" = never add to hotlist, "1" = add for
@ -10486,10 +10490,18 @@ Properties:
| print_hooks_enabled | "0" or "1" |
"0" to disable print hooks, "1" to enable them (default for a new buffer)
| day_change | "0" or "1" |
| day_change +
_(WeeChat ≥ 0.4.3)_ | "0" or "1" |
"0" to hide messages for the day change, "1" to see them
(default for a new buffer)
| clear +
_(WeeChat ≥ 0.4.4)_ | "0" or "1" |
"0" to prevent user from clearing buffer with the command `/buffer clear`,
"1" to let user clear the buffer (default for a new buffer)
(note: even when it is set to "0", the buffer can still be cleared with
the function <<_weechat_buffer_clear,weechat_buffer_clear>>)
| title | any string |
Set new title for buffer

View File

@ -10464,6 +10464,9 @@ Paramètres :
actif, 0 si le tampon est mélangé et n'est pas sélectionné
** 'print_hooks_enabled' : 1 si les hooks "print" sont activés, sinon 0
** 'day_change' : 1 si les messages de changement de jour sont affichés, sinon 0
_(WeeChat ≥ 0.4.3)_
** 'clear' : 1 si le tampon peut être effacé avec la commande `/buffer clear`,
sinon 0 _(WeeChat ≥ 0.4.4)_
** 'lines_hidden' : 1 si au moins une ligne est cachée dans le tampon
(filtrée), ou 0 si toutes les lignes sont affichées
** 'prefix_max_length' : longueur maximale du préfixe dans ce tampon
@ -10679,7 +10682,8 @@ Propriétés :
| type | "formatted" ou "free" |
Définit le type de tampon : "formatted" (pour afficher les messages d'une
discussion), ou "free" (pour du contenu libre)
discussion), ou "free" (pour du contenu libre); lorsque la valeur est "free",
la propriété 'clear' est forcée à "0" _(WeeChat ≥ 0.4.4)_
| notify | "0", "1", "2", "3" |
Définit le niveau de notification du tampon : "0" = ne jamais ajouter à la
@ -10690,10 +10694,19 @@ Propriétés :
"0" pour désactiver les hooks "print", "1" pour les activer
(par défaut pour un nouveau tampon)
| day_change | "0" ou "1" |
| day_change +
_(WeeChat ≥ 0.4.3)_ | "0" ou "1" |
"0" pour cacher les messages de changement de jour, "1" pour les voir
(par défaut pour un nouveau tampon)
| clear +
_(WeeChat ≥ 0.4.4)_ | "0" ou "1" |
"0" pour empêcher l'utilisateur d'effacer le tampon avec la commande
`/buffer clear`, "1" pour autoriser l'utilisateur à effacer le tampon (par
défaut pour un nouveau tampon) (note : même lorsque la valeur est "0", le
tampon peut toujours être effacé avec la fonction
<<_weechat_buffer_clear,weechat_buffer_clear>>)
| title | toute chaîne |
Change le titre du tampon

View File

@ -10530,6 +10530,10 @@ Argomenti:
altrimenti 0
// TRANSLATION MISSING
** 'day_change': 1 if messages for the day change are displayed, otherwise 0
_(WeeChat ≥ 0.4.3)_
// TRANSLATION MISSING
** 'clear': 1 if buffer can be cleared with command `/buffer clear`, otherwise 0
_(WeeChat ≥ 0.4.4)_
** 'lines_hidden': 1 se almeno una riga è nascosta sul buffer (filtrata),
oppure 0 se vengono visualizzate tutte le righe
** 'prefix_max_length': lunghezza massima del prefisso in questo buffer
@ -10750,9 +10754,11 @@ Properties:
| short_name | qualsiasi stringa |
Imposta nuovo nome breve per il buffer
// TRANSLATION MISSING
| type | "formatted" oppure "free" |
Imposta tipo per il: "formatted" (per stampare i messaggi di chat),
oppure "free" (per contenuto libero)
oppure "free" (per contenuto libero); when the value is "free", the property
'clear' is forced to "0" _(WeeChat ≥ 0.4.4)_
| notify | "0", "1", "2", "3" |
Imposta il livello di notifica per il buffer: "0" = non aggiungere alla hotlist,
@ -10764,10 +10770,19 @@ Properties:
"0" to disable print hooks, "1" to enable them (default for a new buffer)
// TRANSLATION MISSING
| day_change | "0" oppure "1" |
| day_change +
_(WeeChat ≥ 0.4.3)_ | "0" oppure "1" |
"0" to hide messages for the day change, "1" to see them
(default for a new buffer)
// TRANSLATION MISSING
| clear +
_(WeeChat ≥ 0.4.4)_ | "0" or "1" |
"0" to prevent user from clearing buffer with the command `/buffer clear`,
"1" to let user clear the buffer (default for a new buffer)
(note: even when it is set to "0", the buffer can still be cleared with
the function <<_weechat_buffer_clear,weechat_buffer_clear>>)
| title | qualsiasi stringa |
Imposta nuovo titolo per il buffer

View File

@ -10259,7 +10259,12 @@ int weechat_buffer_get_integer (struct t_gui_buffer *buffer,
** 'active': バッファがマージされて選択されている場合は 2、バッファが選択されている場合は
1、バッファがマージされ選択されていない場合は 0
** 'print_hooks_enabled': プリントフックが有効化されている場合は 1、そうでない場合は 0
// TRANSLATION MISSING
** 'day_change': 日付変更メッセージを表示する場合は 1、そうでない場合は 0
_(WeeChat ≥ 0.4.3)_
// TRANSLATION MISSING
** 'clear': 1 if buffer can be cleared with command `/buffer clear`, otherwise 0
_(WeeChat ≥ 0.4.4)_
** 'lines_hidden': バッファに非表示 (フィルタされた) メッセージが 1
行以上含まれる場合は 1、すべてのメッセージが表示冴えている場合は 0
** 'prefix_max_length': バッファプレフィックスの最大長
@ -10466,9 +10471,11 @@ void weechat_buffer_set (struct t_gui_buffer *buffer, const char *property,
| short_name | 任意の文字列 |
指定したバッファの新しい短縮名を設定
// TRANSLATION MISSING
| type | "formatted" または "free" |
バッファのタイプを設定: "formatted" (チャットメッセージ用)、または
"free" (自由内容用)
"free" (自由内容用); when the value is "free", the property 'clear' is forced
to "0" _(WeeChat ≥ 0.4.4)_
| notify | "0", "1", "2", "3" |
バッファの通知レベルを設定: "0" = ホットリストに追加しない、"1" =
@ -10478,10 +10485,20 @@ void weechat_buffer_set (struct t_gui_buffer *buffer, const char *property,
| print_hooks_enabled | "0" or "1" |
プリントフックを無効化する場合は "0"、有効化する場合は "1" (新規バッファに対するデフォルト)
| day_change | "0" または "1" |
// TRANSLATION MISSING
| day_change +
_(WeeChat ≥ 0.4.3)_ | "0" または "1" |
日付変更メッセージを隠す場合は "0"、表示する場合は
"1" (新規バッファに対するデフォルト)
// TRANSLATION MISSING
| clear +
_(WeeChat ≥ 0.4.4)_ | "0" or "1" |
"0" to prevent user from clearing buffer with the command `/buffer clear`,
"1" to let user clear the buffer (default for a new buffer)
(note: even when it is set to "0", the buffer can still be cleared with
the function <<_weechat_buffer_clear,weechat_buffer_clear>>)
| title | 任意の文字列 |
指定したバッファの新しいタイトルを設定

View File

@ -598,7 +598,7 @@ COMMAND_CALLBACK(buffer)
ptr_buffer2 = ptr_buffer2->next_buffer)
{
if ((ptr_buffer2->number == ptr_buffer->number)
&& (ptr_buffer2->type == GUI_BUFFER_TYPE_FORMATTED))
&& ptr_buffer2->clear)
{
gui_buffer_clear (ptr_buffer2);
}
@ -609,7 +609,7 @@ COMMAND_CALLBACK(buffer)
}
else
{
if (buffer->type == GUI_BUFFER_TYPE_FORMATTED)
if (buffer->clear)
gui_buffer_clear (buffer);
}

View File

@ -76,7 +76,7 @@ char *gui_buffer_notify_string[GUI_BUFFER_NUM_NOTIFY] =
char *gui_buffer_properties_get_integer[] =
{ "number", "layout_number", "layout_number_merge_order", "type", "notify",
"num_displayed", "active", "print_hooks_enabled", "day_change",
"num_displayed", "active", "print_hooks_enabled", "day_change", "clear",
"lines_hidden", "prefix_max_length", "time_for_each_line", "nicklist",
"nicklist_case_sensitive", "nicklist_max_length", "nicklist_display_groups",
"nicklist_count", "nicklist_groups_count", "nicklist_nicks_count",
@ -97,13 +97,14 @@ char *gui_buffer_properties_get_pointer[] =
NULL
};
char *gui_buffer_properties_set[] =
{ "unread", "display", "print_hooks_enabled", "day_change", "number", "name",
"short_name", "type", "notify", "title", "time_for_each_line", "nicklist",
"nicklist_case_sensitive", "nicklist_display_groups", "highlight_words",
"highlight_words_add", "highlight_words_del", "highlight_regex",
"highlight_tags_restrict", "highlight_tags", "hotlist_max_level_nicks",
"hotlist_max_level_nicks_add", "hotlist_max_level_nicks_del",
"input", "input_pos", "input_get_unknown_commands",
{ "unread", "display", "print_hooks_enabled", "day_change", "clear", "number",
"name", "short_name", "type", "notify", "title", "time_for_each_line",
"nicklist", "nicklist_case_sensitive", "nicklist_display_groups",
"highlight_words", "highlight_words_add", "highlight_words_del",
"highlight_regex", "highlight_tags_restrict", "highlight_tags",
"hotlist_max_level_nicks", "hotlist_max_level_nicks_add",
"hotlist_max_level_nicks_del", "input", "input_pos",
"input_get_unknown_commands",
NULL
};
@ -592,6 +593,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->active = 1;
new_buffer->print_hooks_enabled = 1;
new_buffer->day_change = 1;
new_buffer->clear = 1;
/* close callback */
new_buffer->close_callback = close_callback;
@ -980,6 +982,8 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property)
return buffer->print_hooks_enabled;
else if (string_strcasecmp (property, "day_change") == 0)
return buffer->day_change;
else if (string_strcasecmp (property, "clear") == 0)
return buffer->clear;
else if (string_strcasecmp (property, "lines_hidden") == 0)
return buffer->lines->lines_hidden;
else if (string_strcasecmp (property, "prefix_max_length") == 0)
@ -1166,6 +1170,9 @@ gui_buffer_set_type (struct t_gui_buffer *buffer, enum t_gui_buffer_type type)
gui_line_free_all (buffer);
buffer->type = type;
if (type == GUI_BUFFER_TYPE_FREE)
buffer->clear = 0;
gui_buffer_ask_chat_refresh (buffer, 2);
(void) hook_signal_send ("buffer_type_changed",
@ -1751,6 +1758,13 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
gui_buffer_ask_chat_refresh (buffer, 2);
}
}
else if (string_strcasecmp (property, "clear") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
buffer->clear = (number) ? 1 : 0;
}
else if (string_strcasecmp (property, "number") == 0)
{
error = NULL;
@ -2442,7 +2456,7 @@ gui_buffer_clear_all ()
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
if (ptr_buffer->type == GUI_BUFFER_TYPE_FORMATTED)
if (ptr_buffer->clear)
gui_buffer_clear (ptr_buffer);
}
}
@ -3809,6 +3823,7 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
HDATA_VAR(struct t_gui_buffer, active, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, print_hooks_enabled, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, day_change, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, clear, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, close_callback, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, close_callback_data, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, title, STRING, 0, NULL, NULL);
@ -3985,6 +4000,8 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_integer (ptr_item, "day_change", buffer->day_change))
return 0;
if (!infolist_new_var_integer (ptr_item, "clear", buffer->clear))
return 0;
if (!infolist_new_var_integer (ptr_item, "first_line_not_read", buffer->lines->first_line_not_read))
return 0;
if (!infolist_new_var_integer (ptr_item, "lines_hidden", buffer->lines->lines_hidden))
@ -4191,6 +4208,7 @@ gui_buffer_print_log ()
log_printf (" active. . . . . . . . . : %d", ptr_buffer->active);
log_printf (" print_hooks_enabled . . : %d", ptr_buffer->print_hooks_enabled);
log_printf (" day_change. . . . . . . : %d", ptr_buffer->day_change);
log_printf (" clear . . . . . . . . . : %d", ptr_buffer->clear);
log_printf (" close_callback. . . . . : 0x%lx", ptr_buffer->close_callback);
log_printf (" close_callback_data . . : 0x%lx", ptr_buffer->close_callback_data);
log_printf (" title . . . . . . . . . : '%s'", ptr_buffer->title);

View File

@ -98,6 +98,8 @@ struct t_gui_buffer
/* 2 = the only active (merged) */
int print_hooks_enabled; /* 1 if print hooks are enabled */
int day_change; /* 1 if "day change" displayed */
int clear; /* 1 if clear of buffer is allowed */
/* with command /buffer clear */
/* close callback */
int (*close_callback)(void *data, /* called when buffer is closed */