diff --git a/Application/Clavardage/bin/.gitignore b/Application/Clavardage/bin/.gitignore
index b32d6f7..6a15f9e 100644
--- a/Application/Clavardage/bin/.gitignore
+++ b/Application/Clavardage/bin/.gitignore
@@ -1,4 +1,3 @@
-/UserListeningThreadTCP.class
-/UserListeningThreadUDP.class
-/UserConnexionthreadTCP.class
-/Database.class
+/controller/
+/model/
+/view/
diff --git a/Application/Clavardage/bin/RemoteUser.class b/Application/Clavardage/bin/RemoteUser.class
deleted file mode 100644
index db140d3..0000000
Binary files a/Application/Clavardage/bin/RemoteUser.class and /dev/null differ
diff --git a/Application/Clavardage/bin/User.class b/Application/Clavardage/bin/User.class
deleted file mode 100644
index 8d9cba5..0000000
Binary files a/Application/Clavardage/bin/User.class and /dev/null differ
diff --git a/Application/Clavardage/src/Database.java b/Application/Clavardage/src/Database.java
deleted file mode 100644
index 9cc6fbe..0000000
--- a/Application/Clavardage/src/Database.java
+++ /dev/null
@@ -1,76 +0,0 @@
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-public class Database {
- private Statement statement;
- private Connection con;
-
- public Statement getStatement() {
- return this.statement;
- }
-
- public void close () throws SQLException {
- this.statement.close();
- this.con.close();
-
- }
-
-
- public void Database() {
- try {
- Class.forName("java.sql.Driver");
- System.out.println("coucou");
- } catch (ClassNotFoundException e) {
- System.out.println("probleme avec le driver");
- e.printStackTrace();
- }
- try {
- this.con=DriverManager.getConnection("jdbc:mysql://srv-bdens.insa-toulouse.fr:3306","tp_servlet_003","povu3Ma2");
- System.out.println("coucou");
- } catch (SQLException e) {
- System.out.println("co pas établit");
- e.printStackTrace();
- }
-
- try {
- this.statement=this.con.createStatement();
- System.out.println("coucou");
- } catch (SQLException e) {
- System.out.println("statement pas établit");
- e.printStackTrace();
- }
-
- int nb_changed_rows=0;
- try {
- nb_changed_rows = statement.executeUpdate("CREATE DATABASE base");
- System.out.println("coucou");
- } catch (SQLException e) {
- System.out.println("base de données pas établit");
- e.printStackTrace();
- }
- try {
- nb_changed_rows = statement.executeUpdate("USE base");
- System.out.println("coucou");
- } catch (SQLException e) {
- System.out.println("use base pas établit");
- e.printStackTrace();
- }
-
- try {
- nb_changed_rows = statement.executeUpdate("CREATE TABLE chat (user_IPcode1 INTEGER, user_IPcode2 INTEGER, Message STRING, date STRING)");
- System.out.println("coucou");
- } catch (SQLException e) {
- System.out.println("table non créée");
- e.printStackTrace();
- }
-
- if (nb_changed_rows==0){
- System.out.println("la modification n'a pas eu lieue");
- };
-
- }
-
-}
diff --git a/Application/Clavardage/src/Historique.java b/Application/Clavardage/src/Historique.java
deleted file mode 100644
index da6599d..0000000
--- a/Application/Clavardage/src/Historique.java
+++ /dev/null
@@ -1,118 +0,0 @@
-import java.sql.Connection;
-import java.sql.Date;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Calendar;
-
-public class Historique {
- private Database bdd;
- private ResultSet rs_received;
- private ResultSet rs_sent;
- private ResultSetMetaData rsmd_received;
- private ResultSetMetaData rsmd_sent;
-
- public void setRSReceived(ResultSet rs) {
- this.rs_received=rs;
- }
-
- public void setRSSent(ResultSet rs) {
- this.rs_sent=rs;
- }
-
- public ResultSet getRSSent() {
- return this.rs_sent;
- }
-
- public ResultSet getRSReceived() {
- return this.rs_received;
- }
-
- public void setRSMDReceived(ResultSetMetaData rsmd) {
- this.rsmd_received=rsmd;
- }
- public void setRSMDSent(ResultSetMetaData rsmd) {
- this.rsmd_sent=rsmd;
- }
- public ResultSetMetaData getRSMDReceived() {
- return this.rsmd_received;
- }
- public ResultSetMetaData getRSMDSent() {
- return this.rsmd_sent;
- }
-
- public void saveMessage(User user1, RemoteUser user2, String input, String date) {
- System.out.println("coucou");
-
- int nb_changed_rows=0;
- try {
- nb_changed_rows = this.bdd.getStatement().executeUpdate("INSERT INTO chat values ("+user1.getIPcode()+","+user2.addIP+","+input+","+date+")");
- } catch (SQLException e) {
- System.out.println("insertion pas établit");
- e.printStackTrace();
- }
- //nb_changed_rows = this.bdd.getStatement().executeUpdate("DELETE FROM table where name=‘noname’");
- if (nb_changed_rows==0){
- System.out.println("la modification n'a pas eu lieue");
- }
- }
-
- public String retrieveMessage(User user1, RemoteUser user2) throws SQLException {
- this.setRSSent(this.bdd.getStatement().executeQuery("SELECT"+user1.getIPcode()+","+user2.getIPcode()+",? ,? FROM table"));
- this.setRSReceived(this.bdd.getStatement().executeQuery("SELECT"+user2.getIPcode()+","+user1.getIPcode()+",?, ? FROM table"));
- //this.setRSMDSent(this.getRSSent().getMetaData());
- //this.setRSMDReceived(this.getRSReceived().getMetaData());
- boolean encore1 = this.getRSSent().next();
- boolean encore2 = this.getRSReceived().next();
- String message=null;
- String[] string1=null;
- String[] string2=null;
- Calendar date1=Calendar.getInstance();
- Calendar date2=Calendar.getInstance();
- while(encore1 || encore2) {
- while (this.getRSSent().getInt(1)!=user2.getIPcode()) {
- encore1=this.getRSSent().next();
- }
- string1=this.getRSSent().getString(3).split(" ");
- date1.set(Integer.valueOf(string1[0]), Integer.valueOf(string1[1]), Integer.valueOf(string1[2]),Integer.valueOf(string1[3]), Integer.valueOf(string1[4]), Integer.valueOf(string1[5]));
-
-
- while (this.getRSReceived().getInt(0)!=user1.getIPcode()) {
- encore2=this.getRSReceived().next();
- }
- string2=this.getRSReceived().getString(3).split(" ");
- date2.set(Integer.valueOf(string2[0]), Integer.valueOf(string2[1]), Integer.valueOf(string2[2]),Integer.valueOf(string2[3]), Integer.valueOf(string2[4]), Integer.valueOf(string2[5]));
-
- if (date1.compareTo(date2)>=0) {
- message=message+this.getRSReceived().getString(2);
- message=message+this.getRSSent().getString(2);
- }else {
- message=message+this.getRSSent().getString(2);
- message=message+this.getRSReceived().getString(2);
- }
- encore1=this.getRSSent().next();
- encore2=this.getRSReceived().next();
-
- }
-
- return message;
- }
-
- public void close_all() throws SQLException {
- this.rs_received.close();
- this.rs_sent.close();
- this.bdd.close();
- }
- //MAIN
- public void Historique() {
-
- this.bdd=new Database();
- System.out.println("coucoudb");
-
-
- }
-
-
-}
diff --git a/Application/Clavardage/src/Interface.java b/Application/Clavardage/src/Interface.java
deleted file mode 100644
index 9b2fde8..0000000
--- a/Application/Clavardage/src/Interface.java
+++ /dev/null
@@ -1,124 +0,0 @@
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-
-public class Interface implements ActionListener {
-
- private String Pseudolabeltext = "";
- final JLabel Pseudolabel = new JLabel("Pseudo: " + Pseudolabeltext);
- private JTextField PseudotextField;
- private JButton convertPseudo;
-
- //Specifies the look and feel to use. Valid values:
- //null (use the default), "Metal", "System", "Motif", "GTK+"
- final static String LOOKANDFEEL = null;
-
- public Component createComponents() {
- PseudotextField = new JTextField();
- PseudotextField.setColumns(10);
- PseudotextField.setText("Enter pseudo");
-
- convertPseudo = new JButton("Convert Pseudo");
- convertPseudo.addActionListener(this);
-
- Pseudolabel.setLabelFor(PseudotextField);
-
- /*
- * An easy way to put space between a top-level container
- * and its contents is to put the contents in a JPanel
- * that has an "empty" border.
- */
- JPanel pane = new JPanel(new GridLayout(0, 1));
- pane.add(PseudotextField);
- pane.add(Pseudolabel);
- pane.add(convertPseudo);
- pane.setBorder(BorderFactory.createEmptyBorder(
- 30, //top
- 30, //left
- 10, //bottom
- 30) //right
- );
-
- return pane;
- }
-
- // Modify the event handler code depending on which button is pressed.
- // If the 1st button is pressed, increase the numClicks value by 1, else
- // increase the value by 1000.
- public void actionPerformed(ActionEvent e) {
- String texteUtilisateur = PseudotextField.getText();
- Pseudolabel.setText("Pseudo: " + texteUtilisateur);
- }
-
- private static void initLookAndFeel() {
-
- // Swing allows you to specify which look and feel your program uses-
- // -Java,
- // GTK+, Windows, and so on as shown below.
- String lookAndFeel = null;
-
- if (LOOKANDFEEL != null) {
- if (LOOKANDFEEL.equals("Metal")) {
- lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName();
- } else if (LOOKANDFEEL.equals("System")) {
- lookAndFeel = UIManager.getSystemLookAndFeelClassName();
- } else if (LOOKANDFEEL.equals("Motif")) {
- lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
- } else if (LOOKANDFEEL.equals("GTK+")) { //new in 1.4.2
- lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
- } else {
- System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL);
- lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName();
- }
-
- try {UIManager.setLookAndFeel(lookAndFeel);
- } catch (ClassNotFoundException e) {
- System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel);
- System.err.println("Did you include the L&F library in the class path?");
- System.err.println("Using the default look and feel.");
- } catch (UnsupportedLookAndFeelException e) {
- System.err.println("Can't use the specified look and feel (" + lookAndFeel+ ") on this platform.");
- System.err.println("Using the default look and feel.");
- } catch (Exception e) {
- System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason.");
- System.err.println("Using the default look and feel.");
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Create the GUI and show it. For thread safety,
- * this method should be invoked from the
- * event-dispatching thread.
- */
- private static void createAndShowGUI() {
- //Set the look and feel.
- initLookAndFeel();
-
- //Make sure we have nice window decorations.
- JFrame.setDefaultLookAndFeelDecorated(true);
-
- //Create and set up the window.
- JFrame frame = new JFrame("SwingApplication");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- Interface app = new Interface();
- Component contents = app.createComponents();
- frame.getContentPane().add(contents, BorderLayout.CENTER);
-
- //Display the window.
- frame.pack();
- frame.setVisible(true);
- }
-
- public static void main(String[] args) {
- //Schedule a job for the event-dispatching thread:
- //creating and showing this application’s GUI.
- javax.swing.SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- createAndShowGUI();
- }
- });
- }
-}
diff --git a/Application/Clavardage/src/RemoteUser.java b/Application/Clavardage/src/RemoteUser.java
deleted file mode 100644
index 3f17913..0000000
--- a/Application/Clavardage/src/RemoteUser.java
+++ /dev/null
@@ -1,67 +0,0 @@
-import java.net.InetAddress;
-
-public class RemoteUser {
-
- InetAddress addIP;
- int portTCP;
- String pseudo;
-
- /*** CONSTRUCTOR of RemoteUser ***/
- public RemoteUser(InetAddress remoteUserIP, int remoteUserPortTCP,String pseudo) {
- this.addIP=remoteUserIP;
- this.portTCP=remoteUserPortTCP;
- this.pseudo=pseudo;
- }
-
- /*** GETTERS ***/
- public InetAddress getRemoteUserIP() {
- return addIP;
- }
- public int getRemoteUserPort() {
- return portTCP;
- }
- public String getPseudo() {
- return pseudo;
- }
-
-
- /*** SETTERS ***/
- public void setRemoteUserIP(InetAddress remoteUserIP) {
- this.addIP = remoteUserIP;
- }
- public void setRemoteUserPort(int remoteUserPort) {
- this.portTCP = remoteUserPort;
- }
- public void setRemotePseudo(String remoteUserpseudo) {
- this.pseudo = remoteUserpseudo;
- }
-
- /*** OVERRIDE METHODS ***/
- /*
- * equals
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RemoteUser other = (RemoteUser) obj;
- if (addIP == null) {
- if (other.addIP != null)
- return false;
- } else if (!addIP.equals(other.addIP))
- return false;
- if (portTCP != other.portTCP)
- return false;
- return true;
- }
-
-
-
-
-
-}
diff --git a/Application/Clavardage/src/User.java b/Application/Clavardage/src/User.java
deleted file mode 100644
index 412451a..0000000
--- a/Application/Clavardage/src/User.java
+++ /dev/null
@@ -1,467 +0,0 @@
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.net.*;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import javax.swing.JOptionPane;
-
-import java.util.ArrayList; // import the ArrayList class
-
-
-public class User{
-
- /*** CONSTANTES ***/
- final static int portUDPlistening_remoteUsr2 = 20002; // TO REMOVE when we use broadcast
- final static int portUDPlistening_remoteUsr3 = 20003; // TO REMOVE when we use broadcast
-
- /*** VARIABLES ***/
- protected InetAddress addIP;
- protected String pseudo;
- protected int portUDPsend;
- protected int portUDPlistening;
- protected int portTCP;
- protected boolean actif;
-
- protected ArrayList
- * On récupère l'adresse de la machine, le numéro de port à utiliser, on demande un pseudo à l'utilisateur
- * que l'on vérifie, une fois validé, l'utilisateur devient actif (Début de l'écoute UDP pour les pseudos et notification aux autres utilisateurs actifs)
- *
- * On récupère l'adresse de la machine, le numéro de port à utiliser, on demande un pseudo à l'utilisateur
- * que l'on vérifie, une fois validé, l'utilisateur devient actif (Début de l'écoute UDP pour les pseudos
- * et notification aux autres utilisateurs actifs)
- *
- * Demande à l'utilisateur de rentrer un pseudo et valide de ce dernier en demandant aux
- * utilisateurs distants leurs informations.
- * On regarde si le pseudo est bien différent de l'ancien
- *
- * Demande à l'utilisateur de rentrer un pseudo et valide de ce dernier en demandant aux
- * utilisateurs distants leurs informations
- *
- * *tmpPseudo : String => Le pseudo à valider
- *
- * Envoi en broadcast (pour l'instant envoi sur les ports de notre ordinateur) d'une demande d'information
- *
- * On attend les réponses pendant 5 secondes
- *
- * On valide le pseudo en fonction des pseudos reçu
- *
- * On en profite pour ajouter les utilisateurs répondant à notre liste d'utilisateur distant (RemoteUser)
- *
- * *remoteUserIP : InetAddress => l'adresse IP de l'utilisateur distant
- *
- * *remoteUserPortTCP : int => le numéro de port TCP d'écoute de l'utilisateur distant
- *
- * *remoteUserPseudo : String => le pseudo de l'utilisateur distant
- *
- * Ajout ou mise à jour l'utilisateur distant dans notre liste d'utilisateur distant
- *
- * En utilisant le port UDP d'envoi, on envoie en broadcast les informations nous concernant
- *
- * On démarre un thread d'écoute UDP pour répondre au nouveaux utilisateurs,
- *
- * On démarre un thread d'écoute TCP pour commencer une conversation avec les utilisateurs actifs,
- *
- * On notifie les utilisateurs distants actifs de notre passage en mode actif (envoi de nos informations)
- *
- * Affichage de la liste d'utilisateurs actifs avec leurs index dans la liste
- *