GUAC-614: Migrate SSH to simpler stream API.
This commit is contained in:
parent
18407fdc37
commit
83093f1bd3
@ -24,6 +24,7 @@
|
||||
|
||||
#include "blank.h"
|
||||
#include "client.h"
|
||||
#include "clipboard.h"
|
||||
#include "guac_handlers.h"
|
||||
#include "ibar.h"
|
||||
#include "ssh_client.h"
|
||||
@ -202,11 +203,11 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||
|
||||
/* Set basic handlers */
|
||||
client->handle_messages = ssh_guac_client_handle_messages;
|
||||
client->clipboard_handler = ssh_guac_client_clipboard_handler;
|
||||
client->key_handler = ssh_guac_client_key_handler;
|
||||
client->mouse_handler = ssh_guac_client_mouse_handler;
|
||||
client->size_handler = ssh_guac_client_size_handler;
|
||||
client->free_handler = ssh_guac_client_free_handler;
|
||||
client->clipboard_handler = guac_ssh_clipboard_handler;
|
||||
|
||||
/* Start client thread */
|
||||
if (pthread_create(&(client_data->client_thread), NULL, ssh_client_thread, (void*) client)) {
|
||||
|
@ -33,6 +33,10 @@ int guac_ssh_clipboard_handler(guac_client* client, guac_stream* stream,
|
||||
ssh_guac_client_data* client_data = (ssh_guac_client_data*) client->data;
|
||||
guac_common_clipboard_reset(client_data->clipboard, mimetype);
|
||||
|
||||
/* Set handlers for clipboard stream */
|
||||
stream->blob_handler = guac_ssh_clipboard_blob_handler;
|
||||
stream->end_handler = guac_ssh_clipboard_end_handler;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -103,10 +103,6 @@ int ssh_guac_client_handle_messages(guac_client* client) {
|
||||
|
||||
}
|
||||
|
||||
int ssh_guac_client_clipboard_handler(guac_client* client, guac_stream* stream, char* mimetype) {
|
||||
return guac_ssh_clipboard_handler(client, stream, mimetype);
|
||||
}
|
||||
|
||||
int ssh_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
|
||||
|
||||
ssh_guac_client_data* client_data = (ssh_guac_client_data*) client->data;
|
||||
|
@ -128,6 +128,10 @@ int guac_sftp_file_handler(guac_client* client, guac_stream* stream,
|
||||
guac_socket_flush(client->socket);
|
||||
}
|
||||
|
||||
/* Set handlers for file stream */
|
||||
stream->blob_handler = guac_sftp_blob_handler;
|
||||
stream->end_handler = guac_sftp_end_handler;
|
||||
|
||||
/* Store file within stream */
|
||||
stream->data = file;
|
||||
return 0;
|
||||
@ -241,6 +245,7 @@ guac_stream* guac_sftp_download_file(guac_client* client,
|
||||
|
||||
/* Allocate stream */
|
||||
stream = guac_client_alloc_stream(client);
|
||||
stream->ack_handler = guac_sftp_ack_handler;
|
||||
stream->data = file;
|
||||
|
||||
/* Send stream start, strip name */
|
||||
|
@ -382,11 +382,8 @@ void* ssh_client_thread(void* data) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set file handlers */
|
||||
client->ack_handler = guac_sftp_ack_handler;
|
||||
/* Set file handler */
|
||||
client->file_handler = guac_sftp_file_handler;
|
||||
client->blob_handler = guac_sftp_blob_handler;
|
||||
client->end_handler = guac_sftp_end_handler;
|
||||
|
||||
guac_client_log_info(client, "SFTP session initialized");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user