Skip to content

Commit

Permalink
Merge branch 'stewiem2000-cherry-picks' of git://github.com/tessus/ma…
Browse files Browse the repository at this point in the history
…cfusion2 into sierra
  • Loading branch information
ElDeveloper committed Oct 3, 2016
2 parents 032d272 + d20d7a9 commit 5939a50
Show file tree
Hide file tree
Showing 26 changed files with 1,442 additions and 7,028 deletions.
871 changes: 172 additions & 699 deletions FTPFS/ftpfsConfiguration.xib

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions MFCore/MFAdvancedViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ - (IBAction)chooseIcon:(id)sender {
[panel setAllowsMultipleSelection:NO];
[panel setAllowedFileTypes:[NSArray arrayWithObject: @"icns"]];
NSInteger returnValue = [panel runModal];
if (returnValue == NSOKButton && [[panel URLs] count] > 0) {
NSString *filename = [[[panel URLs] objectAtIndex:0] path];
if (returnValue == NSModalResponseOK && [[panel URLs] count] > 0) {
NSString *filename = [[panel URLs] objectAtIndex:0];
NSImage *iconImage = [[NSImage alloc] initWithContentsOfFile:filename];
if (iconImage) {
[(MFClientFS*)[self representedObject] setIconImage:iconImage];
Expand Down
13 changes: 6 additions & 7 deletions MFCore/MFClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ + (MFClient *)allocWithZone:(NSZone *)zone {
}

- (void)registerForGeneralNotifications {
NSDistributedNotificationCenter *dnc = [NSDistributedNotificationCenter defaultCenter];
[dnc addObserver:self selector:@selector(handleRecentsUpdatedNotification:) name:kMFRecentsUpdatedNotification object:kMFDNCObject];

NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(handleApplicationTerminatingNotification:) name:NSApplicationWillTerminateNotification object:nil];
}
Expand Down Expand Up @@ -291,10 +288,12 @@ OSStatus myKeychainCallback ( SecKeychainEvent keychainEvent,
// MFLogS(self, @"Keychain callback received event is %d", keychainEvent);
SecKeychainItemRef itemRef = info -> item;
NSString *uuid = mfsecUUIDForKeychainItemRef(itemRef);
MFClientFS *fs = [self filesystemWithUUID:uuid];
if (fs) {
// MFLogS(self, @"Updating secrets for fs %@ due to keychain change", fs);
[fs updateSecrets];
if (uuid) {
MFClientFS *fs = [self filesystemWithUUID:uuid];
if (fs) {
//MFLogS(self, @"Updating secrets for fs %@ due to keychain change", fs);
[fs updateSecrets];
}
}
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion MFCore/MFClientFS.m
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ - (NSImage*)coloredImage {
CGImageGetBitsPerComponent( cgImageOriginalRep ),
CGImageGetBytesPerRow( cgImageOriginalRep ),
CGImageGetColorSpace( cgImageOriginalRep ),
kCGImageAlphaPremultipliedLast );
(CGBitmapInfo)kCGImageAlphaPremultipliedLast );

CGContextSetInterpolationQuality( context, kCGInterpolationHigh );

Expand Down
2 changes: 1 addition & 1 deletion MFCore/MFClientFSDelegateProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

@class MFClientFS;

@protocol MFClientFSDelegateProtocol <NSObject>
@protocol MFClientFSDelegateProtocol <NSFileManagerDelegate>
- (void)filesystemDidChangeStatus:(MFClientFS *)fs;
@end
1 change: 0 additions & 1 deletion MFCore/MFConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#define kMFStatusChangedNotification @"org.mgorbach.macfusion.notifications.statusChanged"
#define kMFFilesystemAddedNotification @"org.mgorbach.macfusion.notifications.fsAdded"
#define kMFFilesystemRemovedNotification @"org.mgorbach.macfusion.notifications.fsRemoved"
#define kMFRecentsUpdatedNotification @"org.mgorbach.macfusion.notifications.recentsUpdated"

// Client Notifications (Non-distributed)
#define kMFClientFSMountedNotification @"org.mgorbach.macfusion.mfclient.fsMounted"
Expand Down
1 change: 0 additions & 1 deletion MFCore/MFFilesystemController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

@interface MFFilesystemController ()
- (void)setUpVolumeMonitoring;
- (void)removeFilesystem:(MFServerFS *)fs;
- (void)loadRecentFilesystems;
- (void)recordRecentFilesystem:(MFServerFS *)fs;
- (void)addMountedPath:(NSString *)path;
Expand Down
2 changes: 1 addition & 1 deletion MFCore/MFLogViewerTableCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

@interface MFLogViewerTableCell : NSCell {
NSDateFormatter* _formatter;
NSMutableDictionary* _heightCache;
NSMapTable* _heightCache;
}

- (CGFloat)heightForCellInWidth:(CGFloat)width;
Expand Down
2 changes: 1 addition & 1 deletion MFCore/MFLogging.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ - (void)setupLogFile {

NSDictionary *dictFromASLMessage(aslmsg m) {
NSMutableDictionary *messageDict = [NSMutableDictionary dictionary];
NSInteger i;
uint32_t i;
const char *key;
const char *val;
for (i = 0; (NULL != (key = asl_key(m, i))); i++) {
Expand Down
2 changes: 1 addition & 1 deletion MFCore/MFMainController.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#import <Cocoa/Cocoa.h>

@interface MFMainController : NSObject {
@interface MFMainController : NSObject <NSFileManagerDelegate> {
}

+ (MFMainController *)sharedController;
Expand Down
31 changes: 17 additions & 14 deletions MFCore/MFSecurity.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
void *passwordData;
NSString *serviceName = serviceNameForFS(fs);
OSStatus error = SecKeychainFindGenericPassword(NULL,
[serviceName lengthOfBytesUsingEncoding: NSUTF8StringEncoding],
(uint32_t)[serviceName lengthOfBytesUsingEncoding: NSUTF8StringEncoding],
[serviceName UTF8String],
[fs.uuid lengthOfBytesUsingEncoding: NSUTF8StringEncoding],
(uint32_t)[fs.uuid lengthOfBytesUsingEncoding: NSUTF8StringEncoding],
[fs.uuid UTF8String],
&passwordLength,
&passwordData,
Expand Down Expand Up @@ -74,7 +74,7 @@
NSString *passwordToReturn = nil;

if (userName && hostName && port && protocol) {
OSStatus error = SecKeychainFindInternetPassword(NULL,[hostName lengthOfBytesUsingEncoding: NSUTF8StringEncoding],[hostName UTF8String],0,NULL,[userName lengthOfBytesUsingEncoding: NSUTF8StringEncoding],[userName UTF8String],0,NULL,port,protocol,(SecAuthenticationType)NULL,&passwordLength,&passwordData,itemRef);
OSStatus error = SecKeychainFindInternetPassword(NULL, (uint32_t)[hostName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], [hostName UTF8String],0,NULL,(uint32_t)[userName lengthOfBytesUsingEncoding: NSUTF8StringEncoding],[userName UTF8String],0,NULL,port,protocol,(SecAuthenticationType)NULL,&passwordLength,&passwordData,itemRef);
if (error == noErr) {
// MFLogS(self, @"Successfully found internet password for fs %@", fs);
NSString *password = [NSString stringWithCString:passwordData encoding:NSUTF8StringEncoding];
Expand Down Expand Up @@ -171,7 +171,7 @@ void setNetworkSecretsForFilesystem (NSDictionary* secretsDictionary, MFFilesyst
}

// Modify
OSStatus error = SecKeychainItemModifyContent(itemRef,NULL,[password lengthOfBytesUsingEncoding: NSUTF8StringEncoding],[password UTF8String]);
OSStatus error = SecKeychainItemModifyContent(itemRef,NULL,(uint32_t)[password lengthOfBytesUsingEncoding: NSUTF8StringEncoding],[password UTF8String]);
if (error == noErr) {
// MFLogS(self, @"Successfully modified network secrets for fs %@", fs );
} else {
Expand All @@ -181,9 +181,9 @@ void setNetworkSecretsForFilesystem (NSDictionary* secretsDictionary, MFFilesyst
} else {
// Create
SecKeychainAttribute attrs[] = {
{ kSecLabelItemAttr, [hostName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char *)[hostName UTF8String] },
{ kSecAccountItemAttr, [userName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char *)[userName UTF8String] },
{ kSecServerItemAttr, [hostName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char *)[hostName UTF8String] },
{ kSecLabelItemAttr, (uint32_t)[hostName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char *)[hostName UTF8String] },
{ kSecAccountItemAttr, (uint32_t)[userName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char *)[userName UTF8String] },
{ kSecServerItemAttr, (uint32_t)[hostName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char *)[hostName UTF8String] },
{ kSecPortItemAttr, sizeof(int), (int *)&port },
{ kSecProtocolItemAttr, sizeof(SecProtocolType), (SecProtocolType *)&protocol }
};
Expand All @@ -196,7 +196,7 @@ void setNetworkSecretsForFilesystem (NSDictionary* secretsDictionary, MFFilesyst
SecItemClass itemClass = kSecInternetPasswordItemClass;
OSStatus error = SecKeychainItemCreateFromContent(itemClass,
&attributes,
[password lengthOfBytesUsingEncoding:NSUTF8StringEncoding],
(uint32_t)[password lengthOfBytesUsingEncoding:NSUTF8StringEncoding],
[password UTF8String],
NULL,
accessRef,
Expand Down Expand Up @@ -249,7 +249,7 @@ void setGenericSecretsForFilesystem(NSDictionary* secretsDictionary, MFFilesyste
// Modify
OSErr result = SecKeychainItemModifyContent(itemRef,
NULL,
[secretsData length],
(uint32_t)[secretsData length],
[secretsData bytes]);
if (result == noErr) {
// MFLogSO(self, fs, @"Generic keychain data updated succesfully fs %@", fs);
Expand All @@ -268,9 +268,9 @@ void setGenericSecretsForFilesystem(NSDictionary* secretsDictionary, MFFilesyste
}

SecKeychainAttribute attrs[] = {
{ kSecLabelItemAttr, [serviceName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char*)[serviceName UTF8String] },
{ kSecAccountItemAttr, [fs.uuid lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char*)[fs.uuid UTF8String] },
{ kSecServiceItemAttr, [serviceName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char*)[serviceName UTF8String] }
{ kSecLabelItemAttr, (uint32_t)[serviceName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char*)[serviceName UTF8String] },
{ kSecAccountItemAttr, (uint32_t)[fs.uuid lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char*)[fs.uuid UTF8String] },
{ kSecServiceItemAttr, (uint32_t)[serviceName lengthOfBytesUsingEncoding: NSUTF8StringEncoding], (char*)[serviceName UTF8String] }
};

SecKeychainAttributeList attributes = {
Expand All @@ -279,7 +279,7 @@ void setGenericSecretsForFilesystem(NSDictionary* secretsDictionary, MFFilesyste

OSErr result = SecKeychainItemCreateFromContent(itemClass,
&attributes,
[secretsData length],
(uint32_t)[secretsData length],
[secretsData bytes],
NULL,
accessRef,
Expand Down Expand Up @@ -346,7 +346,7 @@ SInt32 showDialogForPasswordQuery(MFFilesystem* fs, BOOL* savePassword, NSString
};


NSString* iconURL = [NSURL fileURLWithPath: fs.iconPath];
NSString* iconURL = [[NSURL fileURLWithPath: fs.iconPath] absoluteString];
NSString* userName = [[fs parameters] objectForKey: kNetFSUserParameter];
NSString* host = [[fs parameters] objectForKey: kNetFSHostParameter];
NSString* dialogText = [NSString stringWithFormat: @"Please enter network password for host %@ user %@",host, userName];
Expand Down Expand Up @@ -442,6 +442,9 @@ SInt32 showDialogForPasswordQuery(MFFilesystem* fs, BOOL* savePassword, NSString

SecKeychainItemCopyAttributesAndData(itemRef, &attrInfo, NULL, &attrList, NULL, NULL);
// MFLogS(self, @"Loaded %d attrs", attrList->count);
if(!attrList || !attrList->attr) {
return Nil;
}
attr = attrList -> attr;
NSString *uuid = [NSString stringWithCString:attr->data encoding:NSUTF8StringEncoding];
SecKeychainItemFreeAttributesAndData(attrList, NULL);
Expand Down
2 changes: 0 additions & 2 deletions MFCore/MGNSImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#import <QuartzCore/QuartzCore.h>

static CGColorRef CGColorCreateFromNSColor (CGColorSpaceRef colorSpace, NSColor *color);

@class CIImage;

@interface NSImage (MGNSImage)
Expand Down
42 changes: 0 additions & 42 deletions MFCore/MGTransitioningTabView.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ - (id)initWithFrame:(NSRect)frame
return self;
}

static void ClearBitmapImageRep(NSBitmapImageRep *bitmap) {
unsigned char *bitmapData = [bitmap bitmapData];
if (bitmapData != NULL) {
// A fast alternative to filling with [NSColor clearColor].
bzero(bitmapData, [bitmap bytesPerRow] * [bitmap pixelsHigh]);
}
}

- (void)addTabViewItem:(NSTabViewItem*)item {
[_viewDimensions setObject: [NSValue valueWithSize:[[item view] frame].size] forKey:[item label]];
[super addTabViewItem:item];
Expand All @@ -63,40 +55,6 @@ - (void)selectTabViewItem:(NSTabViewItem *)tabViewItem {
[super selectTabViewItem:tabViewItem];
NSSize newViewSize = [[_viewDimensions objectForKey:[tabViewItem label]] sizeValue];
[[tabViewItem view] setFrameSize: newViewSize];

/*
if ([self selectedTabViewItem] == nil || [self isHiddenOrHasHiddenAncestor])
{
[super selectTabViewItem: tabViewItem];
return;
}
NSView* initialView = [[self selectedTabViewItem] view];
NSView* finalView = [tabViewItem view];
NSRect rect = NSUnionRect([initialView bounds], [finalView bounds]);
imageRect = NSUnionRect([initialView frame], [finalView frame]);
// MFLogS(self, @"imageRect %@ rect %@", NSStringFromRect( imageRect ), NSStringFromRect( rect) );
NSBitmapImageRep* initialContentBitmap = [initialView bitmapImageRepForCachingDisplayInRect:rect];
ClearBitmapImageRep(initialContentBitmap);
[initialView cacheDisplayInRect:rect toBitmapImageRep:initialContentBitmap];
[super selectTabViewItem: tabViewItem];
NSBitmapImageRep* finalContentBitmap = [finalView bitmapImageRepForCachingDisplayInRect:rect];
ClearBitmapImageRep(finalContentBitmap);
[finalView cacheDisplayInRect:rect toBitmapImageRep:finalContentBitmap];
CIImage* initialCIImage = [[CIImage alloc] initWithBitmapImageRep:initialContentBitmap];
CIImage* finalCIImage = [[CIImage alloc] initWithBitmapImageRep:finalContentBitmap];
[self setTransitionForinitialCIImage:initialCIImage finalCIImage:finalCIImage];
animation = [[TabViewAnimation alloc] initWithDuration: .5 animationCurve:NSAnimationEaseInOut];
[animation setDelegate: self];
[finalView setHidden: YES];
// [animation startAnimation];
[finalView setHidden: NO];
animation = nil;
*/;
}

- (NSSize)sizeWithTabviewItem:(NSTabViewItem *)item {
Expand Down
8 changes: 4 additions & 4 deletions MacFusion2.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
MACOSX_DEPLOYMENT_TARGET = 10.9;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
};
Expand Down Expand Up @@ -1771,7 +1771,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
Expand Down Expand Up @@ -2055,7 +2055,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
Expand Down Expand Up @@ -2663,7 +2663,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
Expand Down
21 changes: 13 additions & 8 deletions Menuling/MFQuickMountController.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ - (IBAction)quickMount:(id)sender {

NSURL *url = [NSURL URLWithString:[qmTextField stringValue]];
if (!url || ![url scheme] || ![url host]) {
NSAlert *alert = [NSAlert alertWithMessageText: @"Could not parse URL" defaultButton:@"OK" alternateButton:@""otherButton:@"" informativeTextWithFormat:@"Please check the format"];
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Could not parse URL"];
[alert setInformativeText:@"Please check the format"];
[alert setAlertStyle:NSCriticalAlertStyle];
[alert beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:nil contextInfo:nil];
[alert runModal];
} else {
NSError *error;
MFClientFS *tempFS = [[MFClient sharedClient] quickMountFilesystemWithURL:url error:&error];
Expand Down Expand Up @@ -90,13 +92,16 @@ - (void)filesystemDidChangeStatus:(MFClientFS *)filesystem {
}

[indicator stopAnimation:self];
NSAlert* alert = [NSAlert alertWithMessageText:@"Failed to Mount Filesystem"
defaultButton:@"OK"
alternateButton:@""
otherButton:@""
informativeTextWithFormat:@"No error was given"];
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Failed to mount Filesystem"];
[alert setInformativeText:@"No error was given"];
[alert setAlertStyle:NSCriticalAlertStyle];
[alert beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:(__bridge void *)(self)];
[alert beginSheetModalForWindow:[self window] completionHandler:^(NSInteger returnCode) {
// Block version of alertDidEnd
[indicator stopAnimation:self];
[indicator setHidden:YES];
[connectButton setHidden:NO];
}];
}
}

Expand Down
Loading

0 comments on commit 5939a50

Please sign in to comment.