GUACAMOLE-1293: Change new user info member to simply "name" to clarify its purpose.
This commit is contained in:
parent
aa92239edd
commit
623c398005
@ -765,12 +765,12 @@ static void* guac_client_owner_notify_join_callback(guac_user* user, void* data)
|
||||
return (void*) ((intptr_t) -1);
|
||||
|
||||
char* owner = "owner";
|
||||
if (user->info.username != NULL)
|
||||
owner = (char *) user->info.username;
|
||||
if (user->info.name != NULL)
|
||||
owner = (char *) user->info.name;
|
||||
|
||||
char* joinName = "anonymous";
|
||||
if (joiner->info.username != NULL)
|
||||
joinName = (char *) joiner->info.username;
|
||||
if (joiner->info.name != NULL)
|
||||
joinName = (char *) joiner->info.name;
|
||||
|
||||
guac_user_log(user, GUAC_LOG_DEBUG, "Notifying owner \"%s\" of \"%s\" joining.", owner, joinName);
|
||||
|
||||
@ -820,12 +820,12 @@ static void* guac_client_owner_notify_leave_callback(guac_user* user, void* data
|
||||
return (void*) ((intptr_t) -1);
|
||||
|
||||
char* ownerName = "owner";
|
||||
if (user->info.username != NULL)
|
||||
ownerName = (char *) user->info.username;
|
||||
if (user->info.name != NULL)
|
||||
ownerName = (char *) user->info.name;
|
||||
|
||||
char* quitterName = "anonymous";
|
||||
if (quitter->info.username != NULL)
|
||||
quitterName = (char *) quitter->info.username;
|
||||
if (quitter->info.name != NULL)
|
||||
quitterName = (char *) quitter->info.name;
|
||||
|
||||
guac_user_log(user, GUAC_LOG_DEBUG, "Notifying owner \"%s\" of \"%s\" leaving.", ownerName, quitterName);
|
||||
|
||||
|
@ -310,7 +310,7 @@ typedef enum guac_protocol_version {
|
||||
|
||||
/**
|
||||
* Protocol version 1.5.0, which supports the "msg" instruction, allowing
|
||||
* messages to be sent to the client, and adds support for the "username"
|
||||
* messages to be sent to the client, and adds support for the "name"
|
||||
* handshake instruction.
|
||||
*/
|
||||
GUAC_PROTOCOL_VERSION_1_5_0 = 0x010500
|
||||
@ -327,15 +327,15 @@ typedef enum guac_message_type {
|
||||
|
||||
/**
|
||||
* A message that notifies the owner of a connection that another user has
|
||||
* joined their connection. There should be a single argument, the username
|
||||
* of the user who has joined.
|
||||
* joined their connection. There should be a single argument provided, the
|
||||
* name of the user who has joined.
|
||||
*/
|
||||
GUAC_MESSAGE_USER_JOINED = 0x0001,
|
||||
|
||||
/**
|
||||
* A message that notifies the owner of a connection that another user has
|
||||
* left their connection. There should be a single argument provided, the
|
||||
* username of the user who has left.
|
||||
* name of the user who has left.
|
||||
*/
|
||||
GUAC_MESSAGE_USER_LEFT = 0x0002
|
||||
|
||||
|
@ -88,12 +88,6 @@ struct guac_user_info {
|
||||
* stated resolution of the display size request is recommended.
|
||||
*/
|
||||
int optimal_resolution;
|
||||
|
||||
/**
|
||||
* The human-readable name of the Guacamole user. If the client does not
|
||||
* provide a name then this will be NULL.
|
||||
*/
|
||||
const char* username;
|
||||
|
||||
/**
|
||||
* The timezone of the remote system. If the client does not provide
|
||||
@ -108,6 +102,14 @@ struct guac_user_info {
|
||||
*/
|
||||
guac_protocol_version protocol_version;
|
||||
|
||||
/**
|
||||
* The human-readable name of the Guacamole user, supplied by the client
|
||||
* during the handshake. This is an arbitrary value, with no requirements or
|
||||
* constraints, including that it need not uniquely identify the user.
|
||||
* If the client does not provide a name then this will be NULL.
|
||||
*/
|
||||
const char* name;
|
||||
|
||||
};
|
||||
|
||||
struct guac_user {
|
||||
|
@ -64,7 +64,7 @@ __guac_instruction_handler_mapping __guac_handshake_handler_map[] = {
|
||||
{"video", __guac_handshake_video_handler},
|
||||
{"image", __guac_handshake_image_handler},
|
||||
{"timezone", __guac_handshake_timezone_handler},
|
||||
{"username", __guac_handshake_username_handler},
|
||||
{"name", __guac_handshake_name_handler},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@ -677,18 +677,18 @@ int __guac_handshake_image_handler(guac_user* user, int argc, char** argv) {
|
||||
|
||||
}
|
||||
|
||||
int __guac_handshake_username_handler(guac_user* user, int argc, char** argv) {
|
||||
int __guac_handshake_name_handler(guac_user* user, int argc, char** argv) {
|
||||
|
||||
/* Free any past value for the user's name */
|
||||
free((char *) user->info.username);
|
||||
free((char *) user->info.name);
|
||||
|
||||
/* If a value is provided for the username, copy it into guac_user. */
|
||||
/* If a value is provided for the name, copy it into guac_user. */
|
||||
if (argc > 0 && strcmp(argv[0], ""))
|
||||
user->info.username = (const char*) strdup(argv[0]);
|
||||
user->info.name = (const char*) strdup(argv[0]);
|
||||
|
||||
/* No or empty value was provided, so make sure this is NULLed out. */
|
||||
else
|
||||
user->info.username = NULL;
|
||||
user->info.name = NULL;
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -219,11 +219,11 @@ __guac_instruction_handler __guac_handshake_video_handler;
|
||||
__guac_instruction_handler __guac_handshake_image_handler;
|
||||
|
||||
/**
|
||||
* Internal handler function that is called when the username instruction is
|
||||
* Internal handler function that is called when the name instruction is
|
||||
* received during the handshake process, specifying the name of the Guacamole
|
||||
* user establishing the connection.
|
||||
*/
|
||||
__guac_instruction_handler __guac_handshake_username_handler;
|
||||
__guac_instruction_handler __guac_handshake_name_handler;
|
||||
|
||||
/**
|
||||
* Internal handler function that is called when the timezone instruction is
|
||||
|
@ -296,7 +296,7 @@ int guac_user_handle_connection(guac_user* user, int usec_timeout) {
|
||||
user->info.audio_mimetypes = NULL;
|
||||
user->info.image_mimetypes = NULL;
|
||||
user->info.video_mimetypes = NULL;
|
||||
user->info.username = NULL;
|
||||
user->info.name = NULL;
|
||||
user->info.timezone = NULL;
|
||||
|
||||
/* Count number of arguments. */
|
||||
@ -371,8 +371,8 @@ int guac_user_handle_connection(guac_user* user, int usec_timeout) {
|
||||
guac_free_mimetypes((char **) user->info.image_mimetypes);
|
||||
guac_free_mimetypes((char **) user->info.video_mimetypes);
|
||||
|
||||
/* Free username and timezone info. */
|
||||
free((char *) user->info.username);
|
||||
/* Free name and timezone info. */
|
||||
free((char *) user->info.name);
|
||||
free((char *) user->info.timezone);
|
||||
|
||||
guac_parser_free(parser);
|
||||
|
Loading…
Reference in New Issue
Block a user