From 65ec94ea86357c1c300a7cf5de63e57d11325cc2 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 26 Feb 2008 11:48:55 -0500 Subject: [PATCH] Renaming the uploaded PDF and we now delete it at the end --- Source/AppController.m | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/AppController.m b/Source/AppController.m index feaafda..0a0aaf9 100644 --- a/Source/AppController.m +++ b/Source/AppController.m @@ -136,10 +136,10 @@ [self setStatus:@"Bad username/password" isError:YES]; goto shutdown; } - /* + stat([[dragRegion filePath] UTF8String], &fileInfo); - LIBSSH2_CHANNEL *channel = libssh2_scp_send(ssh, "~/tempupload.pdf", 0755, (unsigned long)fileInfo.st_size); + LIBSSH2_CHANNEL *channel = libssh2_scp_send(ssh, "~/__bu_print_drop__.pdf", 0755, (unsigned long)fileInfo.st_size); if (!channel) { [self setStatus:@"Unable to open upload SCP session" isError:YES]; @@ -177,9 +177,8 @@ libssh2_channel_wait_closed(channel); libssh2_channel_free(channel); channel = NULL; - */ - LIBSSH2_CHANNEL *channel = libssh2_channel_open_session(ssh); + channel = libssh2_channel_open_session(ssh); if (!channel) { [self setStatus:@"Could not open SSH channel for printing" isError:YES]; @@ -203,7 +202,13 @@ // read the banner [self readChannel:channel]; - char *cmd = "touch /u17/ugrad/rsesek/temp.foo\r\n\0"; + // send the job to lpr + char *cmd = (char *)[[NSString stringWithFormat:@"touch ~/print-%@.drop\r\n\0", printer] UTF8String]; + libssh2_channel_write(channel, cmd, sizeof(char) * strlen(cmd)); + [self readChannel:channel]; + + // remove our temp file + cmd = "rm -f __bu_print_drop__.pdf\r\n\0"; libssh2_channel_write(channel, cmd, sizeof(char) * strlen(cmd)); [self readChannel:channel]; -- 2.43.5