summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
6 files changed, 26 insertions, 46 deletions
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);