sm00th / bitlbee-discord

Bitlbee plugin for Discord (http://discordapp.com)
GNU General Public License v2.0
290 stars 27 forks source link

Allow toggling of autojoining channels. #34

Closed tecknojock closed 7 years ago

tecknojock commented 8 years ago

There are a couple channels I part every time I enter trhough bitlbee, especially since its a mirror from an IRC channel I'm in, so I get tons of pings when I speak. So, it'd be nice if I wasnt forced into that every single time discord Bitlbee disconects and rejoins.

sm00th commented 8 years ago

I am not sure how this can be implemented. How do you propose to distinguish which protocol and server should be used when you /join #general? I don't have much experience with bitlbee's channel concept but I don't think it will help either.

The only way to implement this I can think of is maintaining a list of ignored channels, but again, there is a problem of identifying which server it belongs to and there is no list type of option in bitlbee, so the only possible way to store this is a comma separated string, ugh.

tecknojock commented 8 years ago

Hmm the discord plugin is doing things differently from other channels I have. When I account off discord, it deletes all the channels from bitlbee's internal database. But if I accounts off flist all the channels that are there are still there.

there is a channel property called auto_join that if the channels weren't destroyed from bitlbee's database could be set to true or false.

To be fair, flist you have to manually add channels with chat add [account] [channel name]

I should take a look at how bitlbee handles that other plugins maybe.

tecknojock commented 8 years ago

Hmmm actually you should be able to create your own channel property used by the plugin. So you could set a server property and store which server there. And then just dont destroy it upon discord losing connection. iterate through those and just look for new channels.

sm00th commented 8 years ago

you should be able to create your own channel property used by the plugin.

I don't think this functionality is in bitlbee's chat API.

sm00th commented 8 years ago

The only "right" way to do this I see is to finally add "permissions" support to bitlbee-discord, then you'll be able to be removed from those channels by removing "read" access for your acc from them.

tecknojock commented 8 years ago

If this is exposed to the plugin as I think it is you should be able to set your own channel properties: https://github.com/bitlbee/bitlbee/blob/50bb49039b264ac599ad1ddee2be86cfc7cb68ce/set.c#L32

The steam plugin defines its own settings afterall. Ya, its definitely exposed: https://github.com/bitlbee/bitlbee-steam/blob/56b72608ee7ac804835f390e921a2234060b424c/steam/steam.c#L670

As far as it being the proper way...it seems like using bitlbee's built in auto_join property would be the proper way to do it as per other plugins. You might also consider making the channels default property to auto_join = 'true' if you wanna keep it as you have it.

sm00th commented 8 years ago

https://github.com/bitlbee/bitlbee/blob/50bb49039b264ac599ad1ddee2be86cfc7cb68ce/set.c#L32

Those are per-account properties, not per-channel and can't be used as they can be added only during plugin init step. Besides, as I mentioned previously, the only way to store any data there I see is a huge mess of a string.

it seems like using bitlbee's built in auto_join property would be the proper way to do it as per other plugins

If we used user-created channels than yes, but we don't, what bitlbee-discord does with channels is closer to twitter protocol than anything else. And what "other plugins" have automatically added channels that have an ability to disable auto_join?

sm00th commented 8 years ago

https://github.com/bitlbee/bitlbee/pull/80 can make this feature possible.

mkaito commented 8 years ago

A huge :+1: from me. The discord server my gaming alliance uses has dozens of channels, most for a very specific topic. I, and the vast majority of the alliance, only use 1 channel for general communication. It's quite tiring to keep closing all those buffers that clog my buffer list.

arcnmx commented 8 years ago

the plugin should definitely not auto join anything that has not been manually configured as a channel via the standard bitlbee chatroom interface.

digitalcircuit commented 8 years ago

Bitlbee master has now merged chat list support as of this evening. If there's any research or testing that'd be beneficial, I'm happy to help!

dequis commented 8 years ago

Using the listchan branch and just enabling auto_join seems to work:

<@dx|discord> chat list discord
<@root> Index  Title                 Topic
<@root>     1  the_one_you_shouldnt  But you do anyway because permissions do not work yet
<@root>     2  testdump              /ignore -channels #testdump *
<@root>     3  beecord               What else doesn't work yet?
<@root> 3 discord chatrooms
<@dx|discord> chat add discord !3 #beecord
<@root> Chatroom successfully added.
<@dx|discord> chan #beecord set auto_join true
<@root> auto_join = `true'
sm00th commented 8 years ago

Trying to maintain both autojoin and noautojoin in bitlbee-discord proves to be less straightforward than I would hope, so noautojoin will be the default and only option in the future. listchan branch containing "noautojoin" is sane and stable enough, but, as "chat list" functionality is not in any stable bitlbee release as of date I can't merge it back to master forcing every user to use dev builds of bitlbee. So the feature will be merged to master with the next stable bitlbee release. For those brave and impatient - you can use listchan branch, I will update it with any fixes/features that will be added to master branch. Ocasional force pull might be needed.

sm00th commented 7 years ago

Bitlbee 3.5 is a go, I'll give some time for distros to catch up and will be merging listchan to master this or next week.

sm00th commented 7 years ago

listchan branch has been merged to master.