Skip to content

Commit

Permalink
1) Remap underline format keyboard shortcut.
Browse files Browse the repository at this point in the history
2) Prevent a network staff member from banning themselves through a G:Line
3) Add option to disable inline images for specific channels
4) Add option to disable join, part, and quit activity for specific channels
5) Fix support for the command "/join 0" in order to part all channels
6) Bring over support for regular expression highlights from the master branch
7) Bring over new caching engine from master branch
8) Do not compile modern regular expression engine by default
9) Fix bug in simplified light resulting in it not displaying some content properly
10) Fix plugins not being compiled alongside Textual
11) Added support for multiple inline images
12) Added support for Textual not to show duplicate inline images when it does multiple
13) Groundwork for ability to hide an inline image
  • Loading branch information
Michael Morris committed Jul 16, 2011
1 parent b2f191e commit e7e8897
Show file tree
Hide file tree
Showing 31 changed files with 1,296 additions and 850 deletions.
18 changes: 14 additions & 4 deletions Classes/Controllers/MasterController.m
Original file line number Diff line number Diff line change
Expand Up @@ -885,9 +885,6 @@ - (void)completeNick:(BOOL)forward

if (commandMode) {
choices = [NSMutableArray array];

NSArray *resourceFiles = [_NSFileManager() contentsOfDirectoryAtPath:[Preferences whereScriptsPath] error:NULL];

for (NSString *command in [[Preferences commandIndexList] allKeys]) {
[choices safeAddObject:[command lowercaseString]];
}
Expand All @@ -900,6 +897,19 @@ - (void)completeNick:(BOOL)forward
}
}

NSArray *resourceFiles = [_NSFileManager() contentsOfDirectoryAtPath:[Preferences whereScriptsPath] error:NULL];

for (NSString *file in resourceFiles) {
NSArray *parts = [NSArray arrayWithArray:[file componentsSeparatedByString:@"."]];
NSString *cmdl = [[parts stringAtIndex:0] lowercaseString];

if ([choices containsObject:cmdl] == NO) {
[choices safeAddObject:cmdl];
}
}

resourceFiles = [_NSFileManager() contentsOfDirectoryAtPath:[Preferences whereScriptsLocalPath] error:NULL];

for (NSString *file in resourceFiles) {
NSArray *parts = [NSArray arrayWithArray:[file componentsSeparatedByString:@"."]];
NSString *cmdl = [[parts stringAtIndex:0] lowercaseString];
Expand Down Expand Up @@ -1349,7 +1359,7 @@ - (void)registerKeyHandlers
[self handler:@selector(sendMsgAction:) code:KEY_RETURN mods:NSCommandKeyMask];

[self handler:@selector(textFormattingBold:) char:'b' mods:NSCommandKeyMask];
[self handler:@selector(textFormattingUnderline:) char:'u' mods:NSCommandKeyMask];
[self handler:@selector(textFormattingUnderline:) char:'u' mods:(NSCommandKeyMask | NSShiftKeyMask)];
[self handler:@selector(textFormattingItalic:) char:'i' mods:(NSCommandKeyMask | NSShiftKeyMask)];
[self handler:@selector(textFormattingForegroundColor:) char:'c' mods:(NSCommandKeyMask | NSShiftKeyMask)];
[self handler:@selector(textFormattingBackgroundColor:) char:'c' mods:(NSCommandKeyMask | NSShiftKeyMask | NSAlternateKeyMask)];
Expand Down
8 changes: 6 additions & 2 deletions Classes/Controllers/MenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1422,8 +1422,12 @@ - (void)onMemberGline:(id)sender
if (NO_CLIENT_OR_CHANNEL || IS_CLIENT) return;

for (IRCUser *m in [self selectedMembers:sender]) {
[u sendCommand:[NSString stringWithFormat:@"GLINE %@ %@", m.nick, [Preferences IRCopDefaultGlineMessage]]];
}
if ([m.nick isEqualNoCase:u.myNick]) {
[u printDebugInformation:TXTFLS(@"SELF_BAN_DETECTED_MESSAGE", u.serverHostname) channel:c];
} else {
[u sendCommand:[NSString stringWithFormat:@"GLINE %@ %@", m.nick, [Preferences IRCopDefaultGlineMessage]]];
}
}

[self deselectMembers:sender];
}
Expand Down
10 changes: 10 additions & 0 deletions Classes/Dialogs/ChannelSheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ @implementation ChannelSheet
@synthesize contentView;
@synthesize generalView;
@synthesize encryptView;
@synthesize defaultsView;
@synthesize inlineImagesCheck;
@synthesize JPQActivityCheck;

- (id)init
{
Expand Down Expand Up @@ -60,6 +63,9 @@ - (void)onMenuBarItemChanged:(id)sender
case 1:
[self firstPane:encryptView];
break;
case 2:
[self firstPane:defaultsView];
break;
default:
[self firstPane:generalView];
break;
Expand Down Expand Up @@ -122,6 +128,8 @@ - (void)load
growlCheck.state = config.growl;
autoJoinCheck.state = config.autoJoin;
ihighlights.state = config.ihighlights;
JPQActivityCheck.state = config.iJPQActivity;
inlineImagesCheck.state = config.inlineImages;
}

- (void)save
Expand All @@ -135,6 +143,8 @@ - (void)save
config.growl = growlCheck.state;
config.autoJoin = autoJoinCheck.state;
config.ihighlights = ihighlights.state;
config.iJPQActivity = JPQActivityCheck.state;
config.inlineImages = inlineImagesCheck.state;

if ([config.name isChannelName] == NO) {
config.name = [@"#" stringByAppendingString:config.name];
Expand Down
22 changes: 22 additions & 0 deletions Classes/Dialogs/Preferences/PreferencesController.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ @implementation PreferencesController
@synthesize scriptsView;
@synthesize stylesView;
@synthesize themeButton;
@synthesize highlightNicknameButton;
@synthesize transcriptFolderButton;
@synthesize addExcludeWordButton;
@synthesize transfersView;
@synthesize updatesView;
@synthesize world;
Expand Down Expand Up @@ -107,6 +109,7 @@ - (void)show
[self.window makeKeyAndOrderFront:nil];

[self setUpToolbarItemsAndMenus];
[self onHighlightTypeChanged:nil];
[self firstPane:generalView selectedItem:0];
}

Expand Down Expand Up @@ -485,6 +488,25 @@ - (void)onChangedTransparency:(id)sender
#pragma mark -
#pragma mark Actions

- (void)onHighlightTypeChanged:(id)sender
{
if ([Preferences keywordMatchingMethod] == KEYWORD_MATCH_REGEX) {
[highlightNicknameButton setEnabled:NO];
[addExcludeWordButton setEnabled:YES];
[excludeWordsTable setEnabled:YES];
} else {
[highlightNicknameButton setEnabled:YES];

if ([Preferences keywordMatchingMethod] == KEYWORD_MATCH_PARTIAL) {
[addExcludeWordButton setEnabled:YES];
[excludeWordsTable setEnabled:YES];
} else {
[addExcludeWordButton setEnabled:NO];
[excludeWordsTable setEnabled:NO];
}
}
}

- (void)editTable:(NSTableView *)table
{
NSInteger row = ([table numberOfRows] - 1);
Expand Down
11 changes: 11 additions & 0 deletions Classes/Dialogs/Preferences/ScriptsWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ - (void)populateData;
[scripts safeAddObject:script];
}
}

resourceFiles = [_NSFileManager() contentsOfDirectoryAtPath:[Preferences whereScriptsLocalPath] error:NULL];

for (NSString *file in resourceFiles) {
NSArray *nameParts = [file componentsSeparatedByString:@"."];
NSString *script = [[nameParts stringAtIndex:0] lowercaseString];

if ([scripts containsObject:script] == NO) {
[scripts safeAddObject:script];
}
}

for (NSString *cmd in world.bundlesForUserInput) {
cmd = [cmd lowercaseString];
Expand Down
6 changes: 6 additions & 0 deletions Classes/Headers/ChannelSheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
IBOutlet NSView *contentView;
IBOutlet NSView *generalView;
IBOutlet NSView *encryptView;
IBOutlet NSView *defaultsView;

IBOutlet NSTextField *nameText;
IBOutlet NSTextField *passwordText;
Expand All @@ -24,13 +25,16 @@
IBOutlet NSButton *ihighlights;
IBOutlet NSButton *autoJoinCheck;
IBOutlet NSButton *growlCheck;
IBOutlet NSButton *inlineImagesCheck;
IBOutlet NSButton *JPQActivityCheck;
}

@property (nonatomic, assign) NSInteger uid;
@property (nonatomic, assign) NSInteger cid;
@property (nonatomic, retain) NSView *contentView;
@property (nonatomic, retain) NSView *generalView;
@property (nonatomic, retain) NSView *encryptView;
@property (nonatomic, retain) NSView *defaultsView;
@property (nonatomic, retain) IRCChannelConfig *config;
@property (nonatomic, retain) NSTextField *nameText;
@property (nonatomic, retain) NSTextField *passwordText;
Expand All @@ -41,6 +45,8 @@
@property (nonatomic, retain) NSButton *autoJoinCheck;
@property (nonatomic, retain) NSButton *ihighlights;
@property (nonatomic, retain) NSButton *growlCheck;
@property (nonatomic, retain) NSButton *inlineImagesCheck;
@property (nonatomic, retain) NSButton *JPQActivityCheck;

- (void)start;
- (void)show;
Expand Down
1 change: 0 additions & 1 deletion Classes/Headers/IRC.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
#define IRCCI_RAW @"RAW"
#define IRCCI_REJOIN @"REJOIN"
#define IRCCI_REMOVE @"REMOVE"
#define IRCCI_RESETFILES @"RESETFILES"
#define IRCCI_SEND @"SEND"
#define IRCCI_SERVER @"SERVER"
#define IRCCI_SHUN @"SHUN"
Expand Down
4 changes: 4 additions & 0 deletions Classes/Headers/IRCChannelConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ typedef enum {
BOOL growl;
BOOL autoJoin;
BOOL ihighlights;
BOOL inlineImages;
BOOL iJPQActivity;

NSString *mode;
NSString *topic;
Expand All @@ -29,6 +31,8 @@ typedef enum {
@property (nonatomic, assign) BOOL autoJoin;
@property (nonatomic, assign) BOOL growl;
@property (nonatomic, assign) BOOL ihighlights;
@property (nonatomic, assign) BOOL inlineImages;
@property (nonatomic, assign) BOOL iJPQActivity;
@property (nonatomic, retain) NSString *mode;
@property (nonatomic, retain) NSString *topic;
@property (nonatomic, retain) NSString *encryptionKey;
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions Classes/Headers/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// Modifications by Codeux Software <support AT codeux DOT com> <https://github.com/codeux/Textual>
// You can redistribute it and/or modify it under the new BSD license.

#define DEFAULT_TEXTUAL_STYLE @"user:Simplified Dark"
#define DEFAULT_TEXTUAL_STYLE @"resource:Simplified Dark"
#define DEFAULT_TEXTUAL_FONT @"Lucida Grande"

typedef enum {
KEYWORD_MATCH_PARTIAL = 0,
KEYWORD_MATCH_EXACT,
KEYWORD_MATCH_REGEX,
} KeywordMatchType;

typedef enum {
Expand Down Expand Up @@ -53,8 +54,6 @@ typedef enum {
+ (NSString *)applicationName;
+ (NSInteger)applicationProcessID;

+ (BOOL)forceReplaceExtensions;

+ (NSDictionary *)textualInfoPlist;
+ (NSDictionary *)systemInfoPlist;

Expand Down
6 changes: 6 additions & 0 deletions Classes/Headers/PreferencesController.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
IBOutlet NSView *IRCopServicesView;
IBOutlet NSView *channelManagementView;
IBOutlet NSView *experimentalSettingsView;

IBOutlet NSButton *highlightNicknameButton;
IBOutlet NSButton *addExcludeWordButton;

IBOutlet NSTableView *keywordsTable;
IBOutlet NSTableView *excludeWordsTable;
Expand Down Expand Up @@ -68,6 +71,8 @@
@property (nonatomic, retain) NSView *IRCopServicesView;
@property (nonatomic, retain) NSView *channelManagementView;
@property (nonatomic, retain) NSView *experimentalSettingsView;
@property (nonatomic, retain) NSButton *highlightNicknameButton;
@property (nonatomic, retain) NSButton *addExcludeWordButton;
@property (nonatomic, retain) NSTableView *keywordsTable;
@property (nonatomic, retain) NSTableView *excludeWordsTable;
@property (nonatomic, retain) NSTableView *installedScriptsTable;
Expand All @@ -86,6 +91,7 @@
- (void)onAddKeyword:(id)sender;
- (void)onAddExcludeWord:(id)sender;

- (void)onHighlightTypeChanged:(id)sender;
- (void)onSelectFont:(id)sender;
- (void)onStyleChanged:(id)sender;
- (void)onChangedTheme:(id)sender;
Expand Down
3 changes: 2 additions & 1 deletion Classes/Headers/StaticDefinitions.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Availability Macros */
#define _LOAD_MAC_OS_LION_LIBRARIES 0
#define _LOAD_MAC_OS_LION_LIBRARIES 1
//#define _USES_MODERN_REGULAR_EXPRESSION

#if _LOAD_MAC_OS_LION_LIBRARIES
#if defined(MAC_OS_X_VERSION_10_7)
Expand Down
17 changes: 13 additions & 4 deletions Classes/Helpers/NSBundleHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ + (void)deallocBundlesFromMemory:(IRCWorld *)world

+ (void)loadBundlesIntoMemory:(IRCWorld *)world
{
NSString *path = [Preferences wherePluginsPath];
NSString *path_1 = [Preferences wherePluginsPath];
NSString *path_2 = [Preferences wherePluginsLocalPath];

if (NSObjectIsNotEmpty(world.allLoadedBundles)) {
[self deallocBundlesFromMemory:world];
Expand All @@ -95,11 +96,19 @@ + (void)loadBundlesIntoMemory:(IRCWorld *)world
NSMutableDictionary *serverInputBundles = [NSMutableDictionary new];
NSMutableDictionary *outputRulesDict = [NSMutableDictionary new];

NSArray *resourceFiles = [_NSFileManager() contentsOfDirectoryAtPath:path error:NULL];

NSArray *resourceFiles_1 = [_NSFileManager() contentsOfDirectoryAtPath:path_1 error:NULL];
NSArray *resourceFiles_2 = [_NSFileManager() contentsOfDirectoryAtPath:path_2 error:NULL];

NSArray *resourceFiles = [resourceFiles_1 arrayByAddingObjectsFromArray:resourceFiles_2];

for (NSString *file in resourceFiles) {
if ([file hasSuffix:@".bundle"]) {
NSString *fullPath = [path stringByAppendingPathComponent:file];
NSString *fullPath = [path_2 stringByAppendingPathComponent:file];

if ([_NSFileManager() fileExistsAtPath:fullPath] == NO) {
fullPath = [path_1 stringByAppendingPathComponent:file];
}

NSBundle *currBundle = [NSBundle bundleWithPath:fullPath];

TextualPluginItem *plugin = [TextualPluginItem new];
Expand Down
2 changes: 1 addition & 1 deletion Classes/Helpers/NSStringHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ - (NSRange)rangeOfChannelNameStart:(NSInteger)start

NSString *shortstring = [self safeSubstringFromIndex:start];

NSRange rs = [TXRegularExpression string:shortstring rangeOfRegex:@"(#\\w\\w+)"];
NSRange rs = [TXRegularExpression string:shortstring rangeOfRegex:@"#([a-zA-Z0-9\\#\\-]+)"];
if (rs.location == NSNotFound) return NSMakeRange(NSNotFound, 0);
NSRange r = NSMakeRange((rs.location + start), rs.length);

Expand Down
8 changes: 8 additions & 0 deletions Classes/IRC/IRCChannelConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ @implementation IRCChannelConfig
@synthesize topic;
@synthesize ihighlights;
@synthesize encryptionKey;
@synthesize iJPQActivity;
@synthesize inlineImages;

- (id)init
{
if ((self = [super init])) {
type = CHANNEL_TYPE_CHANNEL;

inlineImages = NO;
iJPQActivity = NO;
ihighlights = NO;
autoJoin = YES;
growl = YES;
Expand All @@ -45,6 +49,8 @@ - (id)initWithDictionary:(NSDictionary *)dic
growl = [dic boolForKey:@"growl"];
autoJoin = [dic boolForKey:@"auto_join"];
ihighlights = [dic boolForKey:@"ignore_highlights"];
inlineImages = [dic boolForKey:@"disable_images"];
iJPQActivity = [dic boolForKey:@"ignore_join,leave"];

mode = (([[dic stringForKey:@"mode"] retain]) ?: NSNullObject);
topic = (([[dic stringForKey:@"topic"] retain]) ?: NSNullObject);
Expand Down Expand Up @@ -73,6 +79,8 @@ - (NSMutableDictionary *)dictionaryValue
[dic setBool:growl forKey:@"growl"];
[dic setBool:autoJoin forKey:@"auto_join"];
[dic setBool:ihighlights forKey:@"ignore_highlights"];
[dic setBool:inlineImages forKey:@"disable_images"];
[dic setBool:iJPQActivity forKey:@"ignore_join,leave"];

if (name) [dic setObject:name forKey:@"name"];
if (password) [dic setObject:password forKey:@"password"];
Expand Down
Loading

0 comments on commit e7e8897

Please sign in to comment.