mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUACAMOLE-1293: Add common support for the name handshake instruction.
This commit is contained in:
		| @@ -293,7 +293,14 @@ public class ConfiguredGuacamoleSocket extends DelegatingGuacamoleSocket { | ||||
|         if (GuacamoleProtocolCapability.TIMEZONE_HANDSHAKE.isSupported(protocolVersion)) { | ||||
|             String timezone = info.getTimezone(); | ||||
|             if (timezone != null) | ||||
|                 writer.writeInstruction(new GuacamoleInstruction("timezone", info.getTimezone())); | ||||
|                 writer.writeInstruction(new GuacamoleInstruction("timezone", timezone)); | ||||
|         } | ||||
|          | ||||
|         // Send client name, if supported and available | ||||
|         if (GuacamoleProtocolCapability.NAME_HANDSHAKE.isSupported(protocolVersion)) { | ||||
|             String name = info.getName(); | ||||
|             if (name != null) | ||||
|                 writer.writeInstruction(new GuacamoleInstruction("name", name)); | ||||
|         } | ||||
|  | ||||
|         // Send args | ||||
|   | ||||
| @@ -47,17 +47,22 @@ public class GuacamoleClientInformation { | ||||
|     /** | ||||
|      * The list of audio mimetypes reported by the client to be supported. | ||||
|      */ | ||||
|     private final List<String> audioMimetypes = new ArrayList<String>(); | ||||
|     private final List<String> audioMimetypes = new ArrayList<>(); | ||||
|  | ||||
|     /** | ||||
|      * The list of video mimetypes reported by the client to be supported. | ||||
|      */ | ||||
|     private final List<String> videoMimetypes = new ArrayList<String>(); | ||||
|     private final List<String> videoMimetypes = new ArrayList<>(); | ||||
|  | ||||
|     /** | ||||
|      * The list of image mimetypes reported by the client to be supported. | ||||
|      */ | ||||
|     private final List<String> imageMimetypes = new ArrayList<String>(); | ||||
|     private final List<String> imageMimetypes = new ArrayList<>(); | ||||
|      | ||||
|     /** | ||||
|      * The name of the user reported by the client. | ||||
|      */ | ||||
|     private String name; | ||||
|      | ||||
|     /** | ||||
|      * The timezone reported by the client. | ||||
| @@ -150,6 +155,17 @@ public class GuacamoleClientInformation { | ||||
|         return imageMimetypes; | ||||
|     } | ||||
|      | ||||
|     /** | ||||
|      * Returns the name of the Guacamole user as reported by the client, or null | ||||
|      * if the user name is not set. | ||||
|      *  | ||||
|      * @return  | ||||
|      *     A string value of the human-readable name reported by the client. | ||||
|      */ | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|      | ||||
|     /** | ||||
|      * Return the timezone as reported by the client, or null if the timezone | ||||
|      * is not set.  Valid timezones are specified in IANA zone key format, | ||||
| @@ -162,6 +178,16 @@ public class GuacamoleClientInformation { | ||||
|         return timezone; | ||||
|     } | ||||
|      | ||||
|     /** | ||||
|      * Set the human-readable name of the user associated with this client. | ||||
|      *  | ||||
|      * @param name  | ||||
|      *     The human-readable name of the user associated with this client. | ||||
|      */ | ||||
|     public void setName(String name) { | ||||
|         this.name = name; | ||||
|     } | ||||
|      | ||||
|     /** | ||||
|      * Set the string value of the timezone, or null if the timezone will not | ||||
|      * be provided by the client.  Valid timezones are specified in IANA zone | ||||
|   | ||||
| @@ -40,6 +40,14 @@ public enum GuacamoleProtocolCapability { | ||||
|      */ | ||||
|     MSG_INSTRUCTION(GuacamoleProtocolVersion.VERSION_1_5_0), | ||||
|      | ||||
|     /** | ||||
|      * Support for the "name" handshake instruction, allowing clients to send | ||||
|      * the name of the Guacamole user to be passed to guacd and associated with | ||||
|      * connections. Support for this insruction was introduced in | ||||
|      * {@link GuacamoleProtocolVersion#VERSION_1_5_0}. | ||||
|      */ | ||||
|     NAME_HANDSHAKE(GuacamoleProtocolVersion.VERSION_1_5_0), | ||||
|      | ||||
|     /** | ||||
|      * Negotiation of Guacamole protocol version between client and server | ||||
|      * during the protocol handshake. The ability to negotiate protocol | ||||
|   | ||||
| @@ -56,7 +56,9 @@ public class GuacamoleProtocolVersion { | ||||
|     /** | ||||
|      * Protocol version 1.5.0, which introduces the "msg" instruction, allowing | ||||
|      * the server to send message notifications that will be displayed on the | ||||
|      * client. | ||||
|      * client. The version also adds support for the "name" handshake | ||||
|      * instruction, allowing guacd to store the name of the user who is | ||||
|      * accessing the connection. | ||||
|      */ | ||||
|     public static final GuacamoleProtocolVersion VERSION_1_5_0 = new GuacamoleProtocolVersion(1, 5, 0); | ||||
|      | ||||
|   | ||||
		Reference in New Issue
	
	Block a user