Skip to content

Commit

Permalink
Fix a few bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
emsquared committed Jun 25, 2012
1 parent 33e54a7 commit b2f6333
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 48 deletions.
52 changes: 29 additions & 23 deletions Classes/Controllers/TXMasterController.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ - (void)applicationDidChangeScreenParameters:(NSNotification *)aNotification
if (visibleRect.size.width < windowRect.size.width) {
windowRect.size.width = visibleRect.size.width;
}

windowRect.origin = visibleRect.origin;

[self.window setFrame:windowRect display:NO];
}
}
Expand Down Expand Up @@ -795,29 +795,35 @@ - (void)completeNick:(BOOL)forward
}
}

NSArray *scriptPaths = [NSArray arrayWithObjects:

#ifdef TXUserScriptsFolderAvailable
[TPCPreferences whereScriptsUnsupervisedPath],
NSArray *scriptPaths = @[
NSStringNilValueSubstitute([TPCPreferences whereScriptsLocalPath]),
NSStringNilValueSubstitute([TPCPreferences whereScriptsPath]),
NSStringNilValueSubstitute([TPCPreferences whereScriptsUnsupervisedPath])
];
#else
NSArray *scriptPaths = @[
NSStringNilValueSubstitute([TPCPreferences whereScriptsLocalPath]),
NSStringNilValueSubstitute([TPCPreferences whereScriptsPath])
];
#endif

[TPCPreferences whereScriptsLocalPath],
[TPCPreferences whereScriptsPath], nil];

for (NSString *path in scriptPaths) {
NSArray *resourceFiles = [_NSFileManager() contentsOfDirectoryAtPath:path error:NULL];

if (NSObjectIsNotEmpty(resourceFiles)) {
for (NSString *file in resourceFiles) {
if ([file hasPrefix:@"."] || [file hasSuffix:@".rtf"]) {
continue;
}

NSArray *parts = [NSArray arrayWithArray:[file componentsSeparatedByString:@"."]];
NSString *cmdl = [[parts stringAtIndex:0] lowercaseString];

if ([choices containsObject:cmdl] == NO) {
[choices safeAddObject:cmdl];
if (NSObjectIsNotEmpty(path)) {
NSArray *resourceFiles = [_NSFileManager() contentsOfDirectoryAtPath:path error:NULL];

if (NSObjectIsNotEmpty(resourceFiles)) {
for (NSString *file in resourceFiles) {
if ([file hasPrefix:@"."] || [file hasSuffix:@".rtf"]) {
continue;
}

NSArray *parts = [NSArray arrayWithArray:[file componentsSeparatedByString:@"."]];
NSString *cmdl = [[parts stringAtIndex:0] lowercaseString];

if ([choices containsObject:cmdl] == NO) {
[choices safeAddObject:cmdl];
}
}
}
}
Expand Down Expand Up @@ -1375,8 +1381,8 @@ - (void)welcomeSheet:(TDCWelcomeSheet *)sender onOK:(NSDictionary *)config
for (NSString *s in config[@"channelList"]) {
if ([s isChannelName]) {
[channels safeAddObject:@{@"channelName": s,
@"joinOnConnect": NSNumberWithBOOL(YES),
@"enableNotifications": NSNumberWithBOOL(YES)}];
@"joinOnConnect": NSNumberWithBOOL(YES),
@"enableNotifications": NSNumberWithBOOL(YES)}];
}
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/Dialogs/Preferences/TDCPreferencesController.m
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ - (void)onHighlightLoggingChanged:(id)sender

- (void)onDownloadExtraAddons:(id)sender
{
NSString *version = @"No Sandbox";
NSString *version = @"No%20Sandbox";

if ([TPCPreferences featureAvailableToOSXLion]) {
if ([TPCPreferences sandboxEnabled]) {
Expand All @@ -650,7 +650,7 @@ - (void)onDownloadExtraAddons:(id)sender

if ([TPCPreferences featureAvailableToOSXMountainLion]) {
if ([TPCPreferences sandboxEnabled]) {
version = @"Mountain Lion";
version = @"Mountain%20Lion";
}
}

Expand Down
20 changes: 14 additions & 6 deletions Classes/Dialogs/Preferences/TDCPreferencesScriptWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,24 @@ - (id)init

- (void)populateData;
{
NSArray *scriptPaths = [NSArray arrayWithObjects:

#ifdef TXUserScriptsFolderAvailable
[TPCPreferences whereScriptsUnsupervisedPath],
NSArray *scriptPaths = @[
NSStringNilValueSubstitute([TPCPreferences whereScriptsLocalPath]),
NSStringNilValueSubstitute([TPCPreferences whereScriptsPath]),
NSStringNilValueSubstitute([TPCPreferences whereScriptsUnsupervisedPath])
];
#else
NSArray *scriptPaths = @[
NSStringNilValueSubstitute([TPCPreferences whereScriptsLocalPath]),
NSStringNilValueSubstitute([TPCPreferences whereScriptsPath])
];
#endif

[TPCPreferences whereScriptsLocalPath],
[TPCPreferences whereScriptsPath], nil];

for (NSString *path in scriptPaths) {
if (NSObjectIsEmpty(path)) {
continue;
}

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

if (NSObjectIsNotEmpty(resourceFiles)) {
Expand Down
21 changes: 15 additions & 6 deletions Classes/IRC/IRCClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -2670,20 +2670,29 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString
NSString *command = [cmd lowercaseString];

NSArray *extensions = @[@".scpt", @".py", @".pyc", @".rb", @".pl", @".sh", @".bash", @""];
NSArray *scriptPaths = [NSArray arrayWithObjects:


#ifdef TXUserScriptsFolderAvailable
[TPCPreferences whereScriptsUnsupervisedPath],
NSArray *scriptPaths = @[
NSStringNilValueSubstitute([TPCPreferences whereScriptsLocalPath]),
NSStringNilValueSubstitute([TPCPreferences whereScriptsPath]),
NSStringNilValueSubstitute([TPCPreferences whereScriptsUnsupervisedPath])
];
#else
NSArray *scriptPaths = @[
NSStringNilValueSubstitute([TPCPreferences whereScriptsLocalPath]),
NSStringNilValueSubstitute([TPCPreferences whereScriptsPath])
];
#endif

[TPCPreferences whereScriptsLocalPath],
[TPCPreferences whereScriptsPath], nil];

NSString *scriptPath = [NSString string];

BOOL scriptFound = NO;

for (NSString *path in scriptPaths) {
if (NSObjectIsEmpty(path)) {
continue;
}

if (scriptFound == YES) {
break;
}
Expand Down
6 changes: 3 additions & 3 deletions Classes/IRC/IRCClientConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ - (NSMutableDictionary *)dictionaryValue

[floodControl setBool:self.outgoingFloodControl forKey:@"serviceEnabled"];

dic[@"floodControl"] = floodControl;
[dic safeSetObject:floodControl forKey:@"floodControl"];

NSMutableArray *channelAry = [NSMutableArray array];
NSMutableArray *ignoreAry = [NSMutableArray array];
Expand All @@ -298,8 +298,8 @@ - (NSMutableDictionary *)dictionaryValue
[ignoreAry safeAddObject:[e dictionaryValue]];
}

dic[@"channelList"] = channelAry;
dic[@"ignoreList"] = ignoreAry;
[dic safeSetObject:channelAry forKey:@"channelList"];
[dic safeSetObject:ignoreAry forKey:@"ignoreList"];

[dic safeSetObject:TPCPreferencesMigrationAssistantUpgradePath
forKey:TPCPreferencesMigrationAssistantVersionKey];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ + (NSDictionary *)convertIRCClientConfiguration:(NSDictionary *)config

[floodControl setBool:[floodControl boolForKey:@"outgoing"] forKey:@"serviceEnabled"];

nconfig[@"floodControl"] = floodControl;
[nconfig safeSetObject:floodControl forKey:@"floodControl"];

nconfig[@"channelList"] = config[@"channels"];
nconfig[@"ignoreList"] = config[@"ignores"];
[nconfig safeSetObject:config[@"channels"] forKey:@"channelList"];
[nconfig safeSetObject:config[@"ignores"] forKey:@"ignoreList"];

[nconfig safeSetObject:TPCPreferencesMigrationAssistantUpgradePath
forKey:TPCPreferencesMigrationAssistantVersionKey];
Expand Down
2 changes: 1 addition & 1 deletion Classes/Preferences/TPCPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ + (NSString *)whereScriptsPath
if ([_NSFileManager() fileExistsAtPath:dest] == NO) {
[_NSFileManager() createDirectoryAtPath:dest withIntermediateDirectories:YES attributes:nil error:NULL];
}

return dest;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "NO"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "NO"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
Expand Down
4 changes: 2 additions & 2 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>TXBundleBuildNumber</key>
<string>11443</string>
<string>11450</string>
<key>TXBundleBuildReference</key>
<string>2.1.1-184-g7c58e71-appstore,llvm4.0</string>
<string>2.1.1-186-g33e54a7-stdbuild,nosndbox,llvm4.0</string>
</dict>
</plist>
2 changes: 2 additions & 0 deletions Textual.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.bookmarks.app-scope</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.temporary-exception.files.home-relative-path.read-write</key>
Expand Down

0 comments on commit b2f6333

Please sign in to comment.