From: Robert Sesek Date: Tue, 26 Feb 2008 13:36:09 +0000 (-0500) Subject: After much work, we can now link to libssh2.a X-Git-Tag: 1.0-b1~15 X-Git-Url: https://src.bluestatic.org/?a=commitdiff_plain;h=68f9343a65fc6ddaac1cb5c763be1990c7a78e38;p=printdrop.git After much work, we can now link to libssh2.a --- diff --git a/PrintDrop.xcodeproj/project.pbxproj b/PrintDrop.xcodeproj/project.pbxproj index e447f66..1eb4901 100644 --- a/PrintDrop.xcodeproj/project.pbxproj +++ b/PrintDrop.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 1E1624F30D736C500067F3B4 /* GradientBackView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E1624F20D736C500067F3B4 /* GradientBackView.m */; }; 1E1625410D736EF20067F3B4 /* DraggableImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E1625400D736EF20067F3B4 /* DraggableImageView.m */; }; 1E1626560D7388110067F3B4 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E1626550D7388110067F3B4 /* AppController.m */; }; + 1EE1E1D90D744BB8002999AD /* libssh2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EE1E1D80D744BB8002999AD /* libssh2.a */; }; 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; @@ -26,6 +27,7 @@ 1E1625400D736EF20067F3B4 /* DraggableImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DraggableImageView.m; path = Source/DraggableImageView.m; sourceTree = ""; }; 1E1626540D7388110067F3B4 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppController.h; path = Source/AppController.h; sourceTree = ""; }; 1E1626550D7388110067F3B4 /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppController.m; path = Source/AppController.m; sourceTree = ""; }; + 1EE1E1D80D744BB8002999AD /* libssh2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssh2.a; path = libssh2/lib/libssh2.a; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; @@ -41,6 +43,7 @@ buildActionMask = 2147483647; files = ( 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 1EE1E1D90D744BB8002999AD /* libssh2.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -63,6 +66,7 @@ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( + 1EE1E1D80D744BB8002999AD /* libssh2.a */, 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, ); name = "Linked Frameworks"; @@ -220,8 +224,18 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = PrintDrop_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/libssh2/include\""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/libssh2/lib\"", + ); + OTHER_LDFLAGS = ( + "-undefined", + suppress, + "-force_flat_namespace", + ); PRODUCT_NAME = PrintDrop; WRAPPER_EXTENSION = app; ZERO_LINK = YES; @@ -235,8 +249,18 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = PrintDrop_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/libssh2/include\""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/libssh2/lib\"", + ); + OTHER_LDFLAGS = ( + "-undefined", + suppress, + "-force_flat_namespace", + ); PRODUCT_NAME = PrintDrop; WRAPPER_EXTENSION = app; }; diff --git a/Source/AppController.m b/Source/AppController.m index 564dc04..a6f9940 100644 --- a/Source/AppController.m +++ b/Source/AppController.m @@ -15,6 +15,17 @@ */ #import "AppController.h" +#import +#import +#import +#import + +@interface AppController (Private) + +//- (BOOL)uploadFile; +- (void)setStatus:(NSString *)msg isError:(BOOL)error; + +@end @implementation AppController @@ -44,14 +55,53 @@ return self; } +/** + * Sets the status text + */ +- (void)setStatus:(NSString *)msg isError:(BOOL)error +{ + [status setStringValue:msg]; + if (error) + { + [status setTextColor:[NSColor redColor]]; + [progress stopAnimation:self]; + } + else + { + [status setTextColor:[NSColor blackColor]]; + } +} + /** * Sends an item to the printer */ - (IBAction)print:(id)sender { + [progress startAnimation:self]; + [progress setHidden:NO]; + [status setHidden:NO]; + NSString *printer = [[printersController selection] valueForKey:@"unixName"]; NSLog(@"printer = %@", printer); + LIBSSH2_SESSION *ssh = libssh2_session_init(); + if (ssh == NULL) + { + return [self setStatus:@"Failed to initialize SSH context" isError:YES]; + } + + struct sockaddr_in sin; + int sock = socket(AF_INET, SOCK_STREAM, 0); + sin.sin_port = htons(22); + in_addr_t t = inet_addr("acs.bu.edu"); + sin.sin_addr.s_addr = inet_addr("acs.bu.edu"); + sin.sin_family = AF_INET; + if (connect(sock, (struct sockaddr *)(&sin), sizeof(struct sockaddr_in)) != 0) + { + return [self setStatus:@"Could not connect to acs.bu.edu" isError:YES]; + } + + close(sock); } @end diff --git a/libssh2/lib/libssh2.a b/libssh2/lib/libssh2.a index b2be511..1235448 100644 Binary files a/libssh2/lib/libssh2.a and b/libssh2/lib/libssh2.a differ