Skip to content

Commit

Permalink
irc: restore input prompt after upgrade on server and channel buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
flashcode committed May 11, 2024
1 parent 464b019 commit c1083d0
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/plugins/irc/irc-upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,40 @@ irc_upgrade_read_cb (const void *pointer, void *data,
return WEECHAT_RC_OK;
}

/*
* Set buffer prompt on IRC buffers where it's not set and if it should be.
*
* This is needed when upgrading from WeeChat < 4.3.0 to Weechat ≥ 4.3.0,
* where the "input_prompt" has been added in buffer.
*/

void
irc_upgrade_set_buffer_prompt ()
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;

for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (ptr_server->buffer)
{
if (!weechat_buffer_get_string (ptr_server->buffer, "input_prompt"))
{
irc_server_set_buffer_input_prompt (ptr_server);
}
else
{
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
irc_channel_set_buffer_input_prompt (ptr_server, ptr_channel);
}
}
}
}
}

/*
* Loads irc upgrade file.
*
Expand Down Expand Up @@ -1019,5 +1053,7 @@ irc_upgrade_load ()
(ptr_filter && ptr_filter[0]) ? ptr_filter : "*");
}

irc_upgrade_set_buffer_prompt ();

return rc;
}

0 comments on commit c1083d0

Please sign in to comment.