summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui-buffer.c7
-rw-r--r--src/plugins/irc/irc-channel.c8
-rw-r--r--src/plugins/irc/irc-channel.h3
-rw-r--r--src/plugins/irc/irc-command.c2
-rw-r--r--src/plugins/irc/irc-protocol.c8
-rw-r--r--src/plugins/irc/irc-server.c2
-rw-r--r--src/plugins/irc/irc-upgrade.c2
-rw-r--r--src/plugins/jabber/jabber-command.c2
-rw-r--r--src/plugins/jabber/jabber-muc.c7
-rw-r--r--src/plugins/jabber/jabber-muc.h3
-rw-r--r--src/plugins/jabber/jabber-server.c2
-rw-r--r--src/plugins/jabber/jabber-upgrade.c2
-rw-r--r--src/plugins/jabber/jabber-xmpp.c2
13 files changed, 32 insertions, 18 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 191fbb596..c701be677 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -818,7 +818,12 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
}
else if (string_strcasecmp (property, "display") == 0)
{
- gui_window_switch_to_buffer (gui_current_window, buffer, 0);
+ /* if it is auto-switch to a buffer, then we don't set read marker,
+ otherwise we reset it (if current buffer is not displayed) after
+ switch */
+ gui_window_switch_to_buffer (gui_current_window, buffer,
+ (string_strcasecmp (value, "auto") == 0) ?
+ 0 : 1);
}
else if (string_strcasecmp (property, "name") == 0)
{
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index c3fab2cd1..82477cbdb 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -67,7 +67,8 @@ irc_channel_valid (struct t_irc_server *server, struct t_irc_channel *channel)
struct t_irc_channel *
irc_channel_new (struct t_irc_server *server, int channel_type,
- const char *channel_name, int switch_to_channel)
+ const char *channel_name, int switch_to_channel,
+ int auto_switch)
{
struct t_irc_channel *new_channel;
struct t_gui_buffer *new_buffer;
@@ -167,7 +168,10 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
server->last_channel = new_channel;
if (switch_to_channel)
- weechat_buffer_set (new_buffer, "display", "1");
+ {
+ weechat_buffer_set (new_buffer, "display",
+ (auto_switch) ? "auto" : "1");
+ }
/* all is ok, return address of new channel */
return new_channel;
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index bd129f6fa..d1f08ff5a 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -73,7 +73,8 @@ extern int irc_channel_valid (struct t_irc_server *server,
extern struct t_irc_channel *irc_channel_new (struct t_irc_server *server,
int channel_type,
const char *channel_name,
- int switch_to_channel);
+ int switch_to_channel,
+ int auto_switch);
extern void irc_channel_set_topic (struct t_irc_channel *channel,
const char *topic);
extern void irc_channel_free (struct t_irc_server *server,
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index d687fbed4..cad86a5d9 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -2514,7 +2514,7 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
{
ptr_channel = irc_channel_new (ptr_server,
IRC_CHANNEL_TYPE_PRIVATE,
- argv[1], 1);
+ argv[1], 1, 0);
if (!ptr_channel)
{
weechat_printf (ptr_server->buffer,
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 5d8af3b3b..8ff61d755 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -334,7 +334,7 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command,
if (!ptr_channel)
{
ptr_channel = irc_channel_new (server, IRC_CHANNEL_TYPE_CHANNEL,
- pos_channel, 1);
+ pos_channel, 1, 1);
if (!ptr_channel)
{
weechat_printf (server->buffer,
@@ -864,7 +864,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
{
ptr_channel = irc_channel_new (server,
IRC_CHANNEL_TYPE_PRIVATE,
- nick, 0);
+ nick, 0, 0);
if (!ptr_channel)
{
weechat_printf (server->buffer,
@@ -1959,7 +1959,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
{
ptr_channel = irc_channel_new (server,
IRC_CHANNEL_TYPE_PRIVATE,
- nick, 0);
+ nick, 0, 0);
if (!ptr_channel)
{
weechat_printf (server->buffer,
@@ -2071,7 +2071,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
{
ptr_channel = irc_channel_new (server,
IRC_CHANNEL_TYPE_PRIVATE,
- nick, 0);
+ nick, 0, 0);
if (!ptr_channel)
{
weechat_printf (server->buffer,
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 126329663..05bedf583 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -2094,7 +2094,7 @@ irc_server_connect (struct t_irc_server *server)
charset_modifier);
}
- weechat_buffer_set (server->buffer, "display", "1");
+ weechat_buffer_set (server->buffer, "display", "auto");
weechat_bar_item_update ("buffer_name");
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index 857683b69..5ce1cc4d2 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -254,7 +254,7 @@ irc_upgrade_read_cb (int object_id,
irc_upgrade_current_channel = irc_channel_new (irc_upgrade_current_server,
weechat_infolist_integer (infolist, "type"),
weechat_infolist_string (infolist, "name"),
- 0);
+ 0, 0);
if (irc_upgrade_current_channel)
{
str = weechat_infolist_string (infolist, "topic");
diff --git a/src/plugins/jabber/jabber-command.c b/src/plugins/jabber/jabber-command.c
index 900e8e71d..8937cb6bd 100644
--- a/src/plugins/jabber/jabber-command.c
+++ b/src/plugins/jabber/jabber-command.c
@@ -466,7 +466,7 @@ jabber_command_jchat (void *data, struct t_gui_buffer *buffer, int argc,
{
ptr_muc = jabber_muc_new (ptr_server,
JABBER_MUC_TYPE_PRIVATE,
- argv[1], 1);
+ argv[1], 1, 0);
if (!ptr_muc)
{
weechat_printf (ptr_server->buffer,
diff --git a/src/plugins/jabber/jabber-muc.c b/src/plugins/jabber/jabber-muc.c
index 80a1e8787..99e516ee6 100644
--- a/src/plugins/jabber/jabber-muc.c
+++ b/src/plugins/jabber/jabber-muc.c
@@ -65,7 +65,7 @@ jabber_muc_valid (struct t_jabber_server *server, struct t_jabber_muc *muc)
struct t_jabber_muc *
jabber_muc_new (struct t_jabber_server *server, int muc_type,
- const char *muc_name, int switch_to_muc)
+ const char *muc_name, int switch_to_muc, int auto_switch)
{
struct t_jabber_muc *new_muc;
struct t_gui_buffer *new_buffer;
@@ -161,7 +161,10 @@ jabber_muc_new (struct t_jabber_server *server, int muc_type,
server->last_muc = new_muc;
if (switch_to_muc)
- weechat_buffer_set (new_buffer, "display", "1");
+ {
+ weechat_buffer_set (new_buffer, "display",
+ (auto_switch) ? "auto" : "1");
+ }
/* all is ok, return address of new muc */
return new_muc;
diff --git a/src/plugins/jabber/jabber-muc.h b/src/plugins/jabber/jabber-muc.h
index 4d0e81604..1a33bb2d3 100644
--- a/src/plugins/jabber/jabber-muc.h
+++ b/src/plugins/jabber/jabber-muc.h
@@ -68,7 +68,8 @@ extern int jabber_muc_valid (struct t_jabber_server *server,
extern struct t_jabber_muc *jabber_muc_new (struct t_jabber_server *server,
int muc_type,
const char *muc_name,
- int switch_to_muc);
+ int switch_to_muc,
+ int auto_switch);
extern void jabber_muc_set_topic (struct t_jabber_muc *muc,
const char *topic);
extern void jabber_muc_free (struct t_jabber_server *server,
diff --git a/src/plugins/jabber/jabber-server.c b/src/plugins/jabber/jabber-server.c
index 40467c57a..852ceea3c 100644
--- a/src/plugins/jabber/jabber-server.c
+++ b/src/plugins/jabber/jabber-server.c
@@ -1103,7 +1103,7 @@ jabber_server_connect (struct t_jabber_server *server)
charset_modifier);
}
- weechat_buffer_set (server->buffer, "display", "1");
+ weechat_buffer_set (server->buffer, "display", "auto");
weechat_bar_item_update ("buffer_name");
diff --git a/src/plugins/jabber/jabber-upgrade.c b/src/plugins/jabber/jabber-upgrade.c
index 77aa5b73b..05942c734 100644
--- a/src/plugins/jabber/jabber-upgrade.c
+++ b/src/plugins/jabber/jabber-upgrade.c
@@ -228,7 +228,7 @@ jabber_upgrade_read_cb (int object_id,
jabber_upgrade_current_muc = jabber_muc_new (jabber_upgrade_current_server,
weechat_infolist_integer (infolist, "type"),
weechat_infolist_string (infolist, "name"),
- 0);
+ 0, 0);
if (jabber_upgrade_current_muc)
{
str = weechat_infolist_string (infolist, "topic");
diff --git a/src/plugins/jabber/jabber-xmpp.c b/src/plugins/jabber/jabber-xmpp.c
index e33b8db54..d2730c8cb 100644
--- a/src/plugins/jabber/jabber-xmpp.c
+++ b/src/plugins/jabber/jabber-xmpp.c
@@ -130,7 +130,7 @@ jabber_xmpp_recv_chat_message (struct t_jabber_server *server,
{
ptr_muc = jabber_muc_new (server,
JABBER_MUC_TYPE_PRIVATE,
- from, 0);
+ from, 0, 0);
if (!ptr_muc)
{
weechat_printf (server->buffer,