42wim / matterircd

Connect to your mattermost or slack using your IRC-client of choice.
MIT License
294 stars 60 forks source link

[wishlist] Differentiate between public and private channels #488

Open kot0dama opened 1 year ago

kot0dama commented 1 year ago

Hi!

I'm not sure if that's for matteircd to handle, but would there be a way to differentiate between public and private channels ? For example private ones could be prefixed with ## or something similar ?

Thank you!

kot0dama commented 1 year ago

From the RFC:

   Channels names are strings (beginning with a '&' or '#' character) of
   length up to 200 characters.  Apart from the the requirement that the
   first character being either '&' or '#'; the only restriction on a
   channel name is that it may not contain any spaces (' '), a control G
   (^G or ASCII 7), or a comma (',' which is used as a list item
   separator by the protocol).
kot0dama commented 1 year ago

I'm not sure if MatterMost allows for channels starting with a #, in any case we could also use & instead to avoid any confusion with a real public channel starting with a #.

42wim commented 1 year ago

This is already done using the +p irc flags. You should see this in your irc client.

image

kot0dama commented 1 year ago

Ah I see, I'm using hexchat and that one doesn't display modes sadly. I should switch to irssi soon enough though.

Maybe that's something worth revisiting though, for more visibility and for folks using hexchat or similar clients ?

Freenode used to use ## for non official channels, and I think some networks use & for private ones. Unless matterircd already uses & for something else ?

42wim commented 1 year ago

https://hexchat.readthedocs.io/en/latest/settings.html has an option to show it.

& is already used for special channels as the irc modes are the "irc" way to differentiate different type of channel settings, I'm not really a fan of having another option to do the same.

It should be the responsibility of the irc client to implement it correctly.

kot0dama commented 1 year ago

I see, well I'll need to report a bug to hexchat then as it displays an empty () where I'm guessing channel modes should appear :) Thanks for the pointers.

As an IRC user from long ago, I understand your point of view on this, but then Mattermost client (desktop and web) is clearly displaying a lock icon in front of private channels, and I thought it would be best to reflect that on IRC, as there are ways to do it.

Mattermost does not allow channels to start with a # (at least not in their channel handle), and if you create a channel like #test, it will be stored by Mattermost with #test as channel name, but that will not be reflected in the channel handle test, stripped of the pound sign.

Could you reconsider your stance on this and allow private channels to be displayed as ##channel_handle, maybe as an option ?

hloeung commented 1 year ago

Having more thought on this, I think this creates a bit of confusion though. A user joining a channel would need to guess if it's public or private, so /join #channel or /join ##channel. Or "Hey Bob, can you join ##channel?"

Maybe the IRC client of choice could be made to show private channels differently with the +p mode instead - different colours for status bar etc.

I started a quick patch to play around but aborted due to the reasoning above. You're free to run with it:

diff --git a/mm-go-irckit/channel.go b/mm-go-irckit/channel.go
index 3102fe3..c2b2ad7 100644
--- a/mm-go-irckit/channel.go
+++ b/mm-go-irckit/channel.go
@@ -90,11 +90,15 @@ type channel struct {

 // NewChannel returns a Channel implementation for a given Server.
 func NewChannel(server Server, channelID string, name string, service string, modes map[string]bool) Channel {
+       channel_name := name
+       if modes["p"] {
+               channel_name = "#" + name
+       }
        return &channel{
                created:  time.Now(),
                server:   server,
                id:       channelID,
-               name:     name,
+               name:     channel_name,
                service:  service,
                private:  modes["p"],
                usersIdx: make(map[string]*User),

You'll then need to also update various other places such as ./mm-go-irckit/service.go, ./mm-go-irckit/server_commands.go, ./mm-go-irckit/userbridge.go.

idY7ljQ73E lzUu3VkRFd

hloeung commented 1 year ago

See also https://github.com/42wim/matterircd/issues/235

42wim commented 1 year ago

Nope, not sold on the ## I'm open to adding a 🔒 to the irc-topic though as a compromise ;)