Commit c8aa6a57 authored by dkonam's avatar dkonam

Merge branch 'develop' into Data/develop

parents 410e1cb1 f60c09c6
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath ${packageClassName}</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName}</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath ${packageClassName}</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
</actions>
...@@ -13,6 +13,7 @@ import com.utclo23.com.messages.*; ...@@ -13,6 +13,7 @@ import com.utclo23.com.messages.*;
import com.utclo23.data.facade.IDataCom; import com.utclo23.data.facade.IDataCom;
import com.utclo23.data.structure.LightPublicUser; import com.utclo23.data.structure.LightPublicUser;
import java.net.Inet4Address; import java.net.Inet4Address;
import java.net.InterfaceAddress;
import java.util.List; import java.util.List;
/** /**
...@@ -41,9 +42,13 @@ public class ComFacade { ...@@ -41,9 +42,13 @@ public class ComFacade {
new Thread(receiver).start(); new Thread(receiver).start();
} }
public void setUsedInterface(InterfaceAddress uif){
kIpCtrl.setUsedInterface(uif);
}
// envoi au dest // envoi au dest
public void sendShipsToEnnemy(List<Ship> listShips, PublicUser dest){ public void sendShipsToEnnemy(List<Ship> listShips, PublicUser dest){
M_PlaceShip m_placeship = new M_PlaceShip(listShips); M_PlaceShip m_placeship = new M_PlaceShip(iDataCom.getMyPublicUserProfile(), listShips);
Sender os = new Sender(kIpCtrl.getHashMap().get(dest.getId()).getHostAddress(), 80, m_placeship); Sender os = new Sender(kIpCtrl.getHashMap().get(dest.getId()).getHostAddress(), 80, m_placeship);
new Thread(os).start(); new Thread(os).start();
} }
...@@ -72,7 +77,7 @@ public class ComFacade { ...@@ -72,7 +77,7 @@ public class ComFacade {
// envoi à tout ceux présents dans le game // envoi à tout ceux présents dans le game
public void notifyNewMessage(com.utclo23.data.structure.Message message) { public void notifyNewMessage(com.utclo23.data.structure.Message message) {
M_Chat m_chat = new M_Chat(message, message.getTimestamp()); M_Chat m_chat = new M_Chat(iDataCom.getMyPublicUserProfile(), message, message.getTimestamp());
for (LightPublicUser recipient : message.getRecipients()) { for (LightPublicUser recipient : message.getRecipients()) {
Sender os = new Sender(kIpCtrl.getHashMap().get(recipient.getId()).getHostAddress(), 80, m_chat); Sender os = new Sender(kIpCtrl.getHashMap().get(recipient.getId()).getHostAddress(), 80, m_chat);
new Thread(os).start(); new Thread(os).start();
...@@ -81,7 +86,7 @@ public class ComFacade { ...@@ -81,7 +86,7 @@ public class ComFacade {
// envoi à tout ceux dans le game // envoi à tout ceux dans le game
public void notifyNewCoordinates(Mine mine, List<LightPublicUser> recipients){ public void notifyNewCoordinates(Mine mine, List<LightPublicUser> recipients){
M_PlaceMine m_placemine = new M_PlaceMine(mine); M_PlaceMine m_placemine = new M_PlaceMine(iDataCom.getMyPublicUserProfile(), mine);
for(LightPublicUser recipient : recipients){ for(LightPublicUser recipient : recipients){
Sender os = new Sender(kIpCtrl.getHashMap().get(recipient.getId()).getHostAddress(), 80, m_placemine); Sender os = new Sender(kIpCtrl.getHashMap().get(recipient.getId()).getHostAddress(), 80, m_placemine);
new Thread(os).start(); new Thread(os).start();
...@@ -90,7 +95,7 @@ public class ComFacade { ...@@ -90,7 +95,7 @@ public class ComFacade {
// à tout le monde // à tout le monde
public void notifyNewGame(StatGame game){ public void notifyNewGame(StatGame game){
M_CreationGame m_creationgame = new M_CreationGame(game); M_CreationGame m_creationgame = new M_CreationGame(iDataCom.getMyPublicUserProfile(), game);
for(Inet4Address ip : kIpCtrl.getHashMap().values()){ for(Inet4Address ip : kIpCtrl.getHashMap().values()){
Sender os = new Sender(ip.getHostAddress(), 80, m_creationgame); Sender os = new Sender(ip.getHostAddress(), 80, m_creationgame);
new Thread(os).start(); new Thread(os).start();
...@@ -99,7 +104,7 @@ public class ComFacade { ...@@ -99,7 +104,7 @@ public class ComFacade {
// envoi à la machine qui a crée la game // envoi à la machine qui a crée la game
public void connectionToGame(StatGame game){ public void connectionToGame(StatGame game){
M_JoinGame m_joingame = new M_JoinGame(game); M_JoinGame m_joingame = new M_JoinGame(iDataCom.getMyPublicUserProfile(), game);
Inet4Address adr = KnownIPController.getInstance().getHashMap().get(game.getCreator().getId()); Inet4Address adr = KnownIPController.getInstance().getHashMap().get(game.getCreator().getId());
Sender os = new Sender(adr.getHostAddress(), 80, m_joingame); Sender os = new Sender(adr.getHostAddress(), 80, m_joingame);
new Thread(os).start(); new Thread(os).start();
...@@ -107,7 +112,7 @@ public class ComFacade { ...@@ -107,7 +112,7 @@ public class ComFacade {
// envoi à tout ceux qui sont dans la game logiquement, paramètre à revoir // envoi à tout ceux qui sont dans la game logiquement, paramètre à revoir
public void leaveGame(PublicUser user){ public void leaveGame(PublicUser user){
M_LeaveGame m_leavegame = new M_LeaveGame(); M_LeaveGame m_leavegame = new M_LeaveGame(iDataCom.getMyPublicUserProfile());
for(Inet4Address ip : kIpCtrl.getHashMap().values()){ for(Inet4Address ip : kIpCtrl.getHashMap().values()){
Sender os = new Sender(ip.getHostAddress(), 80, m_leavegame); Sender os = new Sender(ip.getHostAddress(), 80, m_leavegame);
new Thread(os).start(); new Thread(os).start();
...@@ -118,7 +123,7 @@ public class ComFacade { ...@@ -118,7 +123,7 @@ public class ComFacade {
public void sendDiscovery(PublicUser user, List<Inet4Address> listIpTarget) { public void sendDiscovery(PublicUser user, List<Inet4Address> listIpTarget) {
for (int i = 0; i < listIpTarget.size(); i++) { for (int i = 0; i < listIpTarget.size(); i++) {
M_GetIP m_getIp = new M_GetIP(); M_GetIP m_getIp = new M_GetIP(iDataCom.getMyPublicUserProfile());
Sender os = new Sender(listIpTarget.get(i).getHostAddress(), 80, m_getIp); Sender os = new Sender(listIpTarget.get(i).getHostAddress(), 80, m_getIp);
new Thread(os).start(); new Thread(os).start();
discoCtrl.addIP(listIpTarget.get(i)); discoCtrl.addIP(listIpTarget.get(i));
...@@ -128,18 +133,23 @@ public class ComFacade { ...@@ -128,18 +133,23 @@ public class ComFacade {
// envoi à l'id // envoi à l'id
public void getPublicUserProfile(String id){ public void getPublicUserProfile(String id){
M_GetPlayerInfo m_getplayerinfo = new M_GetPlayerInfo(); M_GetPlayerInfo m_getplayerinfo = new M_GetPlayerInfo(iDataCom.getMyPublicUserProfile());
Sender os = new Sender(kIpCtrl.getHashMap().get(id).getHostAddress(), 80, m_getplayerinfo); Sender os = new Sender(kIpCtrl.getHashMap().get(id).getHostAddress(), 80, m_getplayerinfo);
new Thread(os).start(); new Thread(os).start();
} }
// envoi à tout le monde // envoi à tout le monde si success
public void joinGameResponse (boolean success, String id, StatGame game){ public void joinGameResponse (boolean success, String id, StatGame game){
M_JoinGameResponse m_joingameresponse = new M_JoinGameResponse(success); /*M_JoinGameResponse m_joingameresponse = new M_JoinGameResponse(success);
for(Inet4Address ip : kIpCtrl.getHashMap().values()){ if (success){
Sender os = new Sender(ip.getHostAddress(), 80, m_joingameresponse); for(Inet4Address ip : kIpCtrl.getHashMap().values()){
Sender os = new Sender(ip.getHostAddress(), 80, m_joingameresponse);
new Thread(os).start();
}
} else {
Sender os = new Sender(kIpCtrl.getHashMap().get(id).getHostAddress(), 80, m_joingameresponse);
new Thread(os).start(); new Thread(os).start();
} }*/
} }
} }
...@@ -9,6 +9,8 @@ import java.util.HashMap; ...@@ -9,6 +9,8 @@ import java.util.HashMap;
import java.net.Inet4Address; import java.net.Inet4Address;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import com.utclo23.data.facade.IDataCom; import com.utclo23.data.facade.IDataCom;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -23,7 +25,7 @@ public class KnownIPController { ...@@ -23,7 +25,7 @@ public class KnownIPController {
// TODO: add a lock on this one // TODO: add a lock on this one
private final HashMap<String, Inet4Address> knownIp; private final HashMap<String, Inet4Address> knownIp;
IDataCom iDataCom; IDataCom iDataCom;
InterfaceAddress usedInterface;
// private constructor // private constructor
private KnownIPController() { private KnownIPController() {
knownIp = new HashMap<>(); knownIp = new HashMap<>();
...@@ -40,15 +42,23 @@ public class KnownIPController { ...@@ -40,15 +42,23 @@ public class KnownIPController {
public static KnownIPController getInstance() { public static KnownIPController getInstance() {
return SingletonHolder.INSTANCE; return SingletonHolder.INSTANCE;
} }
public Inet4Address getMyInetAddress(){
return (Inet4Address)this.usedInterface.getAddress();
}
public void setUsedInterface(InterfaceAddress uif){
this.usedInterface = uif;
}
// used to put our own IP in the hashmap of IP // used to put our own IP in the hashmap of IP
public void initIpList(IDataCom iDataCom) { public void initIpList(IDataCom iDataCom) {
try { this.iDataCom = iDataCom;
this.iDataCom = iDataCom; knownIp.put(
knownIp.put( iDataCom.getMyPublicUserProfile().getId(),
iDataCom.getMyPublicUserProfile().getId(), getMyInetAddress());
(Inet4Address) Inet4Address.getLocalHost());
} catch (UnknownHostException e) {}
} }
public String getKeyFromValue( public String getKeyFromValue(
...@@ -65,34 +75,24 @@ public class KnownIPController { ...@@ -65,34 +75,24 @@ public class KnownIPController {
} }
public HashMap<String, Inet4Address> getHashMap() { public HashMap<String, Inet4Address> getHashMap() {
try { HashMap<String, Inet4Address> tmphash = knownIp;
Inet4Address ourIpAddress = (Inet4Address) Inet4Address.getLocalHost(); tmphash.remove(iDataCom.getMyPublicUserProfile().getLightPublicUser().getId()); // to avoid sending back our own Ip adress (cuz it already got it).
HashMap<String, Inet4Address> tmphash = knownIp; return tmphash;
tmphash.remove(iDataCom.getMyPublicUserProfile().getLightPublicUser().getId()); // to avoid sending back our own Ip adress (cuz it already got it).
return tmphash;
} catch (UnknownHostException e) {
// No good
return null;
}
} }
public HashMap<String, Inet4Address> getNewIpHashMap() { public HashMap<String, Inet4Address> getNewIpHashMap() {
DiscoveryController discoCtrl = DiscoveryController.getInstance(); DiscoveryController discoCtrl = DiscoveryController.getInstance();
try { HashMap<String, Inet4Address> tmphash = knownIp;
Inet4Address ourIpAddress = (Inet4Address) Inet4Address.getLocalHost(); tmphash.remove(iDataCom.getMyPublicUserProfile().getLightPublicUser().getId()); // to avoid sending back our own Ip adress (cuz it already got it).
HashMap<String, Inet4Address> tmphash = knownIp; List<Inet4Address> getIpIssuedList = discoCtrl.getGetIpIssuedList();
tmphash.remove(iDataCom.getMyPublicUserProfile().getLightPublicUser().getId()); // to avoid sending back our own Ip adress (cuz it already got it). String key;
List<Inet4Address> getIpIssuedList = discoCtrl.getGetIpIssuedList(); for (int i = 0; i < getIpIssuedList.size(); i++) {
String key; key = getKeyFromValue(tmphash, getIpIssuedList.get(i));
for (int i = 0; i < getIpIssuedList.size(); i++) { tmphash.remove(key);
key = getKeyFromValue(tmphash, getIpIssuedList.get(i));
tmphash.remove(key);
}
return tmphash;
} catch (UnknownHostException e) {
// No good
return null;
} }
return tmphash;
} }
public void addNode(String id, Inet4Address ip) { public void addNode(String id, Inet4Address ip) {
......
...@@ -40,12 +40,14 @@ public class Receiver implements Runnable { ...@@ -40,12 +40,14 @@ public class Receiver implements Runnable {
try { try {
client = serverSocket.accept(); client = serverSocket.accept();
in = new ObjectInputStream(client.getInputStream()); in = new ObjectInputStream(client.getInputStream());
System.out.println(in.available());
while((request = (Message) in.readObject()) != null) request = (Message) in.readObject();
request.callback(iDataCom);
/*while((request = (Message) in.readObject()) != null)
{ {
request.callback(iDataCom); request.callback(iDataCom);
break; break;
} }*/
client.close(); client.close();
in.close(); in.close();
......
...@@ -5,12 +5,15 @@ ...@@ -5,12 +5,15 @@
*/ */
package com.utclo23.com; package com.utclo23.com;
import com.utclo23.com.messages.M_Connexion;
import java.net.Socket; import java.net.Socket;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import com.utclo23.com.messages.Message; import com.utclo23.com.messages.Message;
import com.utclo23.data.structure.PublicUser;
import java.net.Inet4Address;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
/** /**
...@@ -24,7 +27,7 @@ public class Sender implements Runnable { ...@@ -24,7 +27,7 @@ public class Sender implements Runnable {
String ip; String ip;
Message request; Message request;
ObjectOutputStream out; ObjectOutputStream out;
ObjectInputStream in; //ObjectInputStream in;
public Sender(String ip, int port, Message request) { public Sender(String ip, int port, Message request) {
this.ip = ip; this.ip = ip;
...@@ -35,11 +38,13 @@ public class Sender implements Runnable { ...@@ -35,11 +38,13 @@ public class Sender implements Runnable {
@Override @Override
public void run() { public void run() {
try { try {
KnownIPController kIpCtrl = KnownIPController.getInstance();
socket = new Socket(); socket = new Socket();
socket.setSoTimeout(2000); socket.setSoTimeout(2000);
socket.connect(new InetSocketAddress(ip, port), 2000); socket.connect(new InetSocketAddress(ip, port), 2000);
out = new ObjectOutputStream(socket.getOutputStream()); out = new ObjectOutputStream(socket.getOutputStream());
//in = new ObjectInputStream(socket.getInputStream()); //in = new ObjectInputStream(socket.getInputStream());
request.setIpSender(kIpCtrl.getMyInetAddress());
out.writeObject(request); out.writeObject(request);
//in.close(); //in.close();
out.close(); out.close();
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
package com.utclo23.com.messages; package com.utclo23.com.messages;
import com.utclo23.data.facade.IDataCom; import com.utclo23.data.facade.IDataCom;
import com.utclo23.data.structure.PublicUser;
import java.util.Date; import java.util.Date;
/** /**
* *
...@@ -14,7 +15,8 @@ public class M_Chat extends Message { ...@@ -14,7 +15,8 @@ public class M_Chat extends Message {
private com.utclo23.data.structure.Message message; private com.utclo23.data.structure.Message message;
private Date timeStamp; private Date timeStamp;
public M_Chat(com.utclo23.data.structure.Message m, Date t){ public M_Chat(PublicUser user, com.utclo23.data.structure.Message m, Date t){
super(user);
message = m; message = m;
timeStamp = t; timeStamp = t;
} }
......
...@@ -11,10 +11,9 @@ import com.utclo23.data.structure.PublicUser; ...@@ -11,10 +11,9 @@ import com.utclo23.data.structure.PublicUser;
* @author thibault * @author thibault
*/ */
public class M_Connexion extends Message{ public class M_Connexion extends Message{
public PublicUser user;
public M_Connexion(PublicUser u){ public M_Connexion(PublicUser user){
user = u; super(user);
} }
@Override @Override
......
...@@ -6,12 +6,17 @@ ...@@ -6,12 +6,17 @@
package com.utclo23.com.messages; package com.utclo23.com.messages;
import com.utclo23.data.facade.IDataCom; import com.utclo23.data.facade.IDataCom;
import com.utclo23.data.structure.PublicUser;
/** /**
* *
* @author thibault * @author thibault
*/ */
public class M_ConnexionLost extends Message{ public class M_ConnexionLost extends Message{
public M_ConnexionLost(PublicUser user){
super(user);
}
@Override @Override
public void callback(IDataCom iDataCom){ public void callback(IDataCom iDataCom){
iDataCom.connectionLostWithOpponent(); iDataCom.connectionLostWithOpponent();
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
package com.utclo23.com.messages; package com.utclo23.com.messages;
import com.utclo23.data.facade.IDataCom; import com.utclo23.data.facade.IDataCom;
import com.utclo23.data.structure.PublicUser;
import com.utclo23.data.structure.StatGame; import com.utclo23.data.structure.StatGame;
/** /**
* *
...@@ -13,7 +14,8 @@ import com.utclo23.data.structure.StatGame; ...@@ -13,7 +14,8 @@ import com.utclo23.data.structure.StatGame;
public class M_CreationGame extends Message{ public class M_CreationGame extends Message{
public StatGame game; public StatGame game;
public M_CreationGame(StatGame g){ public M_CreationGame(PublicUser user, StatGame g){
super(user);
game = g; game = g;
} }
......
...@@ -11,10 +11,9 @@ import com.utclo23.data.structure.PublicUser; ...@@ -11,10 +11,9 @@ import com.utclo23.data.structure.PublicUser;
* @author thibault * @author thibault
*/ */
public class M_Deconnexion extends Message { public class M_Deconnexion extends Message {
public PublicUser user;
public M_Deconnexion(PublicUser u){ public M_Deconnexion(PublicUser user){
user = u; super(user);
} }
@Override @Override
......
...@@ -10,6 +10,7 @@ import java.net.Inet4Address; ...@@ -10,6 +10,7 @@ import java.net.Inet4Address;
import java.util.HashMap; import java.util.HashMap;
import com.utclo23.data.facade.IDataCom; import com.utclo23.data.facade.IDataCom;
import com.utclo23.data.structure.LightPublicUser; import com.utclo23.data.structure.LightPublicUser;
import com.utclo23.data.structure.PublicUser;
import com.utclo23.data.structure.StatGame; import com.utclo23.data.structure.StatGame;
import java.util.List; import java.util.List;
...@@ -23,7 +24,8 @@ public class M_GetIP extends Message{ ...@@ -23,7 +24,8 @@ public class M_GetIP extends Message{
String name; String name;
public M_GetIP(){ public M_GetIP(PublicUser user){
super(user);
} }
...@@ -34,8 +36,8 @@ public class M_GetIP extends Message{ ...@@ -34,8 +36,8 @@ public class M_GetIP extends Message{
iDataCom.addConnectedUser(user.getLightPublicUser()); iDataCom.addConnectedUser(user.getLightPublicUser());
// TODO: add fonction to get the data from DATA // TODO: add fonction to get the data from DATA
List<LightPublicUser> listUsers = null; // = iDataCom.getConnectedUsers(); List<LightPublicUser> listUsers = iDataCom.getConnectedUsers();
List<StatGame>listGames = null; // = iDataCom.getGameList(); List<StatGame>listGames = iDataCom.getGameList();
kic = KnownIPController.getInstance(); kic = KnownIPController.getInstance();
// add new user to own knownIP hashmap. // add new user to own knownIP hashmap.
...@@ -47,9 +49,9 @@ public class M_GetIP extends Message{ ...@@ -47,9 +49,9 @@ public class M_GetIP extends Message{
HashMap<String,Inet4Address> IdToIp = kic.getHashMap(); HashMap<String,Inet4Address> IdToIp = kic.getHashMap();
// send back the data this node has about its known network. // send back the data this node has about its known network.
M_ReturnIP returnIp = new M_ReturnIP(listGames, listUsers, IdToIp); M_ReturnIP returnIp = new M_ReturnIP(user, listGames, listUsers, IdToIp);
Sender os = new Sender(IP_sender.toString(), 80, returnIp); Sender os = new Sender(IP_sender.getHostAddress(), 80, returnIp);
Thread thread = new Thread(os); Thread thread = new Thread(os);
thread.start(); thread.start();
......
...@@ -13,11 +13,16 @@ import com.utclo23.data.structure.PublicUser; ...@@ -13,11 +13,16 @@ import com.utclo23.data.structure.PublicUser;
* @author thibault * @author thibault
*/ */
public class M_GetPlayerInfo extends Message { public class M_GetPlayerInfo extends Message {
public M_GetPlayerInfo(PublicUser user){
super(user);
}
@Override @Override
public void callback(IDataCom iDataCom){ public void callback(IDataCom iDataCom){
PublicUser user = iDataCom.getMyPublicUserProfile(); PublicUser user = iDataCom.getMyPublicUserProfile();
M_PlayerInfo m_PlayerInfo = new M_PlayerInfo(user); M_PlayerInfo m_PlayerInfo = new M_PlayerInfo(user);
Sender os = new Sender(this.IP_sender.getHostAddress(), 80, m_PlayerInfo); Sender os = new Sender(IP_sender.getHostAddress(), 80, m_PlayerInfo);
new Thread(os).start(); new Thread(os).start();
} }
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
package com.utclo23.com.messages; package com.utclo23.com.messages;
import com.utclo23.data.facade.IDataCom; import com.utclo23.data.facade.IDataCom;
import com.utclo23.data.structure.PublicUser;
import com.utclo23.data.structure.StatGame; import com.utclo23.data.structure.StatGame;
/** /**
* *
...@@ -14,7 +15,8 @@ public class M_JoinGame extends Message { ...@@ -14,7 +15,8 @@ public class M_JoinGame extends Message {
private StatGame game; private StatGame game;
private String role; private String role;
public M_JoinGame(StatGame g) { public M_JoinGame(PublicUser user, StatGame g) {
super(user);
game = g; game = g;
} }
@Override @Override
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
package com.utclo23.com.messages; package com.utclo23.com.messages;
import com.utclo23.data.facade.IDataCom; import com.utclo23.data.facade.IDataCom;
import com.utclo23.data.structure.PublicUser;
/** /**
* *
...@@ -14,11 +15,13 @@ import com.utclo23.data.facade.IDataCom; ...@@ -14,11 +15,13 @@ import com.utclo23.data.facade.IDataCom;
public class M_JoinGameResponse extends Message { public class M_JoinGameResponse extends Message {
private boolean success; private boolean success;
public M_JoinGameResponse(boolean s){ public M_JoinGameResponse(PublicUser user, boolean s){
super(user);
success = s; success = s;
} }
@Override @Override
public void callback(IDataCom iDataCom){ public void callback(IDataCom iDataCom){
//if success call xxx
//else connexionImpossible()
} }
} }
...@@ -6,12 +6,18 @@ ...@@ -6,12 +6,18 @@
package com.utclo23.com.messages; package com.utclo23.com.messages;
import com.utclo23.data.facade.IDataCom; import com.utclo23.data.facade.IDataCom;
import com.utclo23.data.structure.PublicUser;
/** /**
* *
* @author thibault * @author thibault
*/ */
public class M_LeaveGame extends Message {