sm00th / bitlbee-discord

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

Disable user-list on channel join #132

Open lk86 opened 6 years ago

lk86 commented 6 years ago

Given that the nicklist isn't always useful (as it always gives all of the users in the guild) and the plugin disconnects from discord daily or even more frequently, it would be really nice to have bitlbee return an empty nicklist to the client when they first join (or just in general). The ridiculous flood of usernames every time the plugin has to reconnect is incredibly hard to deal with on the client side, I have not been able to find a way to suppress those messages in irssi.

sm00th commented 6 years ago

The only place it can be done is client, irssi has the solution for it posted on its tips'n'tricks page

/ignore -channels #chan1,#chan2,#chan3 * JOINS PARTS QUITS NICKS
/ignore -channels #chan1,#chan2,#chan3 -regexp -pattern (away|gone|back|playin|weg|wech|returned) * ACTIONS
lk86 commented 6 years ago

Its not one of these message levels because its not actually a "JOIN" message. Irssi effectively runs /names every time you join a channel, and I don't know how to affect the output of that. Also its definitely possible for the irc server to return an empty list in response to NAMES messages but maybe that would have to change in bitlbee.

sm00th commented 6 years ago

bitlbee-discord has no control over what bitlbee returns in response to names requests.

Alcaro commented 6 years ago

bitlbee-discord can tell bitlbee that the channel is empty. It'll break tab complete (and, if done carelessly, mentions), but may be a worthwhile tradeoff in some cases.

But yes, the only good solutions are client-side.

dgw commented 6 years ago

I propose an alternative solution: Make it so channels aren't emptied on reconnect. Tab-completion will still work, and there will be no flood of parts/joins on reconnecting.

Is that feasible? More desirable than having an empty nick list all the time?

lk86 commented 6 years ago

I dont think @dgw 's solution is possible because I expect bitlbee-discord has no control over the channels between disconnects. But, I was just envisioning that it will tell bitlbee that the channel is empty when you first join, and then after that populate the channel with a bunch of joins. Join messages are much easier to control client-side and I expect most people have them disabled anyway, and tab completion and /names calls will work after the initial join.

I would honestly be ok with just a config variable for empty nicklists because my cllient handles tab-completion for any nick that has recently sent a message but is not in the nicklist correctly. I'd be happy to submit a PR for this if someone could help point me at the code that defines the names in a channel and new config variables, because at least on paper its a simple change.

sm00th commented 6 years ago

I still think that this is just hiding the problem (frequent disconnects) under the rug, but if you are willing to invest your own time into this I wont stop you and if it is clean enough to not affect others I'll merge it.

The code you are looking for is in discord.c:

Wibjarm commented 6 years ago

It's worth checking if your client will let you hide server messages by their numeric code, because some do, and that will let you hide the names list (353, RPL_NAMREPLY) and end-of-names-list (366, RPL_ENDOFNAMES) messages without needing any changes on bitlbee's end.