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

/channels as a parameterized LIST command #382

Open
eHammarstrom opened this issue Feb 8, 2022 · 6 comments
Open

/channels as a parameterized LIST command #382

eHammarstrom opened this issue Feb 8, 2022 · 6 comments

Comments

@eHammarstrom
Copy link

To list channels I currently use LIST, but sometimes I want to change the ordering, or perhaps order by number of users instead.

/channels [ORDER_BY] [ORDERING]
  ORDER_BY: name (default), num_users
  ORDERING: ascending, descending

No args to the command would result in the default LIST behavior.

@sullivant
Copy link

So, I am still getting used to doing more "shared" rust - I have some personal projects and not much experience in the most idiomatic way of doing things (my day-to-day is java). However I forked and created a rudimentary "channels" command in my commit here:

sullivant/tiny@cdac2f3

This does the basic, but it adds it as a TUI command as I was not really sure how to get a list of channel tabs (or any tabs really) while in the file crates/tiny/src/cmd.rs. I still need to look into that if that's where it belongs, as well as, of course parameterizing the command and including nick counts within that chan.

This is my first here - so feel free to toss this away if it's in a totally incorrect direction, but I'd like to learn more, that's for sure as I use tiny every day and love it.

@trevarj
Copy link
Contributor

trevarj commented Feb 11, 2022

@sullivant I think you are on the right track. The only thing is that I think we want to list all channels on the server, not only what we joined.

The implementation will need to be similar to how names() (/names) works in cmd.rs.
So from your new channels() function you will call find_client() and then within in the client you will send the LIST message and parse the result according to the inputs (order by, ordering).

Let me know if you need any help or find us in the #tiny channel on oftc.

@sullivant
Copy link

sullivant commented Feb 11, 2022

Gotcha - that makes sense about the channels, however there may be a lot of them. Will look into that!

Going to take the advice re /names and run with it. Thanks!

@trevarj
Copy link
Contributor

trevarj commented Feb 11, 2022

however there may be a lot of them

Yes, never run in a channel tab or you will flood it!

@sullivant
Copy link

Certainly. For instance if I'm connected to irc.libera.chat and run a LIST ... it takes quite a bit of time to get through it. Content shows up looking pretty standard:

zirconium.libera.chat: flandish #zuul 11
zirconium.libera.chat: flandish #zynaddsubfx 10  The ZynAddSubFX open source musical synthesizer https://zynaddsubfx.sf.net | https://github.com/zynaddsubfx https://github.com/mruby-zest
zirconium.libera.chat: flandish #zypp 5

On this server, it's sorted by default alpha - which is fine, but there is very little ability to grep/grok any of it, as it all scrolls off. I wonder if also a param for "filtering" would be nice to have - ie: "min_users=10" to only show the obvious, etc.

Anyway, I've got a bit of time today, but have to get back to some for-pay work. I hope to take a look at this more, and by all means, please understand that I'm enjoying this learning process, but don't wait for me if someone else already has it. :)

@trevarj
Copy link
Contributor

trevarj commented Feb 11, 2022

I wonder if also a param for "filtering" would be nice to have - ie: "min_users=10" to only show the obvious

Yeah, I think this is common among other clients, for example irssi offers some filtering by name and number of users

Ref: https://irssi.org/documentation/help/list/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants