Skip to content
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

Embed human-readable channel name in buffer names? #67

Open
ToxicFrog opened this issue Feb 18, 2020 · 4 comments
Open

Embed human-readable channel name in buffer names? #67

ToxicFrog opened this issue Feb 18, 2020 · 4 comments
Labels
internal-enhancement An enhancement to the internal implementation
Milestone

Comments

@ToxicFrog
Copy link

The buffers are all internally named weecord.<guild ID>.<channel ID>. This means you can't /buffer to them except by index, since /buffer uses the full name, not the short name, for subname matching. For example, I have an #off-topic channel in one of my discords, and to get there, /buffer off-topic won't work; I have to use /buffer .544728.

It seems like it would be straightforward to fix this by embedding the short_name in the full buffer name, so it becomes weecord.<guild>.<channel>.<name>. Change buffer_id_for_channel() to take in the channel name as well as channel/guild IDs and slap it on the end. However, I'm not sure if this would interact badly with e.g. channel renames -- are there any obvious land mines here?

@Noskcaj19
Copy link
Member

This is a bit of an interesting subject, the reason for the current format of guild id.channel id was due to the need to always be able to access a buffer for a given channel without having to do any network requests to find the names, avoid storing a separate index of buffers, and avoid iterating over all buffers. This also never affected me much, as I use go.py and have it configured to use short_name.

However, I do not know if there are actually currently any cases in which the guild and channel names are not known that would make lookup difficult. Additionally, there have been times when having a separate global store would be quite nice, and with recent changes to weechat-rs, that has been made a more reasonable option.

TLDR, I think the change would be great. I don't believe weechat-discord has many internal landmines here, frankly I don't know that much about weechat and it's best practices, but I don't think there should by any there.
The one issue is that Discord allows for multiple guilds with the same name, as well as multiple channels in the same guild with the same name. This means we would probably have to stick some form of unique identifier in the id.

Frankly, weechats design of not separating internal and external details and concerns makes a lot of things rather difficult.

@ToxicFrog
Copy link
Author

This issue actually prompted me to start using go.py and the UX there is so much nicer than /buffer that I no longer consider this a useful feature request, so feel free to close it. :)

@surskitt
Copy link

surskitt commented Mar 29, 2020

I would definitely still find this useful. I use go.py, but I set my short names to emoji to fit loads on the bottom bar.

I tried setting the "name" of the buffer (/buffer_autoset add weecord.123.123 name cord_chan) but this seems to mess with the plugin.

@poljar
Copy link

poljar commented Apr 6, 2020

This can be worked around by hooking onto the /buffer command and overriding it's behavior like here.

@Noskcaj19 Noskcaj19 added this to the Mk3 milestone Sep 2, 2020
@Noskcaj19 Noskcaj19 added the internal-enhancement An enhancement to the internal implementation label Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal-enhancement An enhancement to the internal implementation
Projects
None yet
Development

No branches or pull requests

4 participants