Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.

Commit 8eaca16

Browse files
author
Michael
committed
Fix filters not working correctly when sender is not in channel
Regression introduced by 75e9f4d
1 parent db2d34c commit 8eaca16

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

Sources/Plugins/Chat Filter/Classes/TPI_ChatFilterLogic.m

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,17 @@ - (BOOL)testFilterSender:(TPI_ChatFilter *)filter authoredBy:(IRCPrefix *)textAu
154154

155155
IRCChannelUser *senderUser = [textDestination findMember:textAuthor.nickname];
156156

157-
if (senderUser == nil) {
158-
LogToConsoleDebug("senderUser == nil — Skipping to next filter");
159-
160-
return NO;
161-
}
162-
163157
/* Check age of sender */
164158
NSInteger filterAgeLimit = filter.filterAgeLimit;
165159

166160
if (filterAgeLimit > 0) {
161+
/* The value of senderUser is checked here and not where it is
162+
declared so that filters that do not rely on the value of this
163+
object are passed over. */
164+
if (senderUser == nil) {
165+
return NO;
166+
}
167+
167168
NSInteger ageLimitDelta = [NSDate timeIntervalSinceNow:senderUser.creationTime];
168169

169170
switch (filter.filterAgeComparator) {
@@ -192,6 +193,10 @@ - (BOOL)testFilterSender:(TPI_ChatFilter *)filter authoredBy:(IRCPrefix *)textAu
192193

193194
/* Is sender an operator? */
194195
if (filter.filterIgnoreOperators) {
196+
if (senderUser == nil) {
197+
return NO;
198+
}
199+
195200
if (senderUser.halfOp) {
196201
/* User is at least a Half-op, ignore this filter. */
197202

Sources/Plugins/Chat Filter/Resources/User Interface/en.lproj/TPI_ChatFilterEditFilterSheet.xib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<windowStyleMask key="styleMask" titled="YES"/>
6363
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
6464
<rect key="contentRect" x="283" y="305" width="589" height="590"/>
65-
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1440"/>
65+
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
6666
<view key="contentView" id="alB-sv-LJa">
6767
<rect key="frame" x="0.0" y="0.0" width="589" height="590"/>
6868
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>

0 commit comments

Comments
 (0)