mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 23:06:38 +02:00
Fix problem with read marker when manually switching to other buffer with some commands like /query
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user