torhve / weechat-matrix-protocol-script

A WeeChat script in Lua that implements the matrix.org chat protocol
349 stars 52 forks source link

Add option to strip away '(IRC)' tags from user nicks #100

Closed craftyguy closed 5 years ago

craftyguy commented 6 years ago

Some IRC bridges (matrix's freenode bridge) add a '(IRC)' tag to nicks that are on the IRC server. This adds an option to strip this away from the room message buffer, nick list, and autocomplete.

scadu commented 6 years ago

@torhve would it be possible to merge this one? Quite a necro bump, but this feature would be extremely useful.

torhve commented 6 years ago

I kinda think this should be done as a trigger instead of doing it in the script, it feels very inelegant. Although, if someone makes a new PR that merges cleanly, and the option is default is off, I guess I don't see much harm in merging it.

scadu commented 6 years ago

@torhve Hm, you're right. I totally forgot about triggers. I will look a look, since as you say it's more elegant solution.

stettberger commented 6 years ago

As far as I can see, I can only replace what is printed. However, I did not figure out how to remove the (IRC) from the nicklist (more important: tab completion). So, just for the record, this trigger works for me. Perhaps, we can put this somewhere. At the moment, the condition is a little bit loose, as it triggers on every message printed by any lua plugin, but it works.

/trigger addreplace ircstrip modifier weechat_print "^lua" "/^([^\t]*) \(IRC\)/${re:1}"
SanketDG commented 6 years ago

if someone makes a new PR that merges cleanly, and the option is default is off, I guess I don't see much harm in merging it.

The current PR respects this.

@torhve So this would be accepted if someone opens a new PR resolving the conflicts?