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 = (); }; };
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>"; };
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
+ 1EE1E1D90D744BB8002999AD /* libssh2.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
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;
};
*/
#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