Commit 5526962a authored by Thibault Chiche's avatar Thibault Chiche
Browse files

[com] ajout fonctions removeGame et message m_removeGame

parent 0eeadfea
......@@ -168,7 +168,7 @@ public class ComFacade {
Sender os = new Sender(kIpCtrl.getHashMap().get(recipient.getId()).getHostAddress(), kIpCtrl.getPort(), mLeaveGame);
new Thread(os).start();
}
}
}
}
/**
......@@ -243,4 +243,15 @@ public class ComFacade {
Logger.getLogger(ComFacade.class.getName()).log(Level.INFO, null, "Fail joinGame");
}
}
public void removeGame(String idGame){
M_RemoveGame m_RemoveGame = new M_RemoveGame(iDataCom.getMyPublicUserProfile(), idGame);
for (Inet4Address ip : kIpCtrl.getHashMap().values()) {
if (ip != null) {
Sender os = new Sender(ip.getHostAddress(), kIpCtrl.getPort(), m_RemoveGame);
Thread thread = new Thread(os);
thread.start();
}
}
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.com.messages;
import com.utclo23.data.facade.IDataCom;
import com.utclo23.data.structure.PublicUser;
/**
* M_LeaveGame is a Message generated when a user wants to leave a game.
* @author Thibault CHICHE
*/
public class M_RemoveGame extends Message {
private final String idGame;
/**
* Constructor.
* @param user is the message's sender
* @param idGame is the id of the game to remove
*/
public M_RemoveGame(PublicUser user, String idGame){
super(user);
this.idGame = idGame;
}
@Override
public void callback(IDataCom iDataCom){
iDataCom.removeGame(idGame);
}
}
Supports Markdown
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