Commit 45cdc9f3 authored by legoc's avatar legoc
Browse files

Client type is passed at login

parent 0dc3988c
......@@ -61,7 +61,7 @@
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem-messages</artifactId>
<version>0.0.10</version>
<version>0.0.11</version>
</dependency>
<dependency>
<groupId>fr.ill.ics</groupId>
......
......@@ -57,8 +57,8 @@ public class TokenManager {
}
public void askForToken(String clientType) {
SessionManager.getInstance(SERVER_ID).requestToken(clientType);
public void askForToken() {
SessionManager.getInstance(SERVER_ID).requestToken();
}
}
\ No newline at end of file
......@@ -89,7 +89,7 @@ public class ServerSessionManager {
init();
try {
SessionManager.getInstance(serverId).login(standAlone, user);
SessionManager.getInstance(serverId).login(standAlone, ConfigManager.getInstance().getClientType(), user);
}
catch (ClientAlreadyLaunchedException e) {
// Only rethrow the exception. The call to logoutAll is made in the main application.
......@@ -125,7 +125,7 @@ public class ServerSessionManager {
ServantManagerAccessor.getInstance(serverId).init();
try {
SessionManager.getInstance(serverId).login(standAlone);
SessionManager.getInstance(serverId).login(standAlone, "tablet");
}
catch (ClientAlreadyLaunchedException e) {
logoutAll(false);
......
......@@ -101,11 +101,11 @@ public class SessionManager {
sessionRequester.terminate();
}
public void login(boolean standAlone) throws ClientAlreadyLaunchedException {
login(standAlone, null);
public void login(boolean standAlone, String clientType) throws ClientAlreadyLaunchedException {
login(standAlone, clientType, null);
}
public synchronized void login(boolean standAlone, String user) throws ClientAlreadyLaunchedException {
public synchronized void login(boolean standAlone, String clientType, String user) throws ClientAlreadyLaunchedException {
// Create the message type.
SessionRequests.Message type = SessionRequests.Message.newBuilder()
......@@ -118,12 +118,14 @@ public class SessionManager {
if (user != null) {
request = SessionRequests.LoginRequest.newBuilder()
.setStandAlone(standAlone)
.setClientType(clientType)
.setUser(user)
.build();
}
else {
request = SessionRequests.LoginRequest.newBuilder()
.setStandAlone(standAlone)
.setClientType(clientType)
.build();
}
......@@ -170,7 +172,7 @@ public class SessionManager {
}
}
public synchronized void enableRemoteControl(String clientType) {
public synchronized void enableRemoteControl() {
// Create the message type.
SessionRequests.Message type = SessionRequests.Message.newBuilder()
......@@ -179,7 +181,6 @@ public class SessionManager {
// Create the request.
SessionRequests.RemoteControlRequest request = SessionRequests.RemoteControlRequest.newBuilder()
.setClientType(clientType)
.setClientID(clientId)
.setUser(getUser())
.build();
......@@ -194,7 +195,7 @@ public class SessionManager {
}
}
public synchronized void disableRemoteControl(String clientType) {
public synchronized void disableRemoteControl() {
// Create the message type.
SessionRequests.Message type = SessionRequests.Message.newBuilder()
......@@ -203,7 +204,6 @@ public class SessionManager {
// Create the request.
SessionRequests.RemoteControlRequest request = SessionRequests.RemoteControlRequest.newBuilder()
.setClientType(clientType)
.setClientID(clientId)
.setUser(getUser())
.build();
......@@ -219,7 +219,7 @@ public class SessionManager {
}
public synchronized void requestToken(String clientType) {
public synchronized void requestToken() {
// Create the message type.
SessionRequests.Message type = SessionRequests.Message.newBuilder()
......@@ -228,7 +228,6 @@ public class SessionManager {
// Create the request.
SessionRequests.GetTokenRequest request = SessionRequests.GetTokenRequest.newBuilder()
.setClientType(clientType)
.setClientID(clientId)
.setUser(getUser())
.build();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment