Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Themes may break nickchange/quit detection #8

Open
falconindy opened this issue May 28, 2016 · 16 comments
Open

Themes may break nickchange/quit detection #8

falconindy opened this issue May 28, 2016 · 16 comments

Comments

@falconindy
Copy link

As of 2370378, smartfilter is broken with themes which alter the way quit and nickchange messages are displayed. For example, the theme I use contains (among other things):

formats = {
  "fe-common-core" = {
    quit = "%K[-] $0 quit -- $2%N";
    nick_changed = "%B** $0 is now known as $1";
  }
}

Perhaps there's another way to achieve per-channel filtering of nick and which is less brittle.

@konomikitten
Copy link
Contributor

Using levels might provide a way to get around this, I don't know if I'll be able to work that out but someone else might be able to. Might give it a look later.

@konomikitten
Copy link
Contributor

I'm still looking into this but I can see what the problem is strait away, parsing print text in any way that presume the quit message format will be constant will always break when people have different themes.

The offending lines are:

80 if($stripped =~ m/([^ ]+) is now known as ([^ ]+)/) {
84 if($stripped =~ m/-!- ([^ ]+) .+? has quit/) {

Stuff like this will never work consistently with themeing, I'm looking into a solution but it'd be nice @mrc0mmand could look at it considering it was their merge, they might be able to fix it far faster than me.

@mrc0mmand
Copy link
Contributor

This is indeed an issue, but parsing print text signal for filtering server-wide signals (such as NICKS and QUITS) for each channel is probably the only way how to do that. You could maybe somehow catch the corresponding message nick/quit signal for each message print, but I'm not sure if it's even feasible to do that reliably.

@konomikitten
Copy link
Contributor

konomikitten commented Jul 17, 2016

What was the issue with using message quit and message join over print text @mrc0mmand if you don't mind elaborating?

@mrc0mmand
Copy link
Contributor

Signals message quit and message nick are server-wide signals, so if you filter them in one channel (eg. calling Irssi::signal_stop()) they won't get propagated to other channels (where they maybe wouldn't get filtered).

@konomikitten
Copy link
Contributor

Meh okay that is a big problem, I'll keep looking into solutions, thanks for the information.

@christf
Copy link

christf commented Nov 17, 2016

I am also affected by this using the weed theme. is it possible to use the settings from the theme to devise a pattern?

@henriklb
Copy link

henriklb commented Dec 8, 2016

Same with my theme.

@ailin-nemui
Copy link

I think it may be possible to use &Irssi::signal_continue; with a local $quit = some info; from the message quit signal handler, and then in the print text handler if ($quit ...) { Irssi::signal_stop; } -- just an untested idea though

@c0d3m0nk3y
Copy link

Why not simply /ignore * QUITS

And a question I have, why use this script instead of simply /ignore * JOINS PARTS QUITS?

@falconindy
Copy link
Author

@c0d3m0nk3y because showing activity from recently active users is desirable, e.g. in case of disconnect/reconnect mid-conversation. Leaving joins/parts unfiltered in a large channel results in way too much useless noise. This scripts provides the middle ground.

@konomikitten
Copy link
Contributor

Sorry everyone but unless Irssi implements a version of the print text signal where instead of providing the whole message they provider extra information such as the nick etc we really can't do anything about this. We have no current way I can think of to know how a theme will affect what print text returns, therefor no way to parse it properly besides presuming the default theme. I know it sucks I would love to fix it but I don't think it can be done as per my earlier posts.

@c0d3m0nk3y
Copy link

@falconindy Ah it seems I skipped some of the functionality provided. Many thanks for the quick reply.

@konomikitten That is a shame. I've opted for /ignore * QUITS as my theme too causes this issue.

@ailin-nemui
Copy link

@konomikitten you need to start with another signal, in this case "message quit", where you are provided with the nick and address.Then you can call &Irssi::signal_continue; and check which of the following (nested) print text signals have a $dest->{level} & MSGLEVEL_QUITS

@konomikitten
Copy link
Contributor

konomikitten commented Mar 28, 2018

@ailin-nemui I investigated this in the past and message quit will not work, to quote:

@mrc0mmand
Signals message quit and message nick are server-wide signals, so if you filter them in one channel (eg. calling Irssi::signal_stop()) they won't get propagated to other channels (where they maybe wouldn't get filtered).

I don't want to sound rude but please make sure to read the entire issue so we don't have to repeat things 😄.

Edit: I just realised something else you said.

@ailin-nemui
and check which of the following (nested) print text signals have a $dest->{level} & MSGLEVEL_QUITS

There's no way to nest signals as far as I know you'd do continue it'd flow and that would be the end.

@ailin-nemui
Copy link

yes you must not call signal_stop in them :-)

meribold added a commit to meribold/dotfiles that referenced this issue Aug 5, 2018
See <lifeforms/irssi-smartfilter#8>.  The
`smartfilter.pl` script is prone to breaking when a non-default theme is
used (fixing this would apparently require changes to Irssi itself).
For now, adjusting regexes in `smartfilter.pl` to the theme used is the
way to work around this issue.
meribold added a commit to meribold/dotfiles that referenced this issue Aug 5, 2018
The `smartfilter.pl` script is prone to breaking when a non-default
theme is used (fixing this would apparently require changes to Irssi
itself).  For now, adjusting regexes in `smartfilter.pl` to the theme
used is the way to work around this issue.

See <lifeforms/irssi-smartfilter#8>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants