After much work, we can now link to libssh2.a
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 26 Feb 2008 13:36:09 +0000 (08:36 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 26 Feb 2008 13:36:09 +0000 (08:36 -0500)
PrintDrop.xcodeproj/project.pbxproj
Source/AppController.m
libssh2/lib/libssh2.a

index e447f66959fdea903c4bbb87f3a47fcfe97c1692..1eb490171c26d29df80e4e5e9d7416819cf96421 100644 (file)
@@ -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 = "<group>"; };
                1E1626540D7388110067F3B4 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppController.h; path = Source/AppController.h; sourceTree = "<group>"; };
                1E1626550D7388110067F3B4 /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppController.m; path = Source/AppController.m; sourceTree = "<group>"; };
+               1EE1E1D80D744BB8002999AD /* libssh2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssh2.a; path = libssh2/lib/libssh2.a; sourceTree = "<group>"; };
                29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
                29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
                29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
@@ -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";
                                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;
                                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;
                        };
index 564dc040e6ce4dd508b5e0d7769c45ede63f910a..a6f9940a053a849eb52200bc082476e0d3b1680d 100644 (file)
  */
 
 #import "AppController.h"
+#import <libssh2.h>
+#import <libssh2_sftp.h>
+#import <sys/socket.h>
+#import <arpa/inet.h>
+
+@interface AppController (Private)
+
+//- (BOOL)uploadFile;
+- (void)setStatus:(NSString *)msg isError:(BOOL)error;
+
+@end
 
 
 @implementation AppController
        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
index b2be511ffae6be00eccf0cf843e308f89078d079..1235448aeeb4a281bb588f5b4dd8d4280d15b426 100644 (file)
Binary files a/libssh2/lib/libssh2.a and b/libssh2/lib/libssh2.a differ