Skip to content

use visible channel name in layout save #1197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2020
Merged

Conversation

lotheac
Copy link
Contributor

@lotheac lotheac commented May 21, 2020

Hi,

there's something of a long standing problem with /layout save and !-channels (eg. on IRCnet). Consider the following initial config file, without channels or windows saved:

servers = (
  {
    address = "irc.cs.hut.fi";
    chatnet = "IRCnet";
    port = "6667";
    autoconnect = "yes";
  }
);

chatnets = {
  IRCnet = {
    type = "IRC";
    max_kicks = "1";
    max_msgs = "1";
    max_whois = "1";
  };
};

settings = {
  core = {
    real_name = "irssi-chansave";
    user_name = "irssi-chansave";
    nick = "irssi-chansave";
  };
  "fe-text" = { actlist_sort = "refnum"; };
};
windows = {
  1 = { immortal = "yes"; name = "(status)"; level = "ALL"; };
};

When irssi is started on this config file, and a !-channel is joined (/join !!new-channel, or /join !existing-channel), a new window is created and the channel item is added to that window, as expected. /window will report:

11:27 Window  : #3
11:27 Size    : 113x54
11:27 Level   : NONE
11:27 Server  : IRCnet
11:27 Items   : Name                           Server tag
11:27  CHANNEL: !existing-channel              IRCnet

Now, however, if /layout save is used by the user who wants this channel to stay in the same window next time they run irssi, a discrepancy is created:

11:29 Window  : #3
11:29 Size    : 113x54
11:29 Level   : NONE
11:29 Server  : IRCnet
11:29 Bounds  : Name                           Server tag
11:29         : !KYKAFexisting-channel         IRCnet          sticky
11:29 Items   : Name                           Server tag
11:29  CHANNEL: !existing-channel              IRCnet

When irssi is restarted, window #3 is again created with the bound:

11:29 Window  : #3
11:29 Size    : 113x54
11:29 Level   : NONE
11:29 Server  : IRCnet
11:29 Bounds  : Name                           Server tag
11:29         : !KYKAFexisting-channel         IRCnet          sticky

but when !existing-channel is rejoined, it does not match the bound on window 3, creating a new window instead and leaving window 3 empty.

So, I propose this patch to modify layout saving to create a binding for the visible_name of the channel instead, which makes this scenario of saving layouts for !-channels work correctly.

@ailin-nemui
Copy link
Contributor

interesting! I wonder if there is any argument for this way or making sure that the idchan is matched by full ID on the bond when rejoining?

@lotheac
Copy link
Contributor Author

lotheac commented May 21, 2020

interesting! I wonder if there is any argument for this way or making sure that the idchan is matched by full ID on the bond when rejoining?

I'm not sure. But actually it turns out I spoke a bit too soon - this doesn't fully work. It creates the binding correctly on !existing-channel, but on exit the full id is written to the config file anyway.

@lotheac lotheac changed the title use visible channel name in layout save WIP: use visible channel name in layout save May 21, 2020
@lotheac
Copy link
Contributor Author

lotheac commented May 21, 2020

There's two arguments that come to my mind against storing the full timestamped name for !-channels in the configuration file:

  1. if the !-channel to be autojoined does not exist the next time that irssi is started, a new incorrectly-named channel is automatically created. eg. when I had !KYKAFexisting-channel configured in both channels and windows, the correct saved window was used, but I ended up on the channel !KYLPPKYKAFexisting-channel instead. If the prefix is not present in the config file, a new channel is still created, but it will have the correct name (though the prefix changes, obviously).
  2. /channel add !existing-channel (or /join !existing-channel, if the user manually joins the channel instead of adding it) is probably a more friendly user experience than having to figure out what the channel prefix is for these commands -- I think that information isn't particularly easy to find in irssi.

@lotheac lotheac changed the title WIP: use visible channel name in layout save use visible channel name in layout save May 21, 2020
@lotheac
Copy link
Contributor Author

lotheac commented May 21, 2020

Updated patch to now actually also write the visible_name to the config file. Now, the resulting config actually keeps the channel in the intended window, regardless of whether it was created by autojoining, and the binding matches the item in /window:

12:16 Window  : #2
12:16 Size    : 113x54
12:16 Level   : NONE
12:16 Server  : IRCnet
12:16 Bounds  : Name                           Server tag
12:16         : !existing-channel              IRCnet          sticky
12:16 Items   : Name                           Server tag
12:16  CHANNEL: !existing-channel              IRCnet

I also updated the ADDALLCHAN alias to add channels with their visible_name.

@ailin-nemui
Copy link
Contributor

@irssi/developers

@ailin-nemui ailin-nemui merged commit 99b941d into irssi:master May 21, 2020
@ailin-nemui ailin-nemui added this to the 1.2.3 milestone Apr 8, 2021
ailin-nemui added a commit that referenced this pull request Apr 8, 2021
use visible channel name in layout save

(cherry picked from commit 99b941d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants