mirror of
https://github.com/LucasVbr/mini-chat.git
synced 2026-05-13 17:21:54 +00:00
Ajout de javadoc TODO terminer les commentaires
This commit is contained in:
Generated
+204
@@ -0,0 +1,204 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaDocConfiguration">
|
||||
<GENERAL>
|
||||
<MODE>UPDATE</MODE>
|
||||
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
|
||||
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
|
||||
<LEVELS>
|
||||
<LEVEL>FIELD</LEVEL>
|
||||
<LEVEL>METHOD</LEVEL>
|
||||
<LEVEL>TYPE</LEVEL>
|
||||
</LEVELS>
|
||||
<VISIBILITIES>
|
||||
<VISIBILITY>PROTECTED</VISIBILITY>
|
||||
<VISIBILITY>DEFAULT</VISIBILITY>
|
||||
<VISIBILITY>PUBLIC</VISIBILITY>
|
||||
</VISIBILITIES>
|
||||
</GENERAL>
|
||||
<TEMPLATES>
|
||||
<CLASSES>
|
||||
<CLASS>
|
||||
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
|
||||
<VALUE>/**\n
|
||||
* The interface ${name}.\n
|
||||
<#if element.typeParameters?has_content> * \n
|
||||
</#if>
|
||||
<#list element.typeParameters as typeParameter>
|
||||
* @param <${typeParameter.name}> the type parameter\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</CLASS>
|
||||
<CLASS>
|
||||
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
|
||||
<VALUE>/**\n
|
||||
* The enum ${name}.\n
|
||||
*/</VALUE>
|
||||
</CLASS>
|
||||
<CLASS>
|
||||
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
|
||||
<VALUE>/**\n
|
||||
* The type ${name}.\n
|
||||
<#if element.typeParameters?has_content> * \n
|
||||
</#if>
|
||||
<#list element.typeParameters as typeParameter>
|
||||
* @param <${typeParameter.name}> the type parameter\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</CLASS>
|
||||
<CLASS>
|
||||
<KEY>.+</KEY>
|
||||
<VALUE>/**\n
|
||||
* The type ${name}.\n
|
||||
*/</VALUE>
|
||||
</CLASS>
|
||||
</CLASSES>
|
||||
<CONSTRUCTORS>
|
||||
<CONSTRUCTOR>
|
||||
<KEY>.+</KEY>
|
||||
<VALUE>/**\n
|
||||
* Instantiates a new ${name}.\n
|
||||
<#if element.parameterList.parameters?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.parameterList.parameters as parameter>
|
||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||
</#list>
|
||||
<#if element.throwsList.referenceElements?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.throwsList.referenceElements as exception>
|
||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</CONSTRUCTOR>
|
||||
</CONSTRUCTORS>
|
||||
<METHODS>
|
||||
<METHOD>
|
||||
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+</KEY>
|
||||
<VALUE>/**\n
|
||||
* Gets ${partName}.\n
|
||||
<#if element.typeParameters?has_content> * \n
|
||||
</#if>
|
||||
<#list element.typeParameters as typeParameter>
|
||||
* @param <${typeParameter.name}> the type parameter\n
|
||||
</#list>
|
||||
<#if element.parameterList.parameters?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.parameterList.parameters as parameter>
|
||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||
</#list>
|
||||
<#if isNotVoid>
|
||||
*\n
|
||||
* @return the ${partName}\n
|
||||
</#if>
|
||||
<#if element.throwsList.referenceElements?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.throwsList.referenceElements as exception>
|
||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</METHOD>
|
||||
<METHOD>
|
||||
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+</KEY>
|
||||
<VALUE>/**\n
|
||||
* Sets ${partName}.\n
|
||||
<#if element.typeParameters?has_content> * \n
|
||||
</#if>
|
||||
<#list element.typeParameters as typeParameter>
|
||||
* @param <${typeParameter.name}> the type parameter\n
|
||||
</#list>
|
||||
<#if element.parameterList.parameters?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.parameterList.parameters as parameter>
|
||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||
</#list>
|
||||
<#if isNotVoid>
|
||||
*\n
|
||||
* @return the ${partName}\n
|
||||
</#if>
|
||||
<#if element.throwsList.referenceElements?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.throwsList.referenceElements as exception>
|
||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</METHOD>
|
||||
<METHOD>
|
||||
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
|
||||
<VALUE>/**\n
|
||||
* The entry point of application.\n
|
||||
|
||||
<#if element.parameterList.parameters?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
* @param ${element.parameterList.parameters[0].name} the input arguments\n
|
||||
<#if element.throwsList.referenceElements?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.throwsList.referenceElements as exception>
|
||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</METHOD>
|
||||
<METHOD>
|
||||
<KEY>.+</KEY>
|
||||
<VALUE>/**\n
|
||||
* ${name}<#if isNotVoid> ${return}</#if>.\n
|
||||
<#if element.typeParameters?has_content> * \n
|
||||
</#if>
|
||||
<#list element.typeParameters as typeParameter>
|
||||
* @param <${typeParameter.name}> the type parameter\n
|
||||
</#list>
|
||||
<#if element.parameterList.parameters?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.parameterList.parameters as parameter>
|
||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||
</#list>
|
||||
<#if isNotVoid>
|
||||
*\n
|
||||
* @return the ${return}\n
|
||||
</#if>
|
||||
<#if element.throwsList.referenceElements?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.throwsList.referenceElements as exception>
|
||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</METHOD>
|
||||
</METHODS>
|
||||
<FIELDS>
|
||||
<FIELD>
|
||||
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
|
||||
<VALUE>/**\n
|
||||
* The constant ${element.getName()}.\n
|
||||
*/</VALUE>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
|
||||
<VALUE>/**\n
|
||||
<#if element.parent.isInterface()>
|
||||
* The constant ${element.getName()}.\n
|
||||
<#else>
|
||||
* The ${name}.\n
|
||||
</#if> */</VALUE>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<KEY>.+</KEY>
|
||||
<VALUE>/**\n
|
||||
<#if element.parent.isEnum()>
|
||||
*${name} ${typeName}.\n
|
||||
<#else>
|
||||
* The ${name}.\n
|
||||
</#if>*/</VALUE>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
</TEMPLATES>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+3
-3
@@ -11,9 +11,6 @@
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
@@ -38,6 +35,9 @@
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
|
||||
Generated
+145
-47
@@ -2,17 +2,26 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/ui/FenetreClient.form" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/ui/FenetreClient.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/ui/FenetreErreur.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/ui/FenetreServeur.form" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/ui/FenetreServeur.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/intellij-javadocs-4.0.1.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/uiDesigner.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/client/Client.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/client/Client.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/client/ListenThread.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/client/ListenThread.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/serveur/Server.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/server/Server.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/serveur/ThreadServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/server/ThreadServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/server/Server.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/server/Server.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/server/ThreadServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/server/ThreadServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/ui/FenetreClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ui/FenetreClient.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/ui/FenetreErreur.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ui/FenetreErreur.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/ui/FenetreServeur.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ui/FenetreServeur.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/utils/AES.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/AES.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/utils/RSA.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/RSA.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/utils/ResolutionDeNom.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/ResolutionDeNom.java" afterDir="false" />
|
||||
</list>
|
||||
<list id="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" name="Changes by burgu" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/src/client/Client.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/client/Client.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/client/ListenThread.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/client/ListenThread.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/server/Server.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/server/Server.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/server/ThreadServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/server/ThreadServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/ui/FenetreServeur.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ui/FenetreServeur.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -31,6 +40,92 @@
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="LineStatusTrackerManager">
|
||||
<file path="$PROJECT_DIR$/src/client/ListenThread.java">
|
||||
<ranges>
|
||||
<range start1="0" end1="0" start2="0" end2="6" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="10" end1="11" start2="16" end2="21" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="14" end1="14" start2="24" end2="25" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="15" end1="15" start2="26" end2="28" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="17" end1="17" start2="30" end2="35" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="22" end1="22" start2="40" end2="46" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="47" end1="48" start2="71" end2="72" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
</ranges>
|
||||
</file>
|
||||
<file path="$PROJECT_DIR$/src/server/Server.java">
|
||||
<ranges>
|
||||
<range start1="0" end1="0" start2="0" end2="6" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="8" end1="9" start2="14" end2="22" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="10" end1="10" start2="23" end2="26" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="11" end1="11" start2="27" end2="31" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="12" end1="12" start2="32" end2="36" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="14" end1="14" start2="38" end2="43" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="17" end1="18" start2="46" end2="46" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="21" end1="21" start2="49" end2="55" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="35" end1="36" start2="69" end2="70" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="37" end1="37" start2="71" end2="72" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="39" end1="40" start2="74" end2="75" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="41" end1="41" start2="76" end2="77" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="42" end1="43" start2="78" end2="78" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="50" end1="55" start2="85" end2="85" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
</ranges>
|
||||
</file>
|
||||
<file path="$PROJECT_DIR$/src/client/Client.java">
|
||||
<ranges>
|
||||
<range start1="0" end1="0" start2="0" end2="6" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="7" end1="8" start2="13" end2="13" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="20" end1="20" start2="25" end2="33" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="22" end1="22" start2="35" end2="36" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="26" end1="26" start2="40" end2="42" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="28" end1="30" start2="44" end2="44" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="31" end1="31" start2="45" end2="46" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="36" end1="36" start2="51" end2="69" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="48" end1="48" start2="81" end2="88" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="105" end1="105" start2="145" end2="150" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="113" end1="113" start2="158" end2="163" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="118" end1="118" start2="168" end2="174" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="125" end1="126" start2="181" end2="182" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
</ranges>
|
||||
</file>
|
||||
<file path="$PROJECT_DIR$/src/ui/FenetreServeur.java">
|
||||
<ranges>
|
||||
<range start1="0" end1="0" start2="0" end2="6" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="5" end1="5" start2="11" end2="12" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="6" end1="6" start2="13" end2="20" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="12" end1="12" start2="26" end2="30" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="14" end1="14" start2="32" end2="35" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="18" end1="18" start2="39" end2="40" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="19" end1="19" start2="41" end2="43" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="20" end1="20" start2="44" end2="45" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="27" end1="27" start2="52" end2="55" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="29" end1="29" start2="57" end2="59" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="32" end1="32" start2="62" end2="63" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="36" end1="36" start2="67" end2="72" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="38" end1="39" start2="74" end2="75" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="45" end1="45" start2="81" end2="86" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
</ranges>
|
||||
</file>
|
||||
<file path="$PROJECT_DIR$/src/server/ThreadServer.java">
|
||||
<ranges>
|
||||
<range start1="0" end1="0" start2="0" end2="6" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="12" end1="12" start2="18" end2="26" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="15" end1="15" start2="29" end2="32" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="16" end1="16" start2="33" end2="37" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="17" end1="17" start2="38" end2="42" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="18" end1="18" start2="43" end2="47" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="19" end1="19" start2="48" end2="53" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="20" end1="21" start2="54" end2="58" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="23" end1="23" start2="60" end2="67" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="32" end1="32" start2="76" end2="84" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="72" end1="72" start2="124" end2="130" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="80" end1="80" start2="138" end2="146" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="85" end1="85" start2="151" end2="158" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="88" end1="90" start2="161" end2="166" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
<range start1="92" end1="92" start2="168" end2="175" changelist="ecb4d6c3-70b5-4e80-ba94-fcec6f42612f" />
|
||||
<range start1="96" end1="98" start2="179" end2="184" changelist="79e91d13-7d5f-4b9a-954b-9bc7cde074fc" />
|
||||
</ranges>
|
||||
</file>
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
@@ -42,26 +137,27 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Downloaded.Files.Path.Enabled": "false",
|
||||
"Repository.Attach.Annotations": "false",
|
||||
"Repository.Attach.JavaDocs": "false",
|
||||
"Repository.Attach.Sources": "false",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"codeWithMe.voiceChat.enabledByDefault": "false",
|
||||
"com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary": "JUnit5",
|
||||
"com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.JUnit5": "",
|
||||
"create.test.in.the.same.root": "true",
|
||||
"last_opened_file_path": "/Users/lucas/Documents/GitHub/projet-mini-chat/src/serveur",
|
||||
"project.structure.last.edited": "Modules",
|
||||
"project.structure.proportion": "0.15",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Downloaded.Files.Path.Enabled": "false",
|
||||
"Repository.Attach.Annotations": "false",
|
||||
"Repository.Attach.JavaDocs": "false",
|
||||
"Repository.Attach.Sources": "false",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"codeWithMe.voiceChat.enabledByDefault": "false",
|
||||
"com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary": "JUnit5",
|
||||
"com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.JUnit5": "",
|
||||
"create.test.in.the.same.root": "true",
|
||||
"last_opened_file_path": "/Users/lucas/Documents/GitHub/projet-mini-chat/src/serveur",
|
||||
"project.structure.last.edited": "Modules",
|
||||
"project.structure.proportion": "0.15",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"settings.editor.selected.configurable": "reference.settings.ide.settings.uml"
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/serveur" />
|
||||
@@ -77,7 +173,20 @@
|
||||
<recent name="utils" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Application.FenetreServeur">
|
||||
<component name="RunManager" selected="Application.Server">
|
||||
<configuration name="App" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="ui.App" />
|
||||
<module name="projet-mini-chat" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="ui.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Client" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="client.Client" />
|
||||
<module name="projet-mini-chat" />
|
||||
@@ -143,37 +252,21 @@
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="ResolutionDeNomTest.getIPAddress" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||
<module name="projet-mini-chat" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="utils.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<option name="PACKAGE_NAME" value="utils" />
|
||||
<option name="MAIN_CLASS_NAME" value="utils.ResolutionDeNomTest" />
|
||||
<option name="METHOD_NAME" value="getIPAddress" />
|
||||
<option name="TEST_OBJECT" value="method" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<list>
|
||||
<item itemvalue="Application.ui.FenetreClient (1)" />
|
||||
<item itemvalue="Application.App" />
|
||||
<item itemvalue="Application.Client" />
|
||||
<item itemvalue="Application.FenetreServeur" />
|
||||
<item itemvalue="Application.ui.FenetreClient" />
|
||||
<item itemvalue="Application.Server" />
|
||||
<item itemvalue="JUnit.ResolutionDeNomTest.getIPAddress" />
|
||||
</list>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.Server" />
|
||||
<item itemvalue="Application.App" />
|
||||
<item itemvalue="Application.FenetreServeur" />
|
||||
<item itemvalue="Application.ui.FenetreClient" />
|
||||
<item itemvalue="Application.Client" />
|
||||
<item itemvalue="Application.Server" />
|
||||
<item itemvalue="Application.Client" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
@@ -189,6 +282,7 @@
|
||||
<workItem from="1669119772164" duration="6834000" />
|
||||
<workItem from="1669724625302" duration="6630000" />
|
||||
<workItem from="1670230395395" duration="19588000" />
|
||||
<workItem from="1670329829454" duration="6293000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@@ -206,4 +300,8 @@
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
<select />
|
||||
</component>
|
||||
</project>
|
||||
+60
-4
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Client.java, 06/12/2022
|
||||
* INU Champollion, 2022-2023
|
||||
* pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package client;
|
||||
|
||||
import ui.FenetreClient;
|
||||
@@ -5,7 +11,6 @@ import ui.FenetreErreur;
|
||||
import utils.RSA;
|
||||
import utils.ResolutionDeNom;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
@@ -18,22 +23,50 @@ import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Utilisateur Client
|
||||
*
|
||||
* @author Gaël Burguès
|
||||
* @author Laurian Dufrechou
|
||||
* @author Lucàs Vabre
|
||||
*/
|
||||
|
||||
public class Client extends Thread{
|
||||
|
||||
//elements d'un client
|
||||
private final String SERVER_IP;
|
||||
private final int SERVER_PORT;
|
||||
private final FenetreClient fenetre;
|
||||
private String pseudo;
|
||||
|
||||
private final Scanner scanner;
|
||||
private KeyPair clientKeys;
|
||||
private PublicKey serverKey;
|
||||
|
||||
private final Scanner scanner;
|
||||
|
||||
// Sockets de connexion
|
||||
private ObjectInputStream inputStream;
|
||||
private ObjectOutputStream outputStream;
|
||||
|
||||
private ArrayList<String> fileAttenteMessage;
|
||||
|
||||
public Client(String ip, int port) {
|
||||
this.SERVER_IP = ResolutionDeNom.getIPAddress(ip);
|
||||
this.SERVER_PORT = port;
|
||||
this.pseudo = null;
|
||||
this.fenetre = null;
|
||||
|
||||
this.scanner = new Scanner(System.in);
|
||||
this.clientKeys = RSA.genererCle();
|
||||
|
||||
this.fileAttenteMessage = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* ancien object client sans fenetre
|
||||
* @param ip adresse ip du client
|
||||
* @param port numeros de port du client
|
||||
* @param pseudo pseudo du client
|
||||
*/
|
||||
public Client(String ip, int port, String pseudo) {
|
||||
this.SERVER_IP = ResolutionDeNom.getIPAddress(ip);
|
||||
this.SERVER_PORT = port;
|
||||
@@ -46,6 +79,13 @@ public class Client extends Thread{
|
||||
this.fileAttenteMessage = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Object client actuel
|
||||
* @param ip adresse ip du client
|
||||
* @param port numeros de port du client
|
||||
* @param pseudo nom du client
|
||||
* @param fenetre fenetreClient assicié au client
|
||||
*/
|
||||
public Client(String ip, int port, String pseudo, FenetreClient fenetre) {
|
||||
this.SERVER_IP = ResolutionDeNom.getIPAddress(ip);
|
||||
this.SERVER_PORT = port;
|
||||
@@ -103,6 +143,11 @@ public class Client extends Thread{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* envoie la clef client au serveur
|
||||
* @throws IOException
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
public void exchangeKeys() throws IOException, ClassNotFoundException {
|
||||
// Envoie sa clé
|
||||
outputStream.writeObject(clientKeys.getPublic());
|
||||
@@ -111,11 +156,22 @@ public class Client extends Thread{
|
||||
serverKey = (PublicKey) inputStream.readObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* envoie un message dans la socket
|
||||
* @param message message a envoyer au serveur
|
||||
* @throws IOException
|
||||
*/
|
||||
public void sendMessage(String message) throws IOException {
|
||||
byte[] messageCrypte = RSA.encrypter(message, serverKey);
|
||||
outputStream.writeObject(messageCrypte);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupere un message evoye par le serveur
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
public String getMessage() throws IOException, ClassNotFoundException {
|
||||
byte[] messageCrypte = (byte[]) inputStream.readObject();
|
||||
return RSA.decrypter(messageCrypte, clientKeys.getPrivate());
|
||||
@@ -123,7 +179,7 @@ public class Client extends Thread{
|
||||
|
||||
/**
|
||||
* Ajoute un message à la file d'attente
|
||||
* @param message
|
||||
* @param message messsage a ajouter a la file
|
||||
*/
|
||||
public void addMessage(String message) {
|
||||
this.fileAttenteMessage.add(message);
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* ListenThread.java, 06/12/2022
|
||||
* INU Champollion, 2022-2023
|
||||
* pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package client;
|
||||
|
||||
import ui.FenetreClient;
|
||||
@@ -8,18 +14,36 @@ import java.io.IOException;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
* Thread for clients
|
||||
* Écoute des messages du serveur
|
||||
*
|
||||
* @author Gaël Burguès
|
||||
* @author Laurian Dufrechou
|
||||
* @author Lucàs Vabre
|
||||
*/
|
||||
public class ListenThread extends Thread {
|
||||
|
||||
/** Instance du client */
|
||||
private final Client client;
|
||||
|
||||
/** Interface utilisateur du client */
|
||||
private final FenetreClient fenetre;
|
||||
|
||||
/**
|
||||
* Crée un nouveau thread
|
||||
*
|
||||
* @param client Le client lié à cette écoute
|
||||
*/
|
||||
public ListenThread(Client client) {
|
||||
this.client = client;
|
||||
this.fenetre = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object d'ecoute avec fenetre
|
||||
*
|
||||
* @param client client associe à l'ecoute
|
||||
* @param fenetre fenetreClient associe à l'ecoute
|
||||
*/
|
||||
public ListenThread(Client client, FenetreClient fenetre) {
|
||||
this.client = client;
|
||||
this.fenetre = fenetre;
|
||||
@@ -45,7 +69,7 @@ public class ListenThread extends Thread {
|
||||
new FenetreErreur("Connexion perdue", fenetre);
|
||||
fenetre.deconnexion();
|
||||
}
|
||||
}catch (IOException | ClassNotFoundException e) {
|
||||
} catch (IOException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
+40
-10
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Server.java, 06/12/2022
|
||||
* INU Champollion, 2022-2023
|
||||
* pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package server;
|
||||
|
||||
import ui.FenetreServeur;
|
||||
@@ -6,19 +12,47 @@ import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Server extends Thread{
|
||||
/**
|
||||
* serveur
|
||||
*
|
||||
* @author Gaël Burguès
|
||||
* @author Laurian Dufrechou
|
||||
* @author Lucàs Vabre
|
||||
*/
|
||||
public class Server extends Thread {
|
||||
|
||||
/**
|
||||
* Le port de connexion du serveur
|
||||
*/
|
||||
private final int PORT;
|
||||
|
||||
/**
|
||||
* La liste des threads, connexion aux clients
|
||||
*/
|
||||
private final ArrayList<ThreadServer> threads;
|
||||
|
||||
/**
|
||||
* Interface graphique du serveur
|
||||
*/
|
||||
private final FenetreServeur fenetre;
|
||||
|
||||
/**
|
||||
* Crée un nouveau serveur qui n'est pas lié à une interface
|
||||
*
|
||||
* @param port Numéro de port du serveur
|
||||
*/
|
||||
public Server(int port) {
|
||||
this.PORT = port;
|
||||
this.threads = new ArrayList<>();
|
||||
|
||||
this.fenetre = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée un nouveau serveur lié à une interface
|
||||
*
|
||||
* @param port Numéros de port du serveur
|
||||
* @param fenetre Interface utilisateur du serveur
|
||||
*/
|
||||
public Server(int port, FenetreServeur fenetre) {
|
||||
this.PORT = port;
|
||||
this.fenetre = fenetre;
|
||||
@@ -33,14 +67,15 @@ public class Server extends Thread{
|
||||
fenetre.displayNewMessage(msg);
|
||||
|
||||
while (true) {
|
||||
Socket socket = serversocket.accept();
|
||||
Socket socket = serversocket.accept(); // Une nouvelle connexion !
|
||||
|
||||
// Messages
|
||||
String connexionMessage = String.format("Nouvelle connexion : %s\n", socket);
|
||||
System.out.printf(connexionMessage);
|
||||
fenetre.displayNewMessage(connexionMessage);
|
||||
if (fenetre != null) fenetre.displayNewMessage(connexionMessage);
|
||||
|
||||
// Crée le thread d'écoute du client et l'ajoute dans la liste et le démarre
|
||||
ThreadServer thread = new ThreadServer(socket, threads, fenetre);
|
||||
|
||||
threads.add(thread);
|
||||
thread.start();
|
||||
}
|
||||
@@ -48,9 +83,4 @@ public class Server extends Thread{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Server serveur = new Server(4444);
|
||||
serveur.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* ThreadServer.java, 06/12/2022
|
||||
* INU Champollion, 2022-2023
|
||||
* pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package server;
|
||||
|
||||
import ui.FenetreServeur;
|
||||
@@ -10,17 +16,55 @@ import java.security.PublicKey;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Thread dédié à l'écoute de message venant d'un client
|
||||
*
|
||||
* @author Gaël Burguès
|
||||
* @author Laurian Dufrechou
|
||||
* @author Lucàs Vabre
|
||||
* @see Thread
|
||||
*/
|
||||
|
||||
public class ThreadServer extends Thread {
|
||||
|
||||
/**
|
||||
* Référence des autres threads entre le serveur et d'autres clients
|
||||
*/
|
||||
private final ArrayList<ThreadServer> threads;
|
||||
|
||||
/**
|
||||
* Flux d'entrée du socket
|
||||
*/
|
||||
private final ObjectInputStream inputStream;
|
||||
|
||||
/**
|
||||
* Flux de sortie du socket
|
||||
*/
|
||||
private final ObjectOutputStream outputStream;
|
||||
|
||||
/**
|
||||
* Les clés RSA du serveur
|
||||
*/
|
||||
private final KeyPair serverKeys;
|
||||
private final FenetreServeur fenetre;
|
||||
private PublicKey clientKey;
|
||||
|
||||
/**
|
||||
* Interface graphique
|
||||
*/
|
||||
private final FenetreServeur fenetre;
|
||||
|
||||
/**
|
||||
* Pseudo du client
|
||||
*/
|
||||
private String clientPseudo;
|
||||
|
||||
/**
|
||||
* Crée un thread pour initialiser la connexion entre le serveur et un client(socket) sans interface
|
||||
*
|
||||
* @param socket Socket du client
|
||||
* @param threads Référence vers la liste des autres threads du serveur
|
||||
* @throws IOException Si le serveur n'arrive pas à récupérer les flux d'entrée/sortie du socket client
|
||||
*/
|
||||
public ThreadServer(Socket socket, ArrayList<ThreadServer> threads) throws IOException {
|
||||
this.threads = threads;
|
||||
this.fenetre = null;
|
||||
@@ -30,6 +74,14 @@ public class ThreadServer extends Thread {
|
||||
this.serverKeys = RSA.genererCle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée un thread pour initialiser la connexion entre le serveur et un client(socket) avec une interface
|
||||
*
|
||||
* @param socket Socket du client
|
||||
* @param threads Référence vers la liste des autres threads du serveur
|
||||
* @param fenetre Interface graphique
|
||||
* @throws IOException Si le serveur n'arrive pas à récupérer les flux d'entrée/sortie du socket client
|
||||
*/
|
||||
public ThreadServer(Socket socket, ArrayList<ThreadServer> threads, FenetreServeur fenetre) throws IOException {
|
||||
this.threads = threads;
|
||||
this.fenetre = fenetre;
|
||||
@@ -70,6 +122,12 @@ public class ThreadServer extends Thread {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie la cle public du serveur à la reception de celle du client
|
||||
*
|
||||
* @throws IOException Erreur de connexion avec le socket
|
||||
* @throws ClassNotFoundException La classe {@link PublicKey} n'est pas trouvée
|
||||
*/
|
||||
public void exchangeKeys() throws IOException, ClassNotFoundException {
|
||||
// Attend la clé du client
|
||||
clientKey = (PublicKey) inputStream.readObject();
|
||||
@@ -78,23 +136,51 @@ public class ThreadServer extends Thread {
|
||||
outputStream.writeObject(serverKeys.getPublic());
|
||||
}
|
||||
|
||||
/**
|
||||
* Attend un message du client (fonction bloquante)
|
||||
*
|
||||
* @return Le message reçu
|
||||
* @throws EOFException Le socket est fermé
|
||||
* @throws IOException Erreur de connexion avec le socket
|
||||
* @throws ClassNotFoundException La classe byte[] n'est pas trouvée
|
||||
*/
|
||||
public String getMessage() throws EOFException, IOException, ClassNotFoundException {
|
||||
byte[] messageCrypte = (byte[]) inputStream.readObject();
|
||||
return RSA.decrypter(messageCrypte, serverKeys.getPrivate());
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie un message au client
|
||||
*
|
||||
* @param message message envoyé au client
|
||||
* @param log Si vrai affiche dans la console
|
||||
* @throws IOException Erreur de connexion avec le socket
|
||||
*/
|
||||
public void sendMessage(String message, boolean log) throws IOException {
|
||||
byte[] messageCrypte = RSA.encrypter(message, clientKey);
|
||||
outputStream.writeObject(messageCrypte);
|
||||
if (log) System.out.println(message);
|
||||
if (log && fenetre != null) {fenetre.displayNewMessage(message);}
|
||||
|
||||
// Log
|
||||
if (!log) return;
|
||||
System.out.println(message);
|
||||
if (fenetre != null) fenetre.displayNewMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie un message à tous les clients connecté au serveur
|
||||
*
|
||||
* @param message Message à envoyer à tous les clients
|
||||
* @param log si vrai affiche dans la console
|
||||
* @throws IOException Erreur de connexion avec un des sockets du serveur
|
||||
*/
|
||||
public void sendMessageToEveryone(String message, boolean log) throws IOException {
|
||||
for (ThreadServer thread : threads) {
|
||||
thread.sendMessage(message, false);
|
||||
}
|
||||
if (log) System.out.println(message);
|
||||
if (log && fenetre != null) {fenetre.displayNewMessage(message);}
|
||||
|
||||
// Log
|
||||
if (!log) return;
|
||||
System.out.println(message);
|
||||
if (fenetre != null) fenetre.displayNewMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
/*
|
||||
* FenetreClient.java, 06/12/2022
|
||||
* INU Champollion, 2022-2023
|
||||
* pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package ui;
|
||||
|
||||
import client.Client;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
@@ -10,6 +17,13 @@ import java.awt.event.WindowEvent;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Interface du client
|
||||
*
|
||||
* @author Gaël Burguès
|
||||
* @author Laurian Dufrechou
|
||||
* @author Lucàs Vabre
|
||||
*/
|
||||
public class FenetreClient extends JFrame {
|
||||
private JTextField addressInput, portInput, pseudoInput, messageInput;
|
||||
private JButton connexionButton, envoyerButton, deconnexionButton;
|
||||
@@ -17,14 +31,22 @@ public class FenetreClient extends JFrame {
|
||||
private JTextArea chatArea;
|
||||
private JScrollPane scrollPane;
|
||||
|
||||
/**
|
||||
* Le client lié à cette fenêtre
|
||||
*/
|
||||
private Client client;
|
||||
|
||||
/**
|
||||
* Crée une nouvelle fenêtre client
|
||||
*/
|
||||
public FenetreClient() {
|
||||
super("Fenêtre client");
|
||||
add(mainPanel);
|
||||
|
||||
// On ne peut pas saisir dans la boîte de dialogue directement
|
||||
// Configure le tchat
|
||||
chatArea.setEnabled(false);
|
||||
chatArea.setLineWrap(true);
|
||||
chatArea.setDisabledTextColor(Color.BLACK);
|
||||
|
||||
// Au lancement, on ne peut pas envoyer de message sans être connecté au serveur
|
||||
messageInput.setEnabled(false);
|
||||
@@ -41,9 +63,11 @@ public class FenetreClient extends JFrame {
|
||||
envoyerButton.addActionListener(e -> envoyerMessage());
|
||||
deconnexionButton.addActionListener(e -> deconnexion());
|
||||
|
||||
// Quand on clique sur fermer la fenêtre, on ferme la connexion
|
||||
// Quand on clique sur fermer la fenêtre, on ferme la connexion.
|
||||
this.addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {deconnexion();}
|
||||
public void windowClosing(WindowEvent e) {
|
||||
deconnexion();
|
||||
}
|
||||
});
|
||||
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
@@ -51,6 +75,9 @@ public class FenetreClient extends JFrame {
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère la saisie de l'utilisateur et l'envoie au serveur
|
||||
*/
|
||||
private void envoyerMessage() {
|
||||
{
|
||||
String message = this.messageInput.getText();
|
||||
@@ -66,6 +93,9 @@ public class FenetreClient extends JFrame {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée un client et le connecte au serveur à partir de l'IP et port du serveur avec le pseudo du client.
|
||||
*/
|
||||
public void connexion() {
|
||||
String address = addressInput.getText();
|
||||
int port = Integer.parseInt(portInput.getText());
|
||||
@@ -80,14 +110,19 @@ public class FenetreClient extends JFrame {
|
||||
this.client = new Client(address, port, pseudo, this);
|
||||
this.client.start();
|
||||
|
||||
// Désactive le formulaire de connexion
|
||||
addressInput.setEnabled(false);
|
||||
portInput.setEnabled(false);
|
||||
pseudoInput.setEnabled(false);
|
||||
|
||||
// Active l'interface de tchat
|
||||
messageInput.setEnabled(true);
|
||||
envoyerButton.setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Déconnecte le client du serveur
|
||||
*/
|
||||
public void deconnexion() {
|
||||
if (client == null) return;
|
||||
|
||||
@@ -95,28 +130,36 @@ public class FenetreClient extends JFrame {
|
||||
this.client.addMessage("bye");
|
||||
this.client = null;
|
||||
|
||||
// Vide le chat
|
||||
// Vide le tchat
|
||||
this.chatArea.setText("");
|
||||
|
||||
// Active les boutons pour changer de serveur
|
||||
// Active le formulaire de connexion
|
||||
addressInput.setEnabled(true);
|
||||
portInput.setEnabled(true);
|
||||
pseudoInput.setEnabled(true);
|
||||
|
||||
// Désactive les commandes de chats
|
||||
// Désactive l'interface de tchat
|
||||
messageInput.setEnabled(false);
|
||||
envoyerButton.setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche un nouveau message dans la fenêtre de tchat
|
||||
* @param message message à afficher dans le tchat
|
||||
*/
|
||||
public void displayNewMessage(String message) {
|
||||
// Ajoute le message
|
||||
chatArea.append(message + "\n");
|
||||
// Ajoute le message dans l'interface de tchat
|
||||
chatArea.append(String.format("%s\n", message));
|
||||
|
||||
// Va en bas de la fenêtre
|
||||
JScrollBar vertical = scrollPane.getVerticalScrollBar();
|
||||
vertical.setValue(vertical.getMaximum());
|
||||
}
|
||||
|
||||
/**
|
||||
* Lance une nouvelle fenêtre de client
|
||||
* @param args non utilisé
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new FenetreClient();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,30 @@
|
||||
/*
|
||||
* FenetreErreur.java, 06/12/2022
|
||||
* INU Champollion, 2022-2023
|
||||
* pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package ui;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Gestion de l'affichage des erreurs pour les utilisateurs
|
||||
*
|
||||
* @author Gaël Burguès
|
||||
* @author Laurian Dufrechou
|
||||
* @author Lucàs Vabre
|
||||
*/
|
||||
public class FenetreErreur {
|
||||
|
||||
/**
|
||||
* Crée une fenêtre d'erreur avec un message
|
||||
*
|
||||
* @param message Message d'erreur
|
||||
* @param parent La fenêtre parente
|
||||
*/
|
||||
public FenetreErreur(String message, JFrame parent) {
|
||||
final String TITLE = "Erreur";
|
||||
JOptionPane.showMessageDialog(parent, message, TITLE, JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new FenetreErreur("Message", null);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,48 @@
|
||||
/*
|
||||
* FenetreServeur.java, 06/12/2022
|
||||
* INU Champollion, 2022-2023
|
||||
* pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package ui;
|
||||
|
||||
import server.Server;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Interface du serveur
|
||||
*
|
||||
* @author Gaël Burguès
|
||||
* @author Laurian Dufrechou
|
||||
* @author Lucàs Vabre
|
||||
*/
|
||||
public class FenetreServeur extends JFrame {
|
||||
private JTextArea chatArea;
|
||||
private JPanel mainPanel;
|
||||
private JScrollPane scrollPane;
|
||||
private JTextField portInput;
|
||||
private JButton demarrerButton;
|
||||
|
||||
/**
|
||||
* Le serveur lié à cette fenêtre
|
||||
*/
|
||||
private Server server;
|
||||
|
||||
/**
|
||||
* Crée une nouvelle fenêtre de serveur
|
||||
*/
|
||||
public FenetreServeur() {
|
||||
super("Fenetre Serveur");
|
||||
add(mainPanel);
|
||||
|
||||
// Configure le tchat
|
||||
chatArea.setEnabled(false);
|
||||
chatArea.setLineWrap(true);
|
||||
chatArea.setDisabledTextColor(Color.BLACK);
|
||||
|
||||
// Actions
|
||||
demarrerButton.addActionListener(e -> demarrerServeur());
|
||||
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
@@ -25,24 +50,40 @@ public class FenetreServeur extends JFrame {
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une nouvelle instance de serveur sur le port saisi par l'utilisateur
|
||||
*/
|
||||
public void demarrerServeur() {
|
||||
int port = Integer.parseInt(portInput.getText());
|
||||
|
||||
// Crée le serveur
|
||||
server = new Server(port, this);
|
||||
server.start();
|
||||
|
||||
// Désactive le formulaire de connexion (la saisie du port et le bouton)
|
||||
portInput.setEnabled(false);
|
||||
demarrerButton.setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche un nouveau message dans le tchat
|
||||
*
|
||||
* @param message Message à afficher
|
||||
*/
|
||||
public void displayNewMessage(String message) {
|
||||
// Ajoute le message
|
||||
chatArea.append(message + "\n");
|
||||
chatArea.append(String.format("%s\n", message));
|
||||
|
||||
// Va en bas de la fenêtre
|
||||
JScrollBar vertical = scrollPane.getVerticalScrollBar();
|
||||
vertical.setValue(vertical.getMaximum());
|
||||
}
|
||||
|
||||
/**
|
||||
* Lance une nouvelle fenêtre de serveur
|
||||
*
|
||||
* @param args non utilisé
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new FenetreServeur();
|
||||
}
|
||||
|
||||
+39
-21
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* AES.java, 06/12/2022
|
||||
* INU Champollion, 2022-2023
|
||||
* pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package utils;
|
||||
|
||||
import javax.crypto.*;
|
||||
@@ -5,14 +11,22 @@ import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.*;
|
||||
|
||||
/**
|
||||
* Gestion du cryptage AES(DES)
|
||||
*
|
||||
* @author Gaël Burguès
|
||||
* @author Laurian Dufrechou
|
||||
* @author Lucàs Vabre
|
||||
*/
|
||||
public class AES {
|
||||
|
||||
/** Nom du fichier de sauvegarde de la clé. */
|
||||
private static final String SAVE_FILE = "key.sav";
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* Génère une clé DES et la renvoie.
|
||||
*
|
||||
* @return
|
||||
* @return La clé générée
|
||||
*/
|
||||
public static Key genererCle() {
|
||||
Key key = null;
|
||||
@@ -26,60 +40,64 @@ public class AES {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* Crypte un message avec une clé.
|
||||
*
|
||||
* @param msg
|
||||
* @param key
|
||||
* @return
|
||||
* @param message La chaîne de caractère à crypter
|
||||
* @param cle La clé de cryptage
|
||||
* @return Le message crypté sous forme d'un tableau d'octets
|
||||
*/
|
||||
public static byte[] encrypter(String msg, Key key) {
|
||||
public static byte[] encrypter(String message, Key cle) {
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("DES");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key);
|
||||
return cipher.doFinal(msg.getBytes());
|
||||
cipher.init(Cipher.ENCRYPT_MODE, cle);
|
||||
return cipher.doFinal(message.getBytes());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* Décrypte un message à partir d'un tableau d'octet et de la clé de cryptage.
|
||||
*
|
||||
* @param message
|
||||
* @param cle
|
||||
* @return
|
||||
* @param messageCrypte Le message crypté
|
||||
* @param cle La clé de cryptage
|
||||
* @return Le message une fois décrypté
|
||||
*/
|
||||
public static String decrypter(byte[] message, Key cle) {
|
||||
public static String decrypter(byte[] messageCrypte, Key cle) {
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("DES");
|
||||
cipher.init(Cipher.DECRYPT_MODE, cle);
|
||||
return new String(cipher.doFinal(message), StandardCharsets.UTF_8);
|
||||
return new String(cipher.doFinal(messageCrypte), StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* Enregistre la clé dans le fichier {@link #SAVE_FILE}.
|
||||
*
|
||||
* @param key
|
||||
* @param cle La clé à sauvegarder
|
||||
*/
|
||||
public static void sauvegarderCle(Key key) {
|
||||
public static void sauvegarderCle(Key cle) {
|
||||
|
||||
try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(SAVE_FILE))) {
|
||||
objectOutputStream.writeObject(key);
|
||||
objectOutputStream.writeObject(cle);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* Charge une clé à partir du fichier de sauvegarde {@link #SAVE_FILE}.
|
||||
*
|
||||
* @return
|
||||
* @return La clé une fois chargée
|
||||
*/
|
||||
public static Key chargerCle() {
|
||||
Key key;
|
||||
|
||||
+41
-9
@@ -1,11 +1,29 @@
|
||||
/*
|
||||
* RSA.java, 06/12/2022
|
||||
* INU Champollion, 2022-2023
|
||||
* pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package utils;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.*;
|
||||
|
||||
/**
|
||||
* Gestion du cryptage RSA.
|
||||
*
|
||||
* @author Gaël Burguès
|
||||
* @author Laurian Dufrechou
|
||||
* @author Lucàs Vabre
|
||||
*/
|
||||
public class RSA {
|
||||
|
||||
/**
|
||||
* Génère une paire de clés RSA et nous les renvoie.
|
||||
*
|
||||
* @return La paire de clé générée (publique et privée)
|
||||
*/
|
||||
public static KeyPair genererCle() {
|
||||
KeyPair keyPair = null;
|
||||
|
||||
@@ -20,22 +38,36 @@ public class RSA {
|
||||
return keyPair;
|
||||
}
|
||||
|
||||
public static byte[] encrypter(String msg, PublicKey key){
|
||||
/**
|
||||
* Crypte un message avec la clé publique.
|
||||
*
|
||||
* @param message La chaîne de caractère à crypter
|
||||
* @param publicKey La clé de cryptage
|
||||
* @return Le message crypté sous forme d'un tableau d'octets
|
||||
*/
|
||||
public static byte[] encrypter(String message, PublicKey publicKey) {
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("RSA") ;
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key) ;
|
||||
return cipher.doFinal(msg.getBytes());
|
||||
} catch(Exception e){
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
return cipher.doFinal(message.getBytes());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String decrypter(byte[] msg, PrivateKey key) {
|
||||
/**
|
||||
* Décrypte un message à partir d'un tableau d'octet et de la clé privée.
|
||||
*
|
||||
* @param message Le message crypté
|
||||
* @param privateKey La clé privée de cryptage
|
||||
* @return Le message une fois décrypté
|
||||
*/
|
||||
public static String decrypter(byte[] message, PrivateKey privateKey) {
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("RSA") ;
|
||||
cipher.init(Cipher.DECRYPT_MODE, key);
|
||||
return new String(cipher.doFinal(msg), StandardCharsets.UTF_8);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
return new String(cipher.doFinal(message), StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,20 +1,33 @@
|
||||
/*
|
||||
* ResolutionDeNom.java, 06/12/2022
|
||||
* INU Champollion, 2022-2023
|
||||
* pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package utils;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* Utilitaire à la gestion des adresses IP.
|
||||
*
|
||||
* @author Gaël Burguès
|
||||
* @author Laurian Dufrechou
|
||||
* @author Lucàs Vabre
|
||||
*/
|
||||
public class ResolutionDeNom {
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* Convertis une URI en on adresse IP
|
||||
*
|
||||
* @param host
|
||||
* @return
|
||||
* @param uri Adresse URI à convertir
|
||||
* @return L'adresse IP correspondante à l'URI
|
||||
*/
|
||||
public static String getIPAddress(String host) {
|
||||
public static String getIPAddress(String uri) {
|
||||
String address = null;
|
||||
try {
|
||||
address = InetAddress.getByName(host).getHostAddress();
|
||||
address = InetAddress.getByName(uri).getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user