Modify guac_client_plugin_get_client() to allow logging to be set up before guac_client_init is called (fixes ticket #85).
This commit is contained in:
parent
fa27d7b11e
commit
7f293df34c
@ -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.
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user