weechat / weechat

The extensible chat client.

Home Page:https://weechat.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"irc_is_message_ignored" is calling the wrong callback

necauqua opened this issue · comments

Describe the bug

Looks like I'm the first person to actually call it 🙃

here

Steps to reproduce

Write a script intercepting some IRC commands and manually printing them into a buffer with some bells and whistles
Try to add support for ignores by checking weechat_info_get('irc_is_message_ignored', 'server,raw')

Current behavior

It does not work

Expected behavior

I should work

Suggested solutions

Hopefully an obvious oneline fix, I didn't make a PR myself because I'm currently not up to setting up a C dev env on nix to properly test it, sorry

Additional information

No response

WeeChat version

4.1.2

What OS are you using?

NixOS 24.05.20240102.63143ac

On which terminal are you running WeeChat?

No response

Which terminal multiplexer are you using?

No response

Hi, indeed it's wrong, I'll fix ASAP.

By the way instead of catching IRC signals and using this info (which is specific to IRC plugin), I would recommend to use a function like hook_line, which is called when a line is displayed (by WeeChat or any plugin). If a line is displayed, that means it's not ignored by irc plugin (except if option irc.look.ignore_tag_messages is enabled, it's new in 4.2.0).

And I'll also add unit tests on IRC infos to prevent such bugs.

Thanks :)

I've considered hook_line, but between all the things I wanted to achieve, it seems most straightforward to intercept those messages and print them to buffer completely on my own, as I've described there

(I'm almost done making my own version of twitch.py, which does not call the http apis, but extracts and shows significantly more information from ircv3 tags and presents it better, including adding a lot of it to tags for versatile filtering and even post-tagging moderated messages to be (potentially) filtered out as well

The irc_filter thing is literally me reading about the shortcomings of twitch.py from it's desc and trying my best to work around those)

Fixed in 4.0.8, 4.1.3, 4.2.0 (these 3 versions will be released soon).