mirror of
https://github.com/weechat/weechat.git
synced 2026-06-25 04:16:38 +02:00
core: add buffer property "modes"
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ For a list of important changes that require manual actions, please look at rele
|
||||
|
||||
New features::
|
||||
|
||||
* core: add buffer property "input_prompt"
|
||||
* core: add buffer properties "input_prompt" and "modes"
|
||||
* core: send signal "buffer_line_added" on buffers with free content
|
||||
* core: add support of XDG "state" directory (issue #2106, issue #1747)
|
||||
* core: use nick offline color for nick in action message
|
||||
|
||||
@@ -12146,6 +12146,10 @@ List of signals sent by WeeChat and plugins:
|
||||
| Pointer: buffer.
|
||||
| Title of buffer changed.
|
||||
|
||||
| weechat | [[hook_signal_buffer_modes_changed]] buffer_modes_changed | 4.3.0
|
||||
| Pointer: buffer.
|
||||
| Modes of buffer changed.
|
||||
|
||||
| weechat | [[hook_signal_buffer_type_changed]] buffer_type_changed |
|
||||
| Pointer: buffer.
|
||||
| Type of buffer changed.
|
||||
@@ -14707,6 +14711,7 @@ Arguments:
|
||||
** _short_name_: short name of buffer (note: used for display only and can be changed by user, this must not be used to find name of buffer, use instead _name_, _full_name_ or local variable _channel_)
|
||||
** _type_: type of buffer: "formatted" or "free" _(WeeChat ≥ 4.2.0)_
|
||||
** _title_: title of buffer
|
||||
** _modes_: modes _(WeeChat ≥ 4.3.0)_
|
||||
** _nicklist_last_id_assigned_: last unique identifier used in this buffer for a group or nick _(WeeChat ≥ 4.3.0)_
|
||||
** _input_prompt_: input prompt _(WeeChat ≥ 4.3.0)_
|
||||
** _input_: input text
|
||||
@@ -14883,6 +14888,9 @@ Properties:
|
||||
| title | | any string
|
||||
| Set new title for buffer.
|
||||
|
||||
| modes | 4.3.0 | any string
|
||||
| Set new modes for buffer.
|
||||
|
||||
| time_for_each_line | | "0" or "1"
|
||||
| "0" to hide time for all lines in buffer, "1" to see time for all lines
|
||||
(default for a new buffer).
|
||||
|
||||
@@ -12397,6 +12397,10 @@ Liste des signaux envoyés par WeeChat et les extensions :
|
||||
| Pointeur : tampon.
|
||||
| Titre du tampon changé.
|
||||
|
||||
| weechat | [[hook_signal_buffer_modes_changed]] buffer_modes_changed | 4.3.0
|
||||
| Pointeur : tampon.
|
||||
| Modes du tampon changés.
|
||||
|
||||
| weechat | [[hook_signal_buffer_type_changed]] buffer_type_changed |
|
||||
| Pointeur : tampon.
|
||||
| Type de tampon changé.
|
||||
@@ -15024,6 +15028,7 @@ Paramètres :
|
||||
** _short_name_ : nom court du tampon (note : utilisé pour l'affichage seulement et peut être changé par l'utilisateur, il ne doit pas être utilisé pour trouver le nom du tampon, utilisez à la place _name_, _full_name_ ou bien la variable locale _channel_)
|
||||
** _type_ : type de tampon : "formatted" (formaté) ou "free" (contenu libre) _(WeeChat ≥ 4.2.0)_
|
||||
** _title_ : titre du tampon
|
||||
** _modes_ : modes _(WeeChat ≥ 4.3.0)_
|
||||
** _nicklist_last_id_assigned_ : dernier identifiant unique utilisé dans ce tampon pour un groupe ou un pseudo _(WeeChat ≥ 4.3.0)_
|
||||
** _input_prompt_ : invite de la zone saisie _(WeeChat ≥ 4.3.0)_
|
||||
** _input_ : texte saisi
|
||||
@@ -15204,6 +15209,9 @@ Propriétés :
|
||||
| title | | toute chaîne
|
||||
| Change le titre du tampon.
|
||||
|
||||
| modes | 4.3.0 | toue chaîne
|
||||
| Change les modes du tampon.
|
||||
|
||||
| time_for_each_line | | "0" ou "1"
|
||||
| "0" pour cacher l'heure sur toutes les lignes du tampon, "1" pour afficher
|
||||
l'heure sur toutes les lignes (par défaut pour un nouveau tampon).
|
||||
|
||||
@@ -12647,6 +12647,11 @@ List of signals sent by WeeChat and plugins:
|
||||
| Puntatore: buffer.
|
||||
| Titolo del buffer modificato.
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| weechat | [[hook_signal_buffer_modes_changed]] buffer_modes_changed | 4.3.0
|
||||
| Pointer: buffer.
|
||||
| Modes of buffer changed.
|
||||
|
||||
| weechat | [[hook_signal_buffer_type_changed]] buffer_type_changed |
|
||||
| Puntatore: buffer.
|
||||
| Tipo di buffer modificato.
|
||||
@@ -15408,6 +15413,8 @@ Argomenti:
|
||||
** _type_: type of buffer: "formatted" or "free" _(WeeChat ≥ 4.2.0)_
|
||||
** _title_: titolo del buffer
|
||||
// TRANSLATION MISSING
|
||||
** _modes_: modes _(WeeChat ≥ 4.3.0)_
|
||||
// TRANSLATION MISSING
|
||||
** _nicklist_last_id_assigned_: last unique identifier used in this buffer for a group or nick _(WeeChat ≥ 4.3.0)_
|
||||
// TRANSLATION MISSING
|
||||
** _input_prompt_: input prompt _(WeeChat ≥ 4.3.0)_
|
||||
@@ -15608,6 +15615,10 @@ Properties:
|
||||
| title | | qualsiasi stringa
|
||||
| Imposta nuovo titolo per il buffer.
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| modes | 4.3.0 | any string
|
||||
| Set new modes for buffer.
|
||||
|
||||
| time_for_each_line | | "0" oppure "1"
|
||||
| "0" per nascondere l'orario in tutte le righe del buffer, "1" per
|
||||
visualizzarlo su tutte le righe (predefinito per un nuovo buffer).
|
||||
|
||||
@@ -12308,6 +12308,11 @@ WeeChat とプラグインが送信するシグナルのリスト:
|
||||
| Pointer: バッファ
|
||||
| バッファのタイトルを変更
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| weechat | [[hook_signal_buffer_modes_changed]] buffer_modes_changed | 4.3.0
|
||||
| Pointer: buffer.
|
||||
| Modes of buffer changed.
|
||||
|
||||
| weechat | [[hook_signal_buffer_type_changed]] buffer_type_changed |
|
||||
| Pointer: バッファ
|
||||
| バッファのタイプを変更
|
||||
@@ -14943,6 +14948,8 @@ const char *weechat_buffer_get_string (struct t_gui_buffer *buffer,
|
||||
** _type_: type of buffer: "formatted" or "free" _(WeeChat ≥ 4.2.0)_
|
||||
** _title_: バッファのタイトル
|
||||
// TRANSLATION MISSING
|
||||
** _modes_: modes _(WeeChat ≥ 4.3.0)_
|
||||
// TRANSLATION MISSING
|
||||
** _nicklist_last_id_assigned_: last unique identifier used in this buffer for a group or nick _(WeeChat ≥ 4.3.0)_
|
||||
// TRANSLATION MISSING
|
||||
** _input_prompt_: input prompt _(WeeChat ≥ 4.3.0)_
|
||||
@@ -15126,6 +15133,10 @@ void weechat_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
| title | | 任意の文字列
|
||||
| 指定したバッファの新しいタイトルを設定
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| modes | 4.3.0 | any string
|
||||
| Set new modes for buffer.
|
||||
|
||||
| time_for_each_line | | "0" または "1"
|
||||
| バッファのすべての行に時間を表示しない場合は "0"、表示する場合は
|
||||
"1" (新規バッファに対するデフォルト)
|
||||
|
||||
@@ -11821,6 +11821,11 @@ struct t_hook *weechat_hook_signal (const char *signal,
|
||||
| Показивач: бафер.
|
||||
| Промењен је наслов бафера.
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| weechat | [[hook_signal_buffer_modes_changed]] buffer_modes_changed | 4.3.0
|
||||
| Pointer: buffer.
|
||||
| Modes of buffer changed.
|
||||
|
||||
| weechat | [[hook_signal_buffer_type_changed]] buffer_type_changed |
|
||||
| Показивач: бафер.
|
||||
| Промењен је тип бафера.
|
||||
@@ -14285,6 +14290,8 @@ const char *weechat_buffer_get_string (struct t_gui_buffer *buffer,
|
||||
** _short_name_: кратко име бафера (напомена: користи се само за приказ и корисник може да га промени, ово не сме да се употребљава за проналажење имена бафера, уместо њега употребите _name_, _full_name_ или локалну променљиву _channel_)
|
||||
** _type_: тип бафера: „formatted” или „free” _(WeeChat ≥ 4.2.0)_
|
||||
** _title_: наслов бафера
|
||||
// TRANSLATION MISSING
|
||||
** _modes_: modes _(WeeChat ≥ 4.3.0)_
|
||||
** _nicklist_last_id_assigned_: последњи јединствени идентификатор употребљен у овом баферу за групу или надимак _(WeeChat ≥ 4.3.0)_
|
||||
// TRANSLATION MISSING
|
||||
** _input_prompt_: input prompt _(WeeChat ≥ 4.3.0)_
|
||||
@@ -14462,6 +14469,10 @@ void weechat_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
| title | | било који стринг
|
||||
| Поставља нови наслов бафера.
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| modes | 4.3.0 | any string
|
||||
| Set new modes for buffer.
|
||||
|
||||
| time_for_each_line | | "0" или "1"
|
||||
| "0" да се скрива време у свим линијама бафера, "1" да се приказује у свим
|
||||
линијама (подразумевано за нови бафер).
|
||||
|
||||
@@ -523,6 +523,9 @@ upgrade_weechat_read_buffer (struct t_infolist *infolist)
|
||||
ptr_buffer->title = (str) ? strdup (str) : NULL;
|
||||
}
|
||||
|
||||
/* modes */
|
||||
gui_buffer_set_modes (ptr_buffer, infolist_string (infolist, "modes"));
|
||||
|
||||
/* first line not read */
|
||||
ptr_buffer->lines->first_line_not_read =
|
||||
infolist_integer (infolist, "first_line_not_read");
|
||||
|
||||
@@ -1301,10 +1301,12 @@ gui_bar_item_buffer_modes_cb (const void *pointer, void *data,
|
||||
(void) data;
|
||||
(void) item;
|
||||
(void) window;
|
||||
(void) buffer;
|
||||
(void) extra_info;
|
||||
|
||||
return NULL;
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
|
||||
return (buffer->modes) ? strdup (buffer->modes) : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2387,7 +2389,7 @@ gui_bar_item_init ()
|
||||
gui_bar_item_new (NULL,
|
||||
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_MODES],
|
||||
&gui_bar_item_buffer_modes_cb, NULL, NULL);
|
||||
gui_bar_item_hook_signal ("window_switch;buffer_switch",
|
||||
gui_bar_item_hook_signal ("window_switch;buffer_switch;buffer_modes_changed",
|
||||
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_MODES]);
|
||||
|
||||
/* buffer filter */
|
||||
|
||||
+37
-4
@@ -110,9 +110,10 @@ char *gui_buffer_properties_get_integer[] =
|
||||
};
|
||||
char *gui_buffer_properties_get_string[] =
|
||||
{ "id", "plugin", "name", "full_name", "old_full_name", "short_name", "title",
|
||||
"nicklist_last_id_assigned", "input_prompt", "input", "text_search_input",
|
||||
"highlight_words", "highlight_disable_regex", "highlight_regex",
|
||||
"highlight_tags_restrict", "highlight_tags", "hotlist_max_level_nicks",
|
||||
"modes", "nicklist_last_id_assigned", "input_prompt", "input",
|
||||
"text_search_input", "highlight_words", "highlight_disable_regex",
|
||||
"highlight_regex", "highlight_tags_restrict", "highlight_tags",
|
||||
"hotlist_max_level_nicks",
|
||||
NULL
|
||||
};
|
||||
char *gui_buffer_properties_get_pointer[] =
|
||||
@@ -123,7 +124,7 @@ char *gui_buffer_properties_get_pointer[] =
|
||||
char *gui_buffer_properties_set[] =
|
||||
{ "hotlist", "unread", "display", "hidden", "print_hooks_enabled", "day_change",
|
||||
"clear", "filter", "number", "name", "short_name", "type", "notify", "title",
|
||||
"time_for_each_line", "nicklist", "nicklist_case_sensitive",
|
||||
"modes", "time_for_each_line", "nicklist", "nicklist_case_sensitive",
|
||||
"nicklist_display_groups", "highlight_words", "highlight_words_add",
|
||||
"highlight_words_del", "highlight_disable_regex", "highlight_regex",
|
||||
"highlight_tags_restrict", "highlight_tags", "hotlist_max_level_nicks",
|
||||
@@ -867,6 +868,9 @@ gui_buffer_new_props_with_id (long long id,
|
||||
/* title */
|
||||
new_buffer->title = NULL;
|
||||
|
||||
/* modes */
|
||||
new_buffer->modes = NULL;
|
||||
|
||||
/* chat content */
|
||||
new_buffer->own_lines = gui_line_lines_alloc ();
|
||||
new_buffer->mixed_lines = NULL;
|
||||
@@ -1538,6 +1542,8 @@ gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
|
||||
return gui_buffer_type_string[buffer->type];
|
||||
else if (strcmp (property, "title") == 0)
|
||||
return buffer->title;
|
||||
else if (strcmp (property, "modes") == 0)
|
||||
return buffer->modes;
|
||||
else if (strcmp (property, "nicklist_last_id_assigned") == 0)
|
||||
{
|
||||
snprintf (str_value, sizeof (str_value),
|
||||
@@ -1793,6 +1799,24 @@ gui_buffer_set_title (struct t_gui_buffer *buffer, const char *new_title)
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets modes for a buffer.
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_set_modes (struct t_gui_buffer *buffer, const char *modes)
|
||||
{
|
||||
if (!buffer || (string_strcmp (buffer->modes, modes) == 0))
|
||||
return;
|
||||
|
||||
free (buffer->modes);
|
||||
buffer->modes = (modes && modes[0]) ? strdup (modes) : NULL;
|
||||
|
||||
(void) gui_buffer_send_signal (buffer,
|
||||
"buffer_modes_changed",
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets flag "time for each line" for a buffer.
|
||||
*/
|
||||
@@ -2650,6 +2674,10 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
{
|
||||
gui_buffer_set_title (buffer, value);
|
||||
}
|
||||
else if (strcmp (property, "modes") == 0)
|
||||
{
|
||||
gui_buffer_set_modes (buffer, value);
|
||||
}
|
||||
else if (strcmp (property, "time_for_each_line") == 0)
|
||||
{
|
||||
error = NULL;
|
||||
@@ -3777,6 +3805,7 @@ gui_buffer_close (struct t_gui_buffer *buffer)
|
||||
free (buffer->old_full_name);
|
||||
free (buffer->short_name);
|
||||
free (buffer->title);
|
||||
free (buffer->modes);
|
||||
free (buffer->input_prompt);
|
||||
free (buffer->input_buffer);
|
||||
free (buffer->input_undo_snap);
|
||||
@@ -5202,6 +5231,7 @@ gui_buffer_hdata_buffer_cb (const void *pointer, void *data,
|
||||
HDATA_VAR(struct t_gui_buffer, close_callback_data, POINTER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, closing, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, title, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, modes, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, own_lines, POINTER, 0, NULL, "lines");
|
||||
HDATA_VAR(struct t_gui_buffer, mixed_lines, POINTER, 0, NULL, "lines");
|
||||
HDATA_VAR(struct t_gui_buffer, lines, POINTER, 0, NULL, "lines");
|
||||
@@ -5445,6 +5475,8 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist,
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "title", buffer->title))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "modes", buffer->modes))
|
||||
return 0;
|
||||
if (!infolist_new_var_integer (ptr_item, "input", buffer->input))
|
||||
return 0;
|
||||
if (!infolist_new_var_integer (ptr_item, "input_get_any_user_data", buffer->input_get_any_user_data))
|
||||
@@ -5659,6 +5691,7 @@ gui_buffer_print_log ()
|
||||
log_printf (" close_callback_data . . : %p", ptr_buffer->close_callback_data);
|
||||
log_printf (" closing . . . . . . . . : %d", ptr_buffer->closing);
|
||||
log_printf (" title . . . . . . . . . : '%s'", ptr_buffer->title);
|
||||
log_printf (" modes . . . . . . . . . : '%s'", ptr_buffer->modes);
|
||||
log_printf (" own_lines . . . . . . . : %p", ptr_buffer->own_lines);
|
||||
gui_lines_print_log (ptr_buffer->own_lines);
|
||||
log_printf (" mixed_lines . . . . . . : %p", ptr_buffer->mixed_lines);
|
||||
|
||||
@@ -146,6 +146,9 @@ struct t_gui_buffer
|
||||
/* buffer title */
|
||||
char *title; /* buffer title */
|
||||
|
||||
/* buffer modes */
|
||||
char *modes; /* buffer modes */
|
||||
|
||||
/* chat content */
|
||||
struct t_gui_lines *own_lines; /* lines (for this buffer only) */
|
||||
struct t_gui_lines *mixed_lines; /* mixed lines (if buffers merged) */
|
||||
@@ -373,6 +376,8 @@ extern void gui_buffer_ask_chat_refresh (struct t_gui_buffer *buffer,
|
||||
int refresh);
|
||||
extern void gui_buffer_set_title (struct t_gui_buffer *buffer,
|
||||
const char *new_title);
|
||||
extern void gui_buffer_set_modes (struct t_gui_buffer *buffer,
|
||||
const char *new_modes);
|
||||
extern void gui_buffer_set_highlight_words (struct t_gui_buffer *buffer,
|
||||
const char *new_highlight_words);
|
||||
extern void gui_buffer_set_highlight_disable_regex (struct t_gui_buffer *buffer,
|
||||
|
||||
@@ -552,6 +552,7 @@ TEST(GuiBuffer, NewProps)
|
||||
POINTERS_EQUAL(NULL, buffer->close_callback_data);
|
||||
LONGS_EQUAL(0, buffer->closing);
|
||||
POINTERS_EQUAL(NULL, buffer->title);
|
||||
POINTERS_EQUAL(NULL, buffer->modes);
|
||||
CHECK(buffer->own_lines);
|
||||
POINTERS_EQUAL(NULL, buffer->own_lines->first_line);
|
||||
POINTERS_EQUAL(NULL, buffer->own_lines->last_line);
|
||||
@@ -639,6 +640,7 @@ TEST(GuiBuffer, NewProps)
|
||||
gui_buffer_close (buffer);
|
||||
|
||||
hashtable_set (properties, "title", "the buffer title");
|
||||
hashtable_set (properties, "modes", "+nt");
|
||||
hashtable_set (properties, "short_name", "the_short_name");
|
||||
hashtable_set (properties, "localvar_set_test", "value");
|
||||
hashtable_set (properties, "key_bind_meta-y", "/test_y arg1 arg2");
|
||||
@@ -647,6 +649,7 @@ TEST(GuiBuffer, NewProps)
|
||||
&test_buffer_input_cb, NULL, NULL,
|
||||
&test_buffer_close_cb, NULL, NULL);
|
||||
STRCMP_EQUAL("the buffer title", buffer->title);
|
||||
STRCMP_EQUAL("+nt", buffer->modes);
|
||||
STRCMP_EQUAL("the_short_name", buffer->short_name);
|
||||
LONGS_EQUAL(3, buffer->local_variables->items_count);
|
||||
STRCMP_EQUAL("value",
|
||||
@@ -934,6 +937,7 @@ TEST(GuiBuffer, GetString)
|
||||
STRCMP_EQUAL("weechat", gui_buffer_get_string (gui_buffers, "short_name"));
|
||||
STRCMP_EQUAL("formatted", gui_buffer_get_string (gui_buffers, "type"));
|
||||
STRNCMP_EQUAL("WeeChat ", gui_buffer_get_string (gui_buffers, "title"), 8);
|
||||
POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "modes"));
|
||||
POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "input_prompt"));
|
||||
STRCMP_EQUAL("", gui_buffer_get_string (gui_buffers, "input"));
|
||||
POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "text_search_input"));
|
||||
@@ -1033,6 +1037,16 @@ TEST(GuiBuffer, SetTitle)
|
||||
/* TODO: write tests */
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* gui_buffer_set_modes
|
||||
*/
|
||||
|
||||
TEST(GuiBuffer, SetModes)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* gui_buffer_set_time_for_each_line
|
||||
|
||||
Reference in New Issue
Block a user