From 7f293df34cf8956f8ccdae20e57b50be92bbebea Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 13 Mar 2012 15:45:22 -0700 Subject: [PATCH] Modify guac_client_plugin_get_client() to allow logging to be set up before guac_client_init is called (fixes ticket #85). --- libguac/include/client.h | 8 +++++++- libguac/src/client.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libguac/include/client.h b/libguac/include/client.h index 3f4a4a1d..6f6f768e 100644 --- a/libguac/include/client.h +++ b/libguac/include/client.h @@ -449,10 +449,16 @@ int guac_client_plugin_close(guac_client_plugin* plugin); * @param socket The guac_socket the client should use for communication. * @param argc The number of arguments being passed to the client. * @param argv All arguments to be passed to the client. + * @param log_info_handler Info logging handler to provide to the client before + * initializing. + * @param log_error_handler Error logging handler to provide to the client + * before initializing. * @return A pointer to the newly initialized client. */ guac_client* guac_client_plugin_get_client(guac_client_plugin* plugin, - guac_socket* socket, int argc, char** argv); + guac_socket* socket, int argc, char** argv, + guac_client_log_handler* log_info_handler, + guac_client_log_handler* log_error_handler); /** * Free all resources associated with the given client. diff --git a/libguac/src/client.c b/libguac/src/client.c index f247bf0b..1451c034 100644 --- a/libguac/src/client.c +++ b/libguac/src/client.c @@ -231,7 +231,9 @@ int guac_client_plugin_close(guac_client_plugin* plugin) { } guac_client* guac_client_plugin_get_client(guac_client_plugin* plugin, - guac_socket* socket, int argc, char** argv) { + guac_socket* socket, int argc, char** argv, + guac_client_log_handler* log_info_handler, + guac_client_log_handler* log_error_handler) { /* Allocate new client */ guac_client* client = malloc(sizeof(guac_client)); @@ -257,6 +259,10 @@ guac_client* guac_client_plugin_get_client(guac_client_plugin* plugin, client->__next_buffer_index = -1; client->__next_layer_index = 1; + /* Set up logging in client */ + client->log_info_handler = log_info_handler; + client->log_error_handler = log_error_handler; + if (plugin->init_handler(client, argc, argv) != 0) { free(client); return NULL;