Last active
September 28, 2015 18:48
-
-
Save masakih/1481553 to your computer and use it in GitHub Desktop.
スレNG機能のパッチ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: application/source/browser/BSDBThreadList.m | |
| =================================================================== | |
| --- application/source/browser/BSDBThreadList.m (revision 1386) | |
| +++ application/source/browser/BSDBThreadList.m (working copy) | |
| @@ -25,6 +25,8 @@ | |
| #import "BSSExpParser.h" | |
| #import "BSLabelManager.h" | |
| #import "SmartBoardListItem.h" | |
| +#import "CMRFileManager.h" | |
| + | |
| NSString *BSDBThreadListDidFinishUpdateNotification = @"BSDBThreadListDidFinishUpdateNotification"; | |
| NSString *BSDBThreadListWantsPartialReloadNotification = @"BSDBThreadListWantsPartialReloadNotification"; | |
| @@ -477,13 +479,53 @@ | |
| } | |
| #pragma mark## Filter ## | |
| +- (NSURL *)regsFileURL | |
| +{ | |
| + NSString *path = [[CMRFileManager defaultManager] supportFilepathWithName:@"hoge.txt" resolvingFileRef:nil]; | |
| + return [NSURL fileURLWithPath:path]; | |
| +} | |
| +- (NSPredicate *)systemPredicate | |
| +{ | |
| + static NSPredicate *systemPredicate = nil; | |
| + static NSString *regFile = nil; | |
| + NSString *configFile = [NSString stringWithContentsOfURL:[self regsFileURL] | |
| + encoding:NSUTF8StringEncoding | |
| + error:NULL]; | |
| + if(![regFile isEqualToString:configFile]) { | |
| + [regFile release]; | |
| + regFile = [configFile retain]; | |
| + [systemPredicate release]; | |
| + systemPredicate = nil; | |
| + } | |
| + if(systemPredicate) return systemPredicate; | |
| + | |
| + NSArray *regs = [regFile componentsSeparatedByString:@"\n"]; | |
| + if(!regs) return nil; | |
| + | |
| + NSMutableArray *predicates = [NSMutableArray array]; | |
| + for(NSString *reg in regs) { | |
| + if([reg length] == 0) continue; | |
| + NSPredicate *predicate = [NSPredicate predicateWithFormat:@"threadName CONTAINS[cd] %@", reg]; | |
| + if(!predicate) continue; | |
| + [predicates addObject:predicate]; | |
| + } | |
| + systemPredicate = [NSCompoundPredicate orPredicateWithSubpredicates:predicates]; | |
| + systemPredicate = [[NSCompoundPredicate notPredicateWithSubpredicate:systemPredicate] retain]; | |
| + return systemPredicate; | |
| +} | |
| - (void)updateFilteredThreadsIfNeeded | |
| { | |
| NSPredicate *predicate = nil; | |
| if (mSearchString && [mSearchString length] > 0) { | |
| predicate = [BSSExpParser predicateForString:mSearchString forKey:ThreadNameColumn]; | |
| } | |
| - if (predicate) { | |
| + if(predicate) { | |
| + predicate = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:predicate, [self systemPredicate], nil]]; | |
| + } else { | |
| + predicate = [self systemPredicate]; | |
| + } | |
| + | |
| + if(predicate) { | |
| [self setFilteredThreads:[mCursor filteredArrayUsingPredicate:predicate]]; | |
| } else { | |
| UTILDebugWrite(@"Predicate is null"); | |
| Index: application/source/browser/Browser.m | |
| =================================================================== | |
| --- application/source/browser/Browser.m (revision 1386) | |
| +++ application/source/browser/Browser.m (working copy) | |
| @@ -169,7 +169,7 @@ | |
| : NSLocalizedStringFromTable(@"Browser Title (Thread Mode)", @"ThreadsList", @""); | |
| // #warning 64BIT: Check formatting arguments | |
| // 2010-07-29 tsawada2 修正済 | |
| - foo = [NSString stringWithFormat:base_, (unsigned long)[list_ numberOfThreads]]; | |
| + foo = [NSString stringWithFormat:base_, (unsigned long)[list_ numberOfFilteredThreads]]; | |
| } | |
| return [NSString stringWithFormat:@"%@ (%@)", [list_ boardName], foo]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ~/Library/Application Support/BathyScaphe/hoge.txt | |
| を作って、一行ごとにNGにしたいスレッドタイトルに含めたくない文字列を書く |
masakih
commented
Apr 29, 2012
Author
- 保存する形式、書式は? 正規表現とか受け付けるとすればどんな感じになるの? そのファイルはhumann readable?
- 板ごと設定とかにすると凄く面倒そう
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment