summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/en/weechat_plugin_api.en.txt1
-rw-r--r--doc/fr/weechat_plugin_api.fr.txt1
-rw-r--r--doc/it/weechat_plugin_api.it.txt2
-rw-r--r--src/gui/gui-buffer.c6
-rw-r--r--src/plugins/irc/irc-channel.c29
-rw-r--r--src/plugins/irc/irc-raw.c2
-rw-r--r--src/plugins/irc/irc-server.c31
-rw-r--r--src/plugins/relay/relay-raw.c2
-rw-r--r--src/plugins/xfer/xfer-chat.c2
9 files changed, 30 insertions, 46 deletions
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt
index a58d018be..49e984b71 100644
--- a/doc/en/weechat_plugin_api.en.txt
+++ b/doc/en/weechat_plugin_api.en.txt
@@ -8817,6 +8817,7 @@ Arguments:
** 'number': number of buffer (starts to 1)
** 'layout_number': number of buffer saved in layout
** 'layout_number_merge_order': order in merge for layout
+** 'short_name_is_set': 1 if short name is set, 0 if not set
** 'type': buffer type (0: formatted, 1: free content)
** 'notify': notify level for buffer
** 'num_displayed': number of windows displaying buffer
diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt
index 0d1c49ff5..5dc4dde70 100644
--- a/doc/fr/weechat_plugin_api.fr.txt
+++ b/doc/fr/weechat_plugin_api.fr.txt
@@ -8959,6 +8959,7 @@ Paramètres :
** 'number' : numéro du tampon (commence à 1)
** 'layout_number' : numéro du tampon sauvegardé dans le "layout"
** 'layout_number_merge_order' : ordre du tampon mélangé pour le "layout"
+** 'short_name_is_set': 1 si le nom court est défini, 0 si non défini
** 'type' : type de tampon (0 : formaté, 1 : contenu libre)
** 'notify' : niveau de notification du tampon
** 'num_displayed' : nombre de fenêtres affichant ce tampon
diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt
index 34a060cc4..7448fe3ff 100644
--- a/doc/it/weechat_plugin_api.it.txt
+++ b/doc/it/weechat_plugin_api.it.txt
@@ -8879,6 +8879,8 @@ Argomenti:
** 'layout_number': numero del buffer salvato nel layout
// TRANSLATION MISSING
** 'layout_number_merge_order': order in merge for layout
+// TRANSLATION MISSING
+** 'short_name_is_set': 1 if short name is set, 0 if not set
** 'type': tipo dibuffer (0: formattato, 1: contenuto libero)
** 'notify': livello di notifica per il buffer
** 'num_displayed': numero delle finestre che visualizzano il buffer
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 48d8dca89..0a34f5446 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -807,6 +807,8 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property)
return buffer->layout_number;
else if (string_strcasecmp (property, "layout_number_merge_order") == 0)
return buffer->layout_number_merge_order;
+ else if (string_strcasecmp (property, "short_name_is_set") == 0)
+ return (buffer->short_name) ? 1 : 0;
else if (string_strcasecmp (property, "type") == 0)
return buffer->type;
else if (string_strcasecmp (property, "notify") == 0)
@@ -874,7 +876,7 @@ gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
else if (string_strcasecmp (property, "name") == 0)
return buffer->name;
else if (string_strcasecmp (property, "short_name") == 0)
- return buffer->short_name;
+ return gui_buffer_get_short_name (buffer);
else if (string_strcasecmp (property, "title") == 0)
return buffer->title;
else if (string_strcasecmp (property, "input") == 0)
@@ -3211,7 +3213,7 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_string (ptr_item, "name", buffer->name))
return 0;
- if (!infolist_new_var_string (ptr_item, "short_name", buffer->short_name))
+ if (!infolist_new_var_string (ptr_item, "short_name", gui_buffer_get_short_name (buffer)))
return 0;
if (!infolist_new_var_integer (ptr_item, "type", buffer->type))
return 0;
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index 433141cf1..17e9c18f9 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -209,7 +209,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
if (buffer_created)
{
- if (!weechat_buffer_get_string (new_buffer, "short_name"))
+ if (!weechat_buffer_get_integer (new_buffer, "short_name_is_set"))
weechat_buffer_set (new_buffer, "short_name", channel_name);
weechat_buffer_set (new_buffer, "localvar_set_type",
(channel_type == IRC_CHANNEL_TYPE_CHANNEL) ? "channel" : "private");
@@ -918,7 +918,6 @@ irc_channel_add_to_infolist (struct t_infolist *infolist,
struct t_irc_channel_speaking *ptr_nick;
char option_name[64];
int i, index;
- const char *name, *short_name;
if (!infolist || !channel)
return 0;
@@ -929,24 +928,14 @@ irc_channel_add_to_infolist (struct t_infolist *infolist,
if (!weechat_infolist_new_var_pointer (ptr_item, "buffer", channel->buffer))
return 0;
- if (channel->buffer)
- {
- name = weechat_buffer_get_string (channel->buffer, "name");
- short_name = weechat_buffer_get_string (channel->buffer, "short_name");
- if (!short_name)
- short_name = name;
- if (!weechat_infolist_new_var_string (ptr_item, "buffer_name", name))
- return 0;
- if (!weechat_infolist_new_var_string (ptr_item, "buffer_short_name", short_name))
- return 0;
- }
- else
- {
- if (!weechat_infolist_new_var_string (ptr_item, "buffer_name", ""))
- return 0;
- if (!weechat_infolist_new_var_string (ptr_item, "buffer_short_name", ""))
- return 0;
- }
+ if (!weechat_infolist_new_var_string (ptr_item, "buffer_name",
+ (channel->buffer) ?
+ weechat_buffer_get_string (channel->buffer, "name") : ""))
+ return 0;
+ if (!weechat_infolist_new_var_string (ptr_item, "buffer_short_name",
+ (channel->buffer) ?
+ weechat_buffer_get_string (channel->buffer, "short_name") : ""))
+ return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "type", channel->type))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "name", channel->name))
diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c
index 3074979d3..051c85667 100644
--- a/src/plugins/irc/irc-raw.c
+++ b/src/plugins/irc/irc-raw.c
@@ -85,7 +85,7 @@ irc_raw_open (int switch_to_buffer)
weechat_buffer_set (irc_raw_buffer,
"title", _("IRC raw messages"));
- if (!weechat_buffer_get_string (irc_raw_buffer, "short_name"))
+ if (!weechat_buffer_get_integer (irc_raw_buffer, "short_name_is_set"))
{
weechat_buffer_set (irc_raw_buffer, "short_name",
IRC_RAW_BUFFER_NAME);
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 5a2b26237..fe1b0617f 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -1299,7 +1299,7 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name)
{
buffer_name = irc_buffer_build_name (server->name, NULL);
weechat_buffer_set (server->buffer, "name", buffer_name);
- if (!weechat_buffer_get_string (server->buffer, "short_name"))
+ if (!weechat_buffer_get_integer (server->buffer, "short_name_is_set"))
weechat_buffer_set (server->buffer, "short_name", server->name);
weechat_buffer_set (server->buffer, "localvar_set_server",
server->name);
@@ -2840,7 +2840,7 @@ irc_server_create_buffer (struct t_irc_server *server)
if (!server->buffer)
return NULL;
- if (!weechat_buffer_get_string (server->buffer, "short_name"))
+ if (!weechat_buffer_get_integer (server->buffer, "short_name_is_set"))
weechat_buffer_set (server->buffer, "short_name", server->name);
weechat_buffer_set (server->buffer, "localvar_set_type", "server");
weechat_buffer_set (server->buffer, "localvar_set_server", server->name);
@@ -4040,7 +4040,6 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
struct t_irc_server *server)
{
struct t_infolist_item *ptr_item;
- const char *name, *short_name;
if (!infolist || !server)
return 0;
@@ -4053,24 +4052,14 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_pointer (ptr_item, "buffer", server->buffer))
return 0;
- if (server->buffer)
- {
- name = weechat_buffer_get_string (server->buffer, "name");
- short_name = weechat_buffer_get_string (server->buffer, "short_name");
- if (!short_name)
- short_name = name;
- if (!weechat_infolist_new_var_string (ptr_item, "buffer_name", name))
- return 0;
- if (!weechat_infolist_new_var_string (ptr_item, "buffer_short_name", short_name))
- return 0;
- }
- else
- {
- if (!weechat_infolist_new_var_string (ptr_item, "buffer_name", ""))
- return 0;
- if (!weechat_infolist_new_var_string (ptr_item, "buffer_short_name", ""))
- return 0;
- }
+ if (!weechat_infolist_new_var_string (ptr_item, "buffer_name",
+ (server->buffer) ?
+ weechat_buffer_get_string (server->buffer, "name") : ""))
+ return 0;
+ if (!weechat_infolist_new_var_string (ptr_item, "buffer_short_name",
+ (server->buffer) ?
+ weechat_buffer_get_string (server->buffer, "short_name") : ""))
+ return 0;
if (!weechat_infolist_new_var_string (ptr_item, "addresses",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_ADDRESSES)))
return 0;
diff --git a/src/plugins/relay/relay-raw.c b/src/plugins/relay/relay-raw.c
index d2282c8ad..1557a0389 100644
--- a/src/plugins/relay/relay-raw.c
+++ b/src/plugins/relay/relay-raw.c
@@ -84,7 +84,7 @@ relay_raw_open (int switch_to_buffer)
weechat_buffer_set (relay_raw_buffer,
"title", _("Relay raw messages"));
- if (!weechat_buffer_get_string (relay_raw_buffer, "short_name"))
+ if (!weechat_buffer_get_integer (relay_raw_buffer, "short_name_is_set"))
{
weechat_buffer_set (relay_raw_buffer, "short_name",
RELAY_RAW_BUFFER_NAME);
diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c
index b1cf3b793..44c406595 100644
--- a/src/plugins/xfer/xfer-chat.c
+++ b/src/plugins/xfer/xfer-chat.c
@@ -333,7 +333,7 @@ xfer_chat_open_buffer (struct t_xfer *xfer)
if (buffer_created)
{
weechat_buffer_set (xfer->buffer, "title", _("xfer chat"));
- if (!weechat_buffer_get_string (xfer->buffer, "short_name"))
+ if (!weechat_buffer_get_integer (xfer->buffer, "short_name_is_set"))
{
weechat_buffer_set (xfer->buffer, "short_name",
xfer->remote_nick);