tiny icon indicating copy to clipboard operation
tiny copied to clipboard

/channels as a parameterized LIST command

Open eHammarstrom opened this issue 3 years ago • 6 comments

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.

eHammarstrom avatar Feb 08 '22 10:02 eHammarstrom

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.

sullivant avatar Feb 11 '22 02:02 sullivant

@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.

trevarj avatar Feb 11 '22 07:02 trevarj

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!

sullivant avatar Feb 11 '22 13:02 sullivant

however there may be a lot of them

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

trevarj avatar Feb 11 '22 13:02 trevarj

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. :)

sullivant avatar Feb 11 '22 13:02 sullivant

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/

trevarj avatar Feb 11 '22 13:02 trevarj