GUAC-236: Add screen recording support to telnet.

This commit is contained in:
Michael Jumper 2016-03-14 20:26:31 -07:00
parent 570bcc3822
commit e3d1af1953
3 changed files with 71 additions and 0 deletions

View File

@ -46,6 +46,9 @@ const char* GUAC_TELNET_CLIENT_ARGS[] = {
"typescript-path",
"typescript-name",
"create-typescript-path",
"recording-path",
"recording-name",
"create-recording-path",
NULL
};
@ -120,6 +123,24 @@ enum TELNET_ARGS_IDX {
*/
IDX_CREATE_TYPESCRIPT_PATH,
/**
* The full absolute path to the directory in which screen recordings
* should be written.
*/
IDX_RECORDING_PATH,
/**
* The name that should be given to screen recording which are written in
* the given path.
*/
IDX_RECORDING_NAME,
/**
* Whether the specified screen recording path should automatically be
* created if it does not yet exist.
*/
IDX_CREATE_RECORDING_PATH,
TELNET_ARGS_COUNT
};
@ -239,6 +260,21 @@ guac_telnet_settings* guac_telnet_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_TELNET_CLIENT_ARGS, argv,
IDX_CREATE_TYPESCRIPT_PATH, false);
/* Read recording path */
settings->recording_path =
guac_user_parse_args_string(user, GUAC_TELNET_CLIENT_ARGS, argv,
IDX_RECORDING_PATH, NULL);
/* Read recording name */
settings->recording_name =
guac_user_parse_args_string(user, GUAC_TELNET_CLIENT_ARGS, argv,
IDX_RECORDING_NAME, GUAC_TELNET_DEFAULT_RECORDING_NAME);
/* Parse path creation flag */
settings->create_recording_path =
guac_user_parse_args_boolean(user, GUAC_TELNET_CLIENT_ARGS, argv,
IDX_CREATE_RECORDING_PATH, false);
/* Parsing was successful */
return settings;
@ -274,6 +310,10 @@ void guac_telnet_settings_free(guac_telnet_settings* settings) {
free(settings->typescript_name);
free(settings->typescript_path);
/* Free screen recording settings */
free(settings->recording_name);
free(settings->recording_path);
/* Free overall structure */
free(settings);

View File

@ -53,6 +53,11 @@
*/
#define GUAC_TELNET_DEFAULT_TYPESCRIPT_NAME "typescript"
/**
* The filename to use for the screen recording, if not specified.
*/
#define GUAC_TELNET_DEFAULT_RECORDING_NAME "recording"
/**
* The regular expression to use when searching for the username/login prompt
* if no other regular expression is specified.
@ -157,6 +162,23 @@ typedef struct guac_telnet_settings {
*/
bool create_typescript_path;
/**
* The path in which the screen recording should be saved, if enabled. If
* no screen recording should be saved, this will be NULL.
*/
char* recording_path;
/**
* The filename to use for the screen recording, if enabled.
*/
char* recording_name;
/**
* Whether the screen recording path should be automatically created if it
* does not already exist.
*/
bool create_recording_path;
} guac_telnet_settings;
/**

View File

@ -21,6 +21,7 @@
*/
#include "config.h"
#include "guac_recording.h"
#include "telnet.h"
#include "terminal.h"
@ -468,6 +469,14 @@ void* guac_telnet_client_thread(void* data) {
char buffer[8192];
int wait_result;
/* Set up screen recording, if requested */
if (settings->recording_path != NULL) {
guac_common_recording_create(client,
settings->recording_path,
settings->recording_name,
settings->create_recording_path);
}
/* Create terminal */
telnet_client->term = guac_terminal_create(client,
settings->font_name, settings->font_size,