From 71f151be8d0eb1e4656490cbb60f9576fd6a9132 Mon Sep 17 00:00:00 2001
From: LMAGallois
Date: Sat, 13 Feb 2021 13:57:48 +0100
Subject: [PATCH] cleaning
---
Application/Clavardage/.classpath | 14 -
Application/Clavardage/.project | 17 -
.../.settings/org.eclipse.jdt.core.prefs | 11 -
Application/Clavardage/bin/.gitignore | 2 -
Application/Clavardage/bin/model/Chat.class | Bin 2086 -> 0 bytes
.../Clavardage/bin/model/LocalUser.class | Bin 4082 -> 0 bytes
.../Clavardage/bin/model/Message.class | Bin 1208 -> 0 bytes
.../Clavardage/bin/model/Msg_Text.class | Bin 767 -> 0 bytes
.../Clavardage/bin/model/RemoteUser.class | Bin 940 -> 0 bytes
Application/Clavardage/bin/model/User.class | Bin 2236 -> 0 bytes
.../Clavardage/bin/view/Interface$1.class | Bin 779 -> 0 bytes
.../Clavardage/bin/view/Interface$2.class | Bin 1280 -> 0 bytes
.../Clavardage/bin/view/Interface$3.class | Bin 1347 -> 0 bytes
.../Clavardage/bin/view/Interface.class | Bin 8519 -> 0 bytes
.../Clavardage/src/controller/Controller.java | 547 ------------------
.../Clavardage/src/controller/Historique.java | 133 -----
.../src/controller/ListeningThread.java | 16 -
.../controller/ListeningThreadTCPChat.java | 141 -----
.../ListeningThreadTCPConnection.java | 91 ---
.../src/controller/ListeningThreadUDP.java | 124 ----
.../src/controller/TListeningTCPChat.java | 141 -----
.../controller/TListeningTCPConnection.java | 92 ---
.../src/controller/TListeningUDP.java | 125 ----
Application/Clavardage/src/model/Chat.java | 69 ---
.../Clavardage/src/model/LocalUser.java | 149 -----
Application/Clavardage/src/model/Message.java | 49 --
.../Clavardage/src/model/Msg_Text.java | 26 -
.../Clavardage/src/model/RemoteUser.java | 18 -
Application/Clavardage/src/model/User.java | 106 ----
.../Clavardage/src/view/Interface.java | 285 ---------
.../Clavardage/src/websocket/Appel.java | 39 --
.../Clavardage/src/websocket/Centralized.java | 5 -
.../Clavardage/src/websocket/Client.java | 26 -
33 files changed, 2226 deletions(-)
delete mode 100644 Application/Clavardage/.classpath
delete mode 100644 Application/Clavardage/.project
delete mode 100644 Application/Clavardage/.settings/org.eclipse.jdt.core.prefs
delete mode 100644 Application/Clavardage/bin/.gitignore
delete mode 100644 Application/Clavardage/bin/model/Chat.class
delete mode 100644 Application/Clavardage/bin/model/LocalUser.class
delete mode 100644 Application/Clavardage/bin/model/Message.class
delete mode 100644 Application/Clavardage/bin/model/Msg_Text.class
delete mode 100644 Application/Clavardage/bin/model/RemoteUser.class
delete mode 100644 Application/Clavardage/bin/model/User.class
delete mode 100644 Application/Clavardage/bin/view/Interface$1.class
delete mode 100644 Application/Clavardage/bin/view/Interface$2.class
delete mode 100644 Application/Clavardage/bin/view/Interface$3.class
delete mode 100644 Application/Clavardage/bin/view/Interface.class
delete mode 100644 Application/Clavardage/src/controller/Controller.java
delete mode 100644 Application/Clavardage/src/controller/Historique.java
delete mode 100644 Application/Clavardage/src/controller/ListeningThread.java
delete mode 100644 Application/Clavardage/src/controller/ListeningThreadTCPChat.java
delete mode 100644 Application/Clavardage/src/controller/ListeningThreadTCPConnection.java
delete mode 100644 Application/Clavardage/src/controller/ListeningThreadUDP.java
delete mode 100644 Application/Clavardage/src/controller/TListeningTCPChat.java
delete mode 100644 Application/Clavardage/src/controller/TListeningTCPConnection.java
delete mode 100644 Application/Clavardage/src/controller/TListeningUDP.java
delete mode 100644 Application/Clavardage/src/model/Chat.java
delete mode 100644 Application/Clavardage/src/model/LocalUser.java
delete mode 100644 Application/Clavardage/src/model/Message.java
delete mode 100644 Application/Clavardage/src/model/Msg_Text.java
delete mode 100644 Application/Clavardage/src/model/RemoteUser.java
delete mode 100644 Application/Clavardage/src/model/User.java
delete mode 100644 Application/Clavardage/src/view/Interface.java
delete mode 100644 Application/Clavardage/src/websocket/Appel.java
delete mode 100644 Application/Clavardage/src/websocket/Centralized.java
delete mode 100644 Application/Clavardage/src/websocket/Client.java
diff --git a/Application/Clavardage/.classpath b/Application/Clavardage/.classpath
deleted file mode 100644
index fb663ea..0000000
--- a/Application/Clavardage/.classpath
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Application/Clavardage/.project b/Application/Clavardage/.project
deleted file mode 100644
index 7ee0ed5..0000000
--- a/Application/Clavardage/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- Clavardage
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/Application/Clavardage/.settings/org.eclipse.jdt.core.prefs b/Application/Clavardage/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 3a21537..0000000
--- a/Application/Clavardage/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,11 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Application/Clavardage/bin/.gitignore b/Application/Clavardage/bin/.gitignore
deleted file mode 100644
index 5e4c200..0000000
--- a/Application/Clavardage/bin/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/websocket/
-/controller/
diff --git a/Application/Clavardage/bin/model/Chat.class b/Application/Clavardage/bin/model/Chat.class
deleted file mode 100644
index da4a6ede67be88068c92e6c4171d2509eaf784b5..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 2086
zcmZ`*+j0{}6ztJm>lFq|mIZ+X69SSPki(tW5wRU^LB_;#oC8ZiN@>+L$7+S)4_q>&If
z{aPN#T1WQUwT+$EPAg!D?{vMu`LXZ#0yB*;VRN*%B#`Mk{l08FeSz7A1{efxr?%qz
z@=e3-2MozJ-F8m~1K$z25*4#-fY(E)r8<+W0q<;jtv!b{&V*S#C#Z#63`ogV;2sb%
zA0BGntDe_!WKSJ0yFE9klU4a7?aH=5VvW^Xh$C-f8U=xPxw4%`k$@3pSeQjV3xTsX
z(#Tl&1Q*gcPio_)nagc_iq8bn2eLD8HhvK(mS0vPI4ZPx8#$a(Z=c&pA|){0aC^@4
zL3hXTx8zQT_02TAmh5ax-&Jd~nFwCFY`JY}QyQ}9nBNu1wVhxrkwBqbIoSb$DTbMb
z6KIY>5oHsz9DNd{nYvk7Whh&In0iDwRqIzareM<;j9)P-&JJTIbjh+in5
z@P$^kM0$u6qc;&H{_>uEHGo_4+3(~XC}wVeIH^?Ej*E8kD=`))622C}uc<;xba1wUq(k7v*hIUTqz
z_l*&)rZ@0g&LdY@HLHAhT`|Etb&m7LCV`kTHs4}uaJZY*?-tiIfqv%*@Hxe^X`JTw
z8LlL=V|-qye!xuiZ_NJu0dt2aRpWo++#xPj7Y=dhtxmtp?;?q=6Awz?X~)tGT8*
z9|b8*g3L#PT!%_h1s_dboJ_tPnS28`Ba$ypCSQ$AzBOufon@#Fr6zi+Bm#>};+jS%
zhEbzFrbd0djXQ?OF|5V0J|R|(Sd0IIbyqi7;2!Q9tX0Fyq9&z<_xSp!NxU0u|IH(K
z)`**hIvx;5;9IN^CzNSbclw3F)%BJXW?YLMa=cBBcaC7DMwlsLDg&=EBQ%5BvGgt9
zp}?oo@h;JoX|mNs=+sHl_Xu)dUl4+1M~>pe8jxQN#j)MrVevg4{fXfTsWe
diff --git a/Application/Clavardage/bin/model/LocalUser.class b/Application/Clavardage/bin/model/LocalUser.class
deleted file mode 100644
index d1eddd85992de52bddf1cf37259360bc4aeeba92..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 4082
zcma)8S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ct2BJ9)d4EuuPj;~llRq1t`Vy
zhPGTawQcRD#_&3}gk@suli1BK<5GETA6UMP;pv_IJxh3akB@cg>he{wXScuI?|B*4
zTNu5KL(`GNOL&xr$Er9U`ILMn`PnIp)BN;T@p$Ag7d=&+iF}5ODxR!jR?M~gt2qBY
zhIuFF-t+3bdrxEKMI2k#;R3CGB!?3JrN;$muV&jIHgNq28|pARaRj}16lambMI6Pm
zIEJej$2FY5-}xs06H^*My9t(S#aPDYNqu4MGQL14rJ&3BA{)a?yMM!%@ElvR6Yt}B
zp8D}+o*VFdfNMbvtN+le!dLKu4LzSguWp{++qg2_zl5(IPY|7NcwT{#sN&jy#6KWB
zvlEEWG%(G1a263ffo?phgN)inYC-nmI}C&KjuY&=_#T6lFhWrOMR$JfD+a9JZngv(U&gyO@8uwD!o+UEZcW_5zc#C|H{{IuUIF6pD
zo=osQr?7jyBa3KH$j-as?`?sr`_&KsUGJt2vK!1UM2a=jXb*pP@Ff?wHX-{Qw;`fc
c)ng~jM`uabQ>qw}zGzmem4Up&y$A39A5jT=TmS$7
diff --git a/Application/Clavardage/bin/model/Message.class b/Application/Clavardage/bin/model/Message.class
deleted file mode 100644
index 647193fcb09abb906f15ca6c747fca6f19e79e5b..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1208
zcmZ`(YflqF6g|_HZdsQWS}1R9DQdeE)(4-!kQfcYq*W8N2_Ls~txNjQ-L27orHM!)
zi9f&}Wjr&x=>xD$W_Rw~d(OFMZuZaLU%vtDVNXL$V5Zw|IUTF+_`cnCG$aIO&+X5)
z)vvi+oIST|5Ejw@ovbE9CN#MD?_JP2ZJqY@qfKdyf-uaHlaPq0!bAv;HOnLmE
z(jeM%a_Wd<#=tbv0`YRCF%2>s(2&xQ6PTcOtj`M;Fj{08L4pNvG$bIF{
zs@JVnt8je0-|g=EzK%KMCFG*OLiwiFN<+i4Kw3c$0=HvHP#sH{(XoaN4eJ8)BjORI
zfx9TMr}s*Lz*dAl1UabOq>~+O8kjs-I^J8m*->8h&+Jaa_FTD-f{EaR
z>&xtkTcMk}ynwKMfqclN%o%B9R&m1Wn~J3QTH6U^5j!p4B3dBDglFNErkOEusk$GX
zy?jF?ZbBrTCD8<3hYcr4c5u=kcxTR$E1Nf>>|JSgqDZ6SoXHsfbW6Q)4*1k~G7X*U
z9qv9Mq4G-RB@A=>0+}n!on~{FSg4!TD=eK}V&x}RFHrohKuTQmgp_Lni-cN24$IiY
z3bq(6gmAcr``iH~IesL|VHOWirW{FMiRe$cmohU$db2t~l_d$V%5{xp>qui`j3zUr
z$wV}SQvFIA6WbAu#it<7l=%b2Z+wYS7ifzN78RfoCPaV&RqQY#EgCP*Trb|bwRm^v
z?;)vTl1h0yvQSsi3bmRFAs=Q9`$%5^Lu_SaJdcKSK}kh*|_5
IbB*E2KVFX4wg3PC
diff --git a/Application/Clavardage/bin/model/Msg_Text.class b/Application/Clavardage/bin/model/Msg_Text.class
deleted file mode 100644
index 39d9e997aa48d9adcd10dd10c45b36adaa9a086b..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 767
zcmZuvO;6iE5Ph3C379nr;iFL60*6Y(P;!7<5E81yDNrG3PL--nvT}_=BH0_n&!Q3^
z5(j<&KML{IcB+POv1i`Qd-G=O=as4>}EYf8D6$^bgtSx`lvPs9o1{8D71M7I_6Ip3skb{qeW<~poV4;
z3CRDA3G9x|oHRO#)LPc_2kUu?OLUc?88^`8cyytK&DtbQU>yF@zR(@haJl1Wi4}aL
z$k|{Rb@Wka*Yif+ckG?9!M;4dlt9iNgptFT7WkZIc1qmVXZ)=Pxc>GXyuVCyDDyd+
zmPnLv;h{ooJ;UZuWkw?Au|P2!*#Wskele5(#cqc+>2Ga6V9EdXj((Y}3fXgszMu9p
zOZDYHeTn5npK8gZJZEtKY*L+X>!RS_!n^kZvY?-X%|H^4NqStXde8g!H;W>aE5By85~|3N$^6imZD>GKXG2>TkI
zqRcYWoQmgs37;k6frfQdxaDa$j{4%QCpV)so$Q{x0d7jXO7h9E$NR)q;i!W=zku4<
zF}E(DeorcjY>QmUd9EtpGJB1*4jNWCk|%rvj3PZASXRw4xespyDp`jxiGkKHR6puh
zFL1r_16vc^((kZg|K0=-^hWBN6YS}aQvZqcpRqr|i*MW}$CSWLrHmE+0#|Xszml4k
N&}e1U2rrXr>mSqK&7lAQ
diff --git a/Application/Clavardage/bin/model/User.class b/Application/Clavardage/bin/model/User.class
deleted file mode 100644
index 05b9e9e5f925cf32d0cdc14ea1777fa9d77ab46b..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 2236
zcmaJ?TT@$A6#jPZoE{2>5V-_MZLPV{Xlu0!p->c?He6aRwXJ9mCuO
zUCwSc?0OJBg~0>sYb#r}Dtp=0odbKfsSv0&>{hX=5H6f-t~cwY%HE8E-zpaKYYI_k
zvtl>1c|I13#k$>S&>>i>)|(rPbWwSN<=1w3B8}NnrPQ2L$Ry6f_QuL5w-kJf3^(A#
zpa~PNDR>jftv)CWneZbZ*06~nLSnscq7Q~aYt+OT#uY;QR%2fvbYNbbCQO`zp)gP=
zRqU14;f`J3uy)Gy2p6imR(Z>+mt^gJ^fmWO4F$7s!W^sY+q0XU(!^eKIg2EcXUk(6
zbRk7T+(^gcEOmweb=d1`oS+W(;7rH~(Z_`ybzQnq#mx|?4z4djUJYdNP7rS^M0Ah4
zqD)-HC57|M=XSNxX|6#PjRtZ3lxiGdP#3j&=}`Ji8MMljk*8Es=wEMIyI(F_HJ8kQ
z{Z-2{2Z_wqXM@sHD^EzXX9b8_^X!@>7CdYb6x^E_AI
zz{3b2mU@PPRQed&)_$4xkqrMJ2=@h_^qC4N4wL`^bAfQ>7G2tB888DX8nX?Lw~(W=B{ak
zsN>}pPJfqEMYhwuup-@9*BSBNE3l+1!hHtQXRyYpfo`lD#QNYBSkhO);{EJmJ!S5q
zuJqv4tS`srM%uWtGB_36pMH*@_eTV$+qm{5CttW5eUj7N_r4^yIZEXw51prE7kKb3
z61b=naK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n{Y
diff --git a/Application/Clavardage/bin/view/Interface$3.class b/Application/Clavardage/bin/view/Interface$3.class
deleted file mode 100644
index d9d6279b2a74f1224ace423df9941f75325bd38a..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1347
zcmaJ>X;TwH5PbuYO~P^*4pC8}Moq%8DtKTJ9Qgzus?uK7R!;hE)ws44pfcs2Vv(3U8AaMPgJ#h@t;2
z-{A(YN<-`jM;fm!$8@VxCNGm6L;DW56GhjNo@?9c;6nazXUrU2WEdjKbkpM{!O)#o
zZr>Yz)pE9sg{(Ryla>j~vE(GfNb(Ffr@c$9GlXVbQ$)bfrsEu1)T%>=hHwp<6`HVgiAAC-iU~|=
zctTkPh>misySv3IVHf>x_Sa}P=ozXItY8hk046-t+X1ay|U{_5AH!v5AC5ny^qchfngVoEo2CMM>man
zu1S+p@v5_Wa{V7Xlie%
zVdgMajJyCpkibt2;ul8oJBZs`_uYuAK8QIiP~>L3Ap0idu}E_WOISgHRw_A#ntp!)
DYm8Iz
diff --git a/Application/Clavardage/bin/view/Interface.class b/Application/Clavardage/bin/view/Interface.class
deleted file mode 100644
index b0ebed023a4de87f902250fba645a411af752848..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 8519
zcma)B3w%`NmH(eSm|?s?9`c9}90f5CNCd$L-~&Q}fjrO^+lD64?=Bi)yf1-?aOLgTdjRsyW8FF_OUIsZeMP9tK07Xe0L_9Ny28ykKB8|
z?|kPw-#P#D`tsV}Ui>0}h4PdS1%kNop^IJ<=SyO>4SeX$@*wK;_S$h2uf0RG8&4l
zvy&+tjyJrq=styO0__E7eKOZEdTUwXSGvXlN#QMlbhcwqQd0F5;wzFH58GsC$Xv
zl*$v>vud57sNRX#0TiOj!r7=66joNPn+U;N3zIP=z_(fpbvT!{O4;rTyF1hybB&B`
z2|H;7B$vvjs&zgrpf>YyK6`!u^RZBQFA|hjHs?<-samHyTwvisTtwuAB9W0uKC99@
z=&(EFQ;-F*(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n3on`KmM3ua_BHNkm^u|$q{A3?;~lkj>#l4E0=Pz^B85kr(C9TD7%YH*Y)KxBQ2*W
z+1#|8+K>Gi{(BB%GDp>69_q)9nbCuX8A((&naRf}6lTzA9H$>EGmG{g#!_XKmNWI-
zHK(QJ>{eaQ6B!w}hl2WPJ{8PI_*8HoY8${Lgh%*w5Rc(eJcC2Lbb1W0viW?S!22Pd#7}XUrt4=@
ze}w(?r=<{|6JB@8$-MA74WF0UcwXl6Dr+GI3@k2Zpr;|TF;Nytl~hy0a@0u;gK`0-
zm?U#$9%bEtRo)o6&X-!LLl6`GPG2eXL3}vw69#gh`2UKM_py2E
z!uRPo0j=OX7|AyXB8|wul+|UkUd7MKW|hl%X<76T0>|W{)%|EFn^iU|J8%gH7Anay
zZ=_u6IdYbcG-O9sa-`%rX)2dy;!BxSACuO8+}6xN1ys3Qp%FL(ODQn4?W8p?9enA>
zhGF9M8RBy3%wOVB)(%r{8lt>
zB^u?+{5!%|n9jb+WcD(n&(~;(S8x%Hy%Jx?YF^~EGPbN|oZ5tMlh5nC^nQaE*5ARc
zcoX+9=Iq1w@HD=U7w`kTNN~J`AJOOEqL2T?n7-Pm|L4+8^MR|YX!@-*%|6WG+cv(v
z$jY)xqAZTpxD}ZA0V-(JlG0ME(I;IopG2ZQ*;0*(a;s!oV)QEp*QvtyImfd5p_)Q;kUuvaeK_-3HV0p_)P2-C12TAh)Jv
z59w~NDN4&n<_?GG1uRLx&{fC~<->2Nu;aW!{w-1X4m1Dn_;Oie5DiEO|_
zHvy#pnlUI3Yi=XoI|t-oGhdmd le numéro de port pour envoyer ces informations lors d'un changements ou d'une nouvelle connexion
- * @param portUDPlistening : int => le numéro de port pour recevoir les informations des nouveaux utilisateurs ou les changements
- * @param portTCP : int => le numéro de port pour commencer une nouvelle conversation
- * @throws IOException
- * @descrition
- *
- * On récupère l'adresse de la machine, on demande un pseudo à l'utilisateur que l'on vérifie
- * Une fois validé l'utilisateur devient actif :
- * - écoute UDP pour les pseudos
- * - écoute TCP pour de nouvelles conversation
- * - notification aux autres utilisateurs actifs
- *
- */
- private Controller(int portUDPsend,int portUDPlistening,int portTCP,Historique histoire) throws IOException {
- this.histoire= histoire;
-
- // Récupération de l'adresse IP local
- InetAddress addIP = null;
- try
- {
- addIP = InetAddress.getLocalHost();
- }
- catch(UnknownHostException e) {
- JOptionPane.showMessageDialog(null ,"Could not find local address!");
- }
-
- // Création de l'utilisateur
- this.myUser = new LocalUser("Unknown",addIP,portUDPsend,portUDPlistening,portTCP);
-
- try {
- this.myUser.setPseudo(this.initPseudo()); // Initialisation du pseudo manuel
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- // Création des threads d'écoutes
- this.udp_connect_thread = new TListeningUDP("UDP Listening thread",this);
- this.udp_connect_thread.start();
- this.tcp_connect_thread = new TListeningTCPConnection("TCP main Listening thread",this);
- this.tcp_connect_thread.start();
-
- // Notification des utilisateurs distants
- notify_remote_users();
-
- // Création de l'interface
- interfaceRunning =true;
- view=Interface.createAndShowGUI(this);
- }
-
- /**
- * Constructor of Controller
- * @parametres
- * @param portUDPsend : int => le numéro de port pour envoyé ces informations lors d'un changements ou d'une nouvelle connexion
- * @param portUDPlistening : int => le numéro de port pour recevoir les informations des nouveaux utilisateurs ou les changements
- * @param portTCP : int => le numéro de port pour commencer une nouvelle conversation
- * @descrition
- *
- * On récupère l'adresse de la machine, on demande un pseudo à l'utilisateur que l'on vérifie
- * Une fois validé l'utilisateur devient actif :
- * - écoute UDP pour les pseudos
- * - écoute TCP pour de nouvelles conversation
- * - notification aux autres utilisateurs actifs
- *
- */
- private Controller(int portUDPsend,int portUDPlistening,int portTCP,String pseudo,Historique histoire) throws IOException{
-
- this.histoire=histoire;
-
- // Récupération de l'adresse IP local
- InetAddress addIP = null;
- try
- {
- addIP = InetAddress.getLocalHost();
-
- }
- catch(UnknownHostException e) {
- JOptionPane.showMessageDialog(null ,"Could not find local address!");
- }
-
- // Création de l'utilisateur
- this.myUser = new LocalUser(pseudo,addIP,portUDPsend,portUDPlistening,portTCP);
- try {
- if(this.validatePseudo(pseudo)) {
-
-
- this.udp_connect_thread = new TListeningUDP("UDP Listening thread",this);
- this.udp_connect_thread.start();
-
- this.tcp_connect_thread = new TListeningTCPConnection("TCP main Listening thread",this);
- this.tcp_connect_thread.start();
-
-
- // Notification des utilisateurs distants
- notify_remote_users();
-
- // Création de l'interface
- interfaceRunning =true;
- view=Interface.createAndShowGUI(this);
- }
- else {
- System.out.println("Unavailable "+pseudo);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
-
- /*** GETTERS ***/
- public LocalUser getMyUser() {
- return myUser;
- }
- public Interface getview() {
- return view;
- }
- public TListeningUDP getUdp_connect_thread() {
- return udp_connect_thread;
- }
- public TListeningTCPConnection getTcp_connect_thread() {
- return tcp_connect_thread;
- }
- public Historique getHistory() {
- return histoire;
- }
-
- /*** SETTERS ***/
- public void setMyUser(LocalUser myUser) {
- this.myUser = myUser;
- }
- public void setview(Interface view) {
- this.view = view;
- }
- public void setUdp_connect_thread(TListeningUDP udp_connect_thread) {
- this.udp_connect_thread = udp_connect_thread;
- }
- public void setTcp_connect_thread(TListeningTCPConnection tcp_connect_thread) {
- this.tcp_connect_thread = tcp_connect_thread;
- }
- public void setHistory(Historique histoire) {
- this.histoire=histoire;
- }
-
- /**************************** Initialisation pseudo et découverte utilisateur distant (+notification utilisateurs distants) **********************************/
-
- /** initPseudo
- *
- * Demande à l'utilisateur de rentrer un pseudo et valide de ce dernier en demandant aux
- * utilisateurs distants leurs informations
- *
- */
- public String initPseudo() throws IOException {
- String tmpPseudo = JOptionPane.showInputDialog(null, "Enter nickname:"); // Read user input
-
- while(!(this.validatePseudo(tmpPseudo))) { // On demande aux autres utilisateurs de nous envoyer leurs informations et on test si le pseudo est déjà utilisé
- tmpPseudo = JOptionPane.showInputDialog(null, "Enter another nickname:"); // Read user input
- }
-
- //sc1.close();
- JOptionPane.showMessageDialog(null ,"Your nickname : " + tmpPseudo + " is valid !");
-
- return tmpPseudo;
- }
-
- /** changePseudo
- *
- * 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
- *
- */
- public void changePseudo() throws IOException {
- String oldPseudo = this.myUser.getPseudo(); //Saves the old one for comparison
-
- String tmpPseudo = view.ChangePseudotextField.getText(); // Read user input
-
- if(!(this.validatePseudo(tmpPseudo)) || tmpPseudo.equals(oldPseudo)) {
- view.Pseudolabel.setText("Already exists, enter another nickname. Your current username is: " + oldPseudo); // Read user input
- tmpPseudo = view.ChangePseudotextField.getText(); // Read user input
- }
- else {
- this.myUser.setPseudo(tmpPseudo);
- JOptionPane.showMessageDialog(null ,"Your new nickname : " + tmpPseudo + " is valid !");
- this.notify_remote_users();
- }
- }
-
-
- /** validatePseudo
- *
- * *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)
- *
- */
- public Boolean validatePseudo(String tmpPseudo) throws IOException {
- Boolean valid = true;
-
- DatagramSocket dgramSocket = new DatagramSocket(this.myUser.getPortUDPsend(),this.myUser.getAddIP());
-
- // Création du message à envoyer
- String toSend = this.myUser.getAddIP().getHostAddress()+":"+this.myUser.getPortUDPsend()+":info";
-
- // Broadcast du message
- broadcast(dgramSocket,toSend);
-
- /*** For 5 seconds wait for answer : validate pseudo & add to userlist ***/
- byte[] buffer = new byte[256];
- DatagramPacket inPacket;
- String response = null;
- String[] tabresponse= new String [4];
- dgramSocket.setSoTimeout(1000);
- Boolean arecu;
- int nbReponse =0;
- System.out.println("("+myUser.getPseudo()+") Waiting for pseudo validation ...");
- Date oldDate = new Date();
- Date newDate = new Date();
-
- while( (newDate.getTime()-oldDate.getTime()) < NB_SECOND_WAITING_RESPONSE_BROADCAST*1000 && valid) {
- nbReponse++;
- inPacket= new DatagramPacket(buffer, buffer.length);
- arecu=true;
- try{
- dgramSocket.receive(inPacket);
- }catch (Exception e) {
- arecu=false;
- }
-
- buffer = inPacket.getData();
- response = new String(buffer);
- if(arecu) {
- // On découpe la réponse en tableau de string ([adresseIP,tcpPort,nickname])
- tabresponse = response.split(":");
- // Si reception on ajoute l'utilisateur à notre liste d'utilisateur distant
- this.myUser.addRemoteUser(InetAddress.getByName(tabresponse[0]),Integer.parseInt(tabresponse[1]),tabresponse[2]);
- valid= (tmpPseudo.compareTo(tabresponse[2])!=0); // On regarde la différence entre notre pseudo et le pseudo reçu
- }
- newDate = new Date();
- }
-
-
- dgramSocket.close();
- if(!valid) {
- JOptionPane.showMessageDialog(null ,"Nickname : "+tmpPseudo +" is taken !");
- }
- return valid;
- }
-
- /***broadcast
- *
- * @param dgramSocket
- * @param toSend
- * @param broadcastIP
- * @throws IOException
- *
- * Simulation of broadcast with port given (tabBroadcast)
- *
- */
- public void broadcast(DatagramSocket dgramSocket,String toSend) throws IOException {
- InetAddress broadcastIP = InetAddress.getLocalHost();
- DatagramPacket outPacket = null;
- int tabBroadcastSize = tabBroadcast.length;
- for(int i=0;i
- * En utilisant le port UDP d'envoi, on envoie en broadcast les informations nous concernant
- *
- * @throws IOException
- */
- public void notify_remote_users() throws IOException {
- DatagramSocket dgramSocket= null;
- try {
- dgramSocket= new DatagramSocket(this.myUser.getPortUDPsend(),this.myUser.getAddIP());
- } catch (IOException e) {
- e.printStackTrace();
- }
- // Send to other active user (simulation of broadcast)
- String toSend = this.myUser.getAddIP().getHostAddress()+":"+this.myUser.getPortTCP()+":"+this.myUser.getPseudo()+":notify";
- broadcast(dgramSocket,toSend);
- dgramSocket.close();
- }
-
-
- /**************************** Gestion des sessions **********************************/
-
- public Chat openSession(RemoteUser rm) {
- Chat c = myUser.addChats(rm); // Create chat and add it to myUser
-
- /*** Create socket send => ask connection to server of rm ***/
- Socket link=null;
- try {
- // Connection => server tcp rm
- System.out.println("("+this.myUser.getPseudo()+") Connecting to "+c.getRemoteUser().getPortTCP()+" of " + c.getRemoteUser().getPseudo());
- link=new Socket(c.getRemoteUser().getAddIP(),c.getRemoteUser().getPortTCP()/*, InetAddress.getLocalHost() ,myUser.getPortTCP()*/);
- c.setSocket(link);
- // Sending data for identification (TO REMOVE IF != IP)
- sendInfoProcess(Integer.toString(myUser.getPortTCP()), c); // tell rm session STOP
- }catch(IOException e) {
- System.out.println("Error linking to TCP server of "+ c.getRemoteUser().getPortTCP());
- }
-
-
- /*** recup history and put it in model ***/
- try {
- try {
- c.addListMessage(this.getHistory().retrieveMessage(getMyUser(), c.getRemoteUser()));
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- } catch (SQLException e) {
- System.out.println("souci avec le retrieveMsgSQL");
- e.printStackTrace();
- }
- return c;
- }
-
-
-
- public String askOpenSession(int index) {
- String history="";
- RemoteUser rm = myUser.getRemoteUsersList().get(index);
- Chat c;
-
- /*** Recup or create chat ***/
- if(myUser.getChatIndexOf(rm)!=-1) { // if already a chat open
- c = myUser.getChats().get(myUser.getChatIndexOf(rm));
- JOptionPane.showMessageDialog(null ,"Active session with "+c.getRemoteUser().getPseudo()+" loading history");
- }
- else { // else create it
- c=openSession(rm);
- JOptionPane.showMessageDialog(null ,"New session with "+rm.getPseudo());
- }
-
- // Look for history
-
- int nbMessage = c.getMessages().size();
- for(int i=0;i lstCtr = new ArrayList();
-
- // REMOTE USERS
- Controller ctr1 = new Controller(31011,portUDPlistening_remoteUsr1,31021,"Theau",histoire);
- lstCtr.add(ctr1);
- Controller ctr2 = new Controller(31012,portUDPlistening_remoteUsr2,31022,"Leonie",histoire);
- lstCtr.add(ctr2);
- Controller ctr3 = new Controller(31013,portUDPlistening_remoteUsr3,31023,"Alexandre",histoire);
- lstCtr.add(ctr3);
-
- // LOCAL USER
- Controller ctr = new Controller(31014,portUDPlistening_local,31024,histoire);
- lstCtr.add(ctr);
-
- Appel app=new Appel();
- app.test();
-
- /** Loop **/
- Boolean running = isRunning(lstCtr);
- while(running) {
- running = isRunning(lstCtr);
- }
-
- System.out.println("Fin de la boucle");//TOREMOVE
-
- /** End - Close thread and socket for every controller**/
- closeThreads(lstCtr);
- System.out.println("end program");
- JOptionPane.showMessageDialog(null ,"END");
- }
-
- static boolean isRunning(ArrayList lstCtr){
- boolean isRunning=false;
- for(Controller ctr : lstCtr) {
- isRunning|=ctr.interfaceRunning;
- }
- return isRunning;
- }
-
- static void closeThreads(ArrayList lstCtr) {
- for(Controller ctr : lstCtr) {
- ctr.close();
- }
- }
-
-}
-
-
diff --git a/Application/Clavardage/src/controller/Historique.java b/Application/Clavardage/src/controller/Historique.java
deleted file mode 100644
index 651416e..0000000
--- a/Application/Clavardage/src/controller/Historique.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package controller;
-
-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.ArrayList;
-import java.util.Calendar;
-
-import javax.sql.rowset.JdbcRowSet;
-
-import model.Message;
-import model.Msg_Text;
-
-public class Historique {
-
- public void saveMessage(model.User author, model.RemoteUser receiver, String input, String date) {
- try {
- Class.forName("java.sql.Driver");
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- Connection con = null;
- try {
- con = DriverManager.getConnection("jdbc:mysql://srv-bdens.insa-toulouse.fr:3306","tp_servlet_003","povu3Ma2");
- } catch (SQLException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- Statement stat = null;
- try {
- stat = con.createStatement();
- } catch (SQLException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- int nb_changed_rows = 0;
- try {
- nb_changed_rows = stat.executeUpdate("USE tp_servlet_003");
- } catch (SQLException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-/*
- try {
- nb_changed_rows = stat.executeUpdate("CREATE TABLE chat ( user_IPcode1 INTEGER, user_IPcode2 INTEGER ,Message VARCHAR(450) ,temps VARCHAR(450) )");
- }catch (Exception e) {
- e.printStackTrace();
-
- }
- System.out.println("coucou");
-*/
- try {
- nb_changed_rows = stat.executeUpdate("INSERT INTO chat VALUES ('"+author.getIPcode()+"','"+receiver.getIPcode()+"','"+input+"','"+date+"')");
- } catch (SQLException e) {
- System.out.println("insertion pas établie");
- e.printStackTrace();
- }
-// try {
-// nb_changed_rows = stat.executeUpdate("DELETE FROM chat WHERE data(VARCHAR(255))="valeur"");
-// } catch (SQLException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
- try {
- stat.close();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- con.close();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- public ArrayList retrieveMessage(model.LocalUser usr, model.RemoteUser rmusr) throws SQLException, ClassNotFoundException {
- ArrayList messages=new ArrayList();
-
- Class.forName("java.sql.Driver");
- Connection con=DriverManager.getConnection("jdbc:mysql://srv-bdens.insa-toulouse.fr:3306","tp_servlet_003","povu3Ma2");
- Statement stat = null;
- stat = con.createStatement();
- stat.executeUpdate("USE tp_servlet_003");
-/*
- Statement stat2 = null;
- stat2 = con.createStatement();
- stat.executeUpdate("USE tp_servlet_003");
-*/
-
- //int nb_changed_rows;
-
- String query = "SELECT user_IPcode1 ,Message, temps"
- +" FROM chat WHERE (user_IPcode1="+usr.getIPcode()
- +" AND user_IPcode2="+rmusr.getIPcode()+") "
- +"OR (user_IPcode1="+rmusr.getIPcode()+" "
- + "AND user_IPcode2="+usr.getIPcode()+") "
- + "ORDER BY temps;";
- ResultSet resultQueryRS=(stat.executeQuery(query));
-
- int autorIPcode;
- String message;
- String strDate;
-
- boolean encore = resultQueryRS.next();
- while(encore) {
- autorIPcode=resultQueryRS.getInt(1);
- message=resultQueryRS.getString(2);;
- strDate=resultQueryRS.getString(3);
- if(usr.getIPcode()==autorIPcode) {
- messages.add(new Msg_Text(usr,strDate,message));
- }
- else {
- messages.add(new Msg_Text(rmusr,strDate,message));
- }
- encore=resultQueryRS.next();
-
- }
- return messages;
- }
-
-
-
-
-}
diff --git a/Application/Clavardage/src/controller/ListeningThread.java b/Application/Clavardage/src/controller/ListeningThread.java
deleted file mode 100644
index 83f0a80..0000000
--- a/Application/Clavardage/src/controller/ListeningThread.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package controller;
-
-
-public abstract class ListeningThread extends Thread{
-
- protected Controller controller;
-
- public ListeningThread(String s,Controller controller) {
- super(s);
- this.controller = controller;
- }
-
- public abstract void run();
-
- public abstract void close();
-}
diff --git a/Application/Clavardage/src/controller/ListeningThreadTCPChat.java b/Application/Clavardage/src/controller/ListeningThreadTCPChat.java
deleted file mode 100644
index 8d6ea26..0000000
--- a/Application/Clavardage/src/controller/ListeningThreadTCPChat.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package controller;
-
-import model.Chat;
-import model.Msg_Text;
-import model.RemoteUser;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.Socket;
-import java.util.Calendar;
-import java.util.Date;
-
-public class ListeningThreadTCPChat extends ListeningThread{
-
- private Socket socket;
-
- /* CONSTRUCTOR OF ListeningThreadTCPConnection
- * @parametres
- * @param s : String => nom du thread
- * @param myUser : User => utilisateur utilisant ce thread
- * @description
- *
- *
- */
- public ListeningThreadTCPChat(String s,Controller controller,Socket socket) {
- super(s,controller);
- this.socket=socket;
- // TODO OpenSession si ouverture exterieur
- }
-
- /* run
- * @description
- *
- *
- *
- */
- public void run() {
- /**** function variables ****/
- BufferedReader in = null;
- String msg = null;
- String input;
- String dateString;
- Date date;
- Calendar date1=Calendar.getInstance();
-
-
- Chat c = null;
-
-
- try {
- in =new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- /************ Check rm user information **********/
- // check data identification from rm user | TO REMOVE IF !=IP
- int rmPortTCP = -1;
- try {
- rmPortTCP = Integer.parseInt(in.readLine());
- } catch (NumberFormatException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- RemoteUser rm = new RemoteUser("Unknown",this.socket.getInetAddress(),rmPortTCP);
-
- int indexRM = controller.myUser.getActiveUserIndexOf(rm);
- // Check if rm is identifiable
- /*System.out.println(rm);
- for(int i=0;i "+rm.getPseudo()+" : "+input);
- Msg_Text message = new Msg_Text(rm,input);
- c.addMessage(message);
- if(controller.activeChat==c) {
- controller.view.notifyNewMessage("("+message.getDate()+")\n"+c.getRemoteUser().getPseudo()+" : "+input);
- }
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- else {
- System.out.println("("+this.controller.myUser.getPseudo()+") Remote User unidentifiable => CLOSING CONNECTION");
- }
-
-
-
-
-
-
-
- }
-
- /* close
- * @description
- *
- * ferme le socket d'écoute TCP pour le chat
- * interrupt TCP listening thread pour le chat
- *
- */
- public void close() {
- try {
- this.socket.close();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
- System.out.println("End of listing thread UDP ("+this.controller.myUser.getPseudo()+")");
- try {
- this.interrupt();
- }catch (Exception e){
- e.printStackTrace();
- }
- }
-}
diff --git a/Application/Clavardage/src/controller/ListeningThreadTCPConnection.java b/Application/Clavardage/src/controller/ListeningThreadTCPConnection.java
deleted file mode 100644
index 31833a4..0000000
--- a/Application/Clavardage/src/controller/ListeningThreadTCPConnection.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package controller;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-public class ListeningThreadTCPConnection extends ListeningThread{
-
- private Socket socket_tcp=null;
- private int nbChat = 0;
- /* CONSTRUCTOR OF ListeningThreadTCPConnection
- * @parametres
- * @param s : String => nom du thread
- * @param myUser : User => utilisateur utilisant ce thread
- * @description
- *
- *
- */
- public ListeningThreadTCPConnection(String s,Controller controller) {
- super(s,controller);
-
- }
-
- public void accept(ServerSocket servSocket) throws IOException {
- Socket socket_tcp= servSocket.accept();
- this.nbChat++;
- ListeningThreadTCPChat threadtcpchat = new ListeningThreadTCPChat("Chat_of_"+controller.myUser.getPseudo()+"_"+nbChat,controller,socket_tcp);
- threadtcpchat.start();
- threadtcpchat.interrupt();
-
- }
-
- /* run
- * @description
- *
- * écoutes les messages TCP tant que l'utilisateur est actif
- * Traitement
- * Si réception d'une demande, créer un thread pour la conversation
- *
- */
- public void run(){
-
- // Tant que l'utilisateur est actif on attends la demande de nouvelle conversation
- ServerSocket servSocket=null;
- try {
- servSocket = new ServerSocket(controller.myUser.getPortTCP());
- System.out.println("("+this.controller.myUser.getPseudo()+") Server is listening on port "+this.controller.myUser.getPortTCP());
- } catch (IOException e) {
- System.out.println("("+this.controller.myUser.getPseudo()+") Server is not listening on port "+this.controller.myUser.getPortTCP());
- e.printStackTrace();
- }
- while(true) {
- System.out.println("("+this.controller.myUser.getPseudo()+") TCP Server waiting for new connection ...");
-
- try {
- this.accept(servSocket);
- System.out.println("("+this.controller.myUser.getPseudo()+") NEW CONNECTION");
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
-
- }
-
- }
-
- /* close
- * @description
- *
- * ferme le socket d'écoute TCO
- * interrupt UDP listening threadS
- *
- */
- public void close() {
- try {
- this.socket_tcp.close();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
- System.out.println("End of listing thread TCP ("+this.controller.myUser.getPseudo()+")");
- try {
- this.interrupt();
- }catch (Exception e){
- e.printStackTrace();
- }
- }
-
-}
-
-
diff --git a/Application/Clavardage/src/controller/ListeningThreadUDP.java b/Application/Clavardage/src/controller/ListeningThreadUDP.java
deleted file mode 100644
index 12d51c3..0000000
--- a/Application/Clavardage/src/controller/ListeningThreadUDP.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package controller;
-
-import model.LocalUser;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-public class ListeningThreadUDP extends ListeningThread{
-
- private DatagramSocket dgramSocket = null;
-
-
- /* CONSTRUCTOR OF UserListeningThreadUDP
- * @parametres
- * @param s : String => nom du thread
- * @param user : User => utilisateur utilisant ce thread
- * @description
- *
- * Appel du constructeur de la classe hérité
- * Création d'un socket d'écoute UDP
- *
- */
- public ListeningThreadUDP(String s,Controller controller) {
- super(s,controller);
- try {
- this.dgramSocket = new DatagramSocket(this.controller.myUser.getPortUDPlistening(),this.controller.myUser.getAddIP());
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /* run
- * @description
- *
- * écoutes les messages UDP tant que l'utilisateur est actif
- * Traitement
- * 1) Si demande d'information => envoi ses informations
- * 2) Si réception d'information => ajoute les informations
- *
- */
- public void run(){
-
- // Tant que l'utilisateur est actif on attends les messages des nouveaux utilisateurs et changements des utilisateurs actifs
- while(true) {
-
- // Réception du message
- byte[] buffer = new byte[256];
- DatagramPacket inPacket= new DatagramPacket(buffer, buffer.length);
- try {
- dgramSocket.receive(inPacket);
- } catch (Exception e) {
- e.printStackTrace();
- }
- buffer = inPacket.getData();
-
- // Traitement en fonction du message reçu
- String receiveMsg = new String(buffer);
- String [] tabMsg = receiveMsg.split(":");
-
-
- // si demande d'information d'un nouvel utilisateur
- if(tabMsg.length==3) {
- InetAddress itsIP = null;
- try {
- itsIP = InetAddress.getByName(tabMsg[0].split("/")[1]); // On récupère l'adresse IP de l'utilisateur distant
- } catch (UnknownHostException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- int senderUDPport = Integer.parseInt(tabMsg[1]); // On récupère le port UDP de l'utilisateur distant
-
- String toSend = controller.myUser.getAddIP().toString()+":"+controller.myUser.getPortTCP()+":"+controller.myUser.getPseudo()+":test";
- DatagramPacket outPacket= new DatagramPacket(toSend.getBytes(), toSend.length(),itsIP, senderUDPport);
-
- try {
- dgramSocket.send(outPacket);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- // Si un nouvel utilisateur passe en mode actif ou changement d'information
- else {
- try {
- // On récupère l'adresse IP et le port TCP de l'utilisateur distant et ajout à la liste de l'utilisateur utilisant ce thread
- controller.myUser.addRemoteUser(InetAddress.getByName(tabMsg[0].split("/")[1]),Integer.parseInt(tabMsg[1]),tabMsg[2]);
- } catch (NumberFormatException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (UnknownHostException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if(controller.interfaceRunning) {
- controller.view.updateActiveUsers();
- }
- }
-
-
- }
-
-
- }
-
- /* close
- * @description
- *
- * Ferme le socket d'écoute UDP
- * Interrompt le thread d'écoute UDP
- *
- */
- public void close() {
- this.dgramSocket.close();
- System.out.println("End of listing thread UDP ("+this.controller.myUser.getPseudo()+")");
- try {
- this.interrupt();
- }catch (Exception e){
- e.printStackTrace();
- }
- }
-}
diff --git a/Application/Clavardage/src/controller/TListeningTCPChat.java b/Application/Clavardage/src/controller/TListeningTCPChat.java
deleted file mode 100644
index ab8150a..0000000
--- a/Application/Clavardage/src/controller/TListeningTCPChat.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package controller;
-
-import model.Chat;
-import model.Msg_Text;
-import model.RemoteUser;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.Socket;
-import java.util.Calendar;
-import java.util.Date;
-
-public class TListeningTCPChat extends Thread{
-
- protected Controller controller;
- private Socket socket;
-
- /* CONSTRUCTOR OF ListeningThreadTCPConnection
- * @parametres
- * @param s : String => nom du thread
- * @param myUser : User => utilisateur utilisant ce thread
- * @description
- *
- *
- */
- public TListeningTCPChat(String s,Controller controller,Socket socket) {
- this.controller = controller;
- this.socket=socket;
- }
-
- /* run
- * @description
- *
- *
- *
- */
- public void run() {
- /**** function variables ****/
- BufferedReader in = null;
- String msg = null;
- String input;
- String dateString;
- Date date;
- Calendar date1=Calendar.getInstance();
-
-
- Chat c = null;
-
-
- try {
- in =new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- /************ Check rm user information **********/
- // check data identification from rm user | TO REMOVE IF !=IP
- int rmPortTCP = -1;
- try {
- rmPortTCP = Integer.parseInt(in.readLine());
- } catch (NumberFormatException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- RemoteUser rm = new RemoteUser("Unknown",this.socket.getInetAddress(),rmPortTCP);
-
- int indexRM = controller.myUser.getActiveUserIndexOf(rm);
- // Check if rm is identifiable
- /*System.out.println(rm);
- for(int i=0;i "+rm.getPseudo()+" : "+input);
- Msg_Text message = new Msg_Text(rm,input);
- c.addMessage(message);
- if(controller.activeChat==c) {
- controller.view.notifyNewMessage("("+message.getDate()+")\n"+c.getRemoteUser().getPseudo()+" : "+input);
- }
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- else {
- System.out.println("("+this.controller.myUser.getPseudo()+") Remote User unidentifiable => CLOSING CONNECTION");
- }
-
-
-
-
-
-
-
- }
-
- /* close
- * @description
- *
- * ferme le socket d'écoute TCP pour le chat
- * interrupt TCP listening thread pour le chat
- *
- */
- public void close() {
- try {
- this.socket.close();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
- System.out.println("End of listing thread UDP ("+this.controller.myUser.getPseudo()+")");
- try {
- this.interrupt();
- }catch (Exception e){
- e.printStackTrace();
- }
- }
-}
diff --git a/Application/Clavardage/src/controller/TListeningTCPConnection.java b/Application/Clavardage/src/controller/TListeningTCPConnection.java
deleted file mode 100644
index 7bbab0a..0000000
--- a/Application/Clavardage/src/controller/TListeningTCPConnection.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package controller;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-public class TListeningTCPConnection extends Thread{
-
- protected Controller controller;
- private Socket socket_tcp=null;
- private int nbChat = 0;
-
- /* CONSTRUCTOR OF ListeningThreadTCPConnection
- * @parametres
- * @param s : String => nom du thread
- * @param myUser : User => utilisateur utilisant ce thread
- * @description
- *
- *
- */
- public TListeningTCPConnection(String s,Controller controller) {
- this.controller = controller;
- }
-
- public void accept(ServerSocket servSocket) throws IOException {
- Socket socket_tcp= servSocket.accept();
- this.nbChat++;
- TListeningTCPChat threadtcpchat = new TListeningTCPChat("Chat_of_"+controller.myUser.getPseudo()+"_"+nbChat,controller,socket_tcp);
- threadtcpchat.start();
- threadtcpchat.interrupt();
-
- }
-
- /* run
- * @description
- *
- * écoutes les messages TCP tant que l'utilisateur est actif
- * Traitement
- * Si réception d'une demande, créer un thread pour la conversation
- *
- */
- public void run(){
-
- // Tant que l'utilisateur est actif on attends la demande de nouvelle conversation
- ServerSocket servSocket=null;
- try {
- servSocket = new ServerSocket(controller.myUser.getPortTCP());
- System.out.println("("+this.controller.myUser.getPseudo()+") Server is listening on port "+this.controller.myUser.getPortTCP());
- } catch (IOException e) {
- System.out.println("("+this.controller.myUser.getPseudo()+") Server is not listening on port "+this.controller.myUser.getPortTCP());
- e.printStackTrace();
- }
- while(true) {
- System.out.println("("+this.controller.myUser.getPseudo()+") TCP Server waiting for new connection ...");
-
- try {
- this.accept(servSocket);
- System.out.println("("+this.controller.myUser.getPseudo()+") NEW CONNECTION");
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
-
- }
-
- }
-
- /* close
- * @description
- *
- * ferme le socket d'écoute TCO
- * interrupt UDP listening threadS
- *
- */
- public void close() {
- try {
- this.socket_tcp.close();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
- System.out.println("End of listing thread TCP ("+this.controller.myUser.getPseudo()+")");
- try {
- this.interrupt();
- }catch (Exception e){
- e.printStackTrace();
- }
- }
-
-}
-
-
diff --git a/Application/Clavardage/src/controller/TListeningUDP.java b/Application/Clavardage/src/controller/TListeningUDP.java
deleted file mode 100644
index 61dfa06..0000000
--- a/Application/Clavardage/src/controller/TListeningUDP.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package controller;
-
-import model.LocalUser;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-public class TListeningUDP extends Thread{
-
- protected Controller controller;
- private DatagramSocket dgramSocket = null;
-
-
- /* CONSTRUCTOR OF UserListeningThreadUDP
- * @parametres
- * @param s : String => nom du thread
- * @param user : User => utilisateur utilisant ce thread
- * @description
- *
- * Appel du constructeur de la classe hérité
- * Création d'un socket d'écoute UDP
- *
- */
- public TListeningUDP(String s,Controller controller) {
- this.controller = controller;
- try {
- this.dgramSocket = new DatagramSocket(this.controller.myUser.getPortUDPlistening(),this.controller.myUser.getAddIP());
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
- /* run
- * @description
- *
- * écoutes les messages UDP tant que l'utilisateur est actif
- * Traitement
- * 1) Si demande d'information => envoi ses informations
- * 2) Si réception d'information => ajoute les informations
- *
- */
- public void run(){
-
- // Tant que l'utilisateur est actif on attends les messages des nouveaux utilisateurs et changements des utilisateurs actifs
- while(true) {
-
- // Réception du message
- byte[] buffer = new byte[256];
- DatagramPacket inPacket= new DatagramPacket(buffer, buffer.length);
- try {
- dgramSocket.receive(inPacket);
- } catch (Exception e) {
- e.printStackTrace();
- }
- buffer = inPacket.getData();
-
- // Traitement en fonction du message reçu
- String receiveMsg = new String(buffer);
- String [] tabMsg = receiveMsg.split(":");
-
- // si demande d'information d'un nouvel utilisateur
- if(tabMsg.length==3) {
- InetAddress itsIP = null;
- try {
- itsIP = InetAddress.getByName(tabMsg[0]); // On récupère l'adresse IP de l'utilisateur distant
- } catch (UnknownHostException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- int senderUDPport = Integer.parseInt(tabMsg[1]); // On récupère le port UDP de l'utilisateur distant
-
- String toSend = controller.myUser.getAddIP().getHostAddress()+":"+controller.myUser.getPortTCP()+":"+controller.myUser.getPseudo()+":test";
- DatagramPacket outPacket= new DatagramPacket(toSend.getBytes(), toSend.length(),itsIP, senderUDPport);
-
- try {
- dgramSocket.send(outPacket);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- // Si un nouvel utilisateur passe en mode actif ou changement d'information
- else {
- try {
- // On récupère l'adresse IP et le port TCP de l'utilisateur distant et ajout à la liste de l'utilisateur utilisant ce thread
- controller.myUser.addRemoteUser(InetAddress.getByName(tabMsg[0]),Integer.parseInt(tabMsg[1]),tabMsg[2]);
- } catch (NumberFormatException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (UnknownHostException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if(controller.interfaceRunning) {
- controller.view.updateActiveUsers();
- }
- }
-
-
- }
-
-
- }
-
- /* close
- * @description
- *
- * Ferme le socket d'écoute UDP
- * Interrompt le thread d'écoute UDP
- *
- */
- public void close() {
- this.dgramSocket.close();
- System.out.println("End of listing thread UDP ("+this.controller.myUser.getPseudo()+")");
- try {
- this.interrupt();
- }catch (Exception e){
- e.printStackTrace();
- }
- }
-}
diff --git a/Application/Clavardage/src/model/Chat.java b/Application/Clavardage/src/model/Chat.java
deleted file mode 100644
index d1901a5..0000000
--- a/Application/Clavardage/src/model/Chat.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package model;
-
-import java.io.IOException;
-import java.net.Socket;
-import java.util.ArrayList;
-
-public class Chat {
-
- /*** ATTRIBUTS ***/
- private RemoteUser remoteUser;
- private ArrayList messages = new ArrayList();
- private Socket userSocket;
- private Boolean active = false;
-
- /**
- * Constructor of Chat (local)
- * @parametres
- * @param remoteUser : remoteUser => référence de l'utilisateur distant
- * @description
- *
- *
- *
- */
- public Chat(RemoteUser rm) {
- this.remoteUser=rm;
- }
-
- /*** GETTERS ***/
- public RemoteUser getRemoteUser() {
- return remoteUser;
- }
- public ArrayList getMessages() {
- return messages;
- }
- public Socket getUserSocket() {
- return userSocket;
- }
- public Boolean getActive() {
- return active;
- }
-
- /*** SETTERS ***/
- public void setRemoteUser(RemoteUser rm) {
- this.remoteUser = rm;
- }
- public void setSocket(Socket link) {
- this.userSocket = link;
- }
- public void addMessage(Message msg) {
- this.messages.add(msg);
- }
- public void addListMessage( ArrayList msg) {
- this.messages=msg;
- }
- public void activate() {
- this.active = true;
- }
-
- public void close() {
- this.active = false;
- try {
- this.userSocket.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
-}
diff --git a/Application/Clavardage/src/model/LocalUser.java b/Application/Clavardage/src/model/LocalUser.java
deleted file mode 100644
index dae9dbc..0000000
--- a/Application/Clavardage/src/model/LocalUser.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package model;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-
-
-public class LocalUser extends User{
-
-
- /*** ATTRIBUTS ***/
- private int portUDPsend;
- private int portUDPlistening;
- private ArrayList remoteUsersList = new ArrayList(); // listes des utilisateurs actifs
- private ArrayList chats = new ArrayList();
-
- /**
- * Constructor of LocalUser
- * @parametres
- * @param pseudo : String
- * @param addIP : InetAddress
- * @param portUDPsend : int => le numéro de port pour envoyé ces informations lors d'un changements ou d'une nouvelle connexion
- * @param portUDPlistening : int => le numéro de port pour recevoir les informations des nouveaux utilisateurs ou les changements
- * @param portTCP : int => le numéro de port pour commencer une nouvelle conversation
- * @description
- *
- *
- *
- */
- public LocalUser(String pseudo,InetAddress addIP,int portUDPsend,int portUDPlistening,int portTCP){
- super(pseudo,addIP,portTCP);
- this.portUDPsend = portUDPsend;
- this.portUDPlistening = portUDPlistening;
- }
-
- /*** GETTERS ***/
- public int getPortUDPsend() {
- return portUDPsend;
- }
- public int getPortUDPlistening() {
- return portUDPlistening;
- }
- public ArrayList getRemoteUsersList() {
- return remoteUsersList;
- }
- public ArrayList getChats() {
- return chats;
- }
-
- /*** SETTERS ***/
- public void setPortUDPsend(int portUDPsend) {
- this.portUDPsend = portUDPsend;
- }
- public void setPortUDPlistening(int portUDPlistening) {
- this.portUDPlistening = portUDPlistening;
- }
-
-
-
- /**
- * @parameters
- * @param remoteUserIP : InetAddress => l'adresse IP de l'utilisateur distant
- * @param remoteUserPortTCP : int => le numéro de port TCP d'écoute de l'utilisateur distant
- * @param remoteUserPseudo : String => le pseudo de l'utilisateur distant
- *
- * Ajout ou mise à jour l'utilisateur distant dans notre liste d'utilisateur distant
- *
- */
- public void addRemoteUser(InetAddress remoteUserIP, int remoteUserPortTCP,String remoteUserPseudo) {
- RemoteUser tmpRemoteUser = new RemoteUser(remoteUserPseudo,remoteUserIP,remoteUserPortTCP);
- int index = this.remoteUsersList.indexOf(tmpRemoteUser);
- if(index!=-1) {
- System.out.println("("+this.pseudo+") "+"MAJ, IP(port) : "+remoteUserPseudo+" => "+remoteUserIP+"("+remoteUserPortTCP+")");
- this.remoteUsersList.get(index).setAddIP(remoteUserIP);
- this.remoteUsersList.get(index).setPortTCP(remoteUserPortTCP);
- this.remoteUsersList.get(index).setPseudo(remoteUserPseudo);
- }
- else {
- System.out.println("("+this.pseudo+") "+"Add new user IP(port) : "+remoteUserPseudo+" => "+remoteUserIP+"("+remoteUserPortTCP+")");
- this.remoteUsersList.add(tmpRemoteUser);
- }
- /*
- int i = getChatIndexOf(tmpRemoteUser);
- if(i!=-1) {
- chats.get(i).setRemoteUser(tmpRemoteUser);
- }*/
- }
-
- public Chat addChats(RemoteUser rm) {
- Chat newChat= new Chat(rm);
-
- if(getChatIndexOf(rm)==-1) {
- this.getChats().add(newChat);
- }
-
- return newChat;
- }
-
-
- public int getChatIndexOf(RemoteUser rm) {
- int index=0;
-
- Boolean found = false;
- while(index
- *
- *
- */
- public Message(User autor) {
- this.autor = autor;
- DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
- this.date = dateFormat.format(new Date());
- }
- public Message(User autor, String date) {
- this.autor = autor;
- this.date = date;
- }
- /*** GETTERS ***/
- public String getDate() {
- return date;
- }
- public User getAutor() {
- return autor;
- }
-
- /*** SETTERS ***/
- public void setAutorIP(User autor) {
- this.autor = autor;
- }
- public void setDate(String date) {
- this.date=date;
- }
-
-
- public abstract Object getMessage();
-}
diff --git a/Application/Clavardage/src/model/Msg_Text.java b/Application/Clavardage/src/model/Msg_Text.java
deleted file mode 100644
index dc428f6..0000000
--- a/Application/Clavardage/src/model/Msg_Text.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package model;
-
-import java.net.InetAddress;
-
-public class Msg_Text extends Message{
-
- /*** ATTRIBUT ***/
- private String text;
-
- public Msg_Text(User autor,String text) {
- super(autor);
- this.text = text;
- }
- public Msg_Text(User autor,String date, String text) {
- super(autor,date);
- this.text = text;
- }
-
- @Override
- public String getMessage() {
- return this.text;
- }
-
-
-
-}
diff --git a/Application/Clavardage/src/model/RemoteUser.java b/Application/Clavardage/src/model/RemoteUser.java
deleted file mode 100644
index 003a2b5..0000000
--- a/Application/Clavardage/src/model/RemoteUser.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package model;
-
-import java.net.InetAddress;
-
-public class RemoteUser extends User{
-
- public RemoteUser(String pseudo, InetAddress addIP, int portTCP) {
- super(pseudo, addIP, portTCP);
- }
-
- @Override
- public String toString() {
- return "RemoteUser [pseudo=" + pseudo + ", addIP=" + addIP + ", portTCP=" + portTCP + ", IPcode=" + IPcode
- + "]";
- }
-
-
-}
diff --git a/Application/Clavardage/src/model/User.java b/Application/Clavardage/src/model/User.java
deleted file mode 100644
index 6a39a55..0000000
--- a/Application/Clavardage/src/model/User.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package model;
-
-import java.net.*;
-
-public abstract class User {
-
-
- /*** ATTRIBUTS ***/
- protected String pseudo;
- protected InetAddress addIP;
- protected int portTCP;
- protected int IPcode;
-
- /**
- * Constructor of User (local)
- * @parametres
- * @param pseudo : String
- * @param addIP : InetAddress
- * @param portTCP : int => le numéro de port pour commencer une nouvelle conversation
- * @description
- *
- *
- *
- */
- public User(String pseudo,InetAddress addIP,int portTCP){
- this.pseudo = pseudo;
- this.addIP=addIP;
- this.portTCP=portTCP;
- this.IPcode=hashCode();
- }
-
-
- /*** GETTERS ***/
- public int getIPcode() {
- return IPcode;
- }
- public String getPseudo() {
- return pseudo;
- }
- public InetAddress getAddIP() {
- return addIP;
- }
- public int getPortTCP() {
- return portTCP;
- }
-
-
- /*** SETTERS ***/
- public void setPseudo(String pseudo) {
- this.pseudo = pseudo;
- }
- public void setAddIP(InetAddress addIP) {
- this.addIP = addIP;
- }
- public void setPortTCP(int portTCP) {
- this.portTCP = portTCP;
- }
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- String ip=addIP.getHostAddress();
- result = prime * result + ((ip == null) ? 0 : ip.hashCode());
- result = prime * result + portTCP;
- return result;
- }
-
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- User other = (User) 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;
- }
-
-
- @Override
- public String toString() {
- return "User [pseudo=" + pseudo + ", addIP=" + addIP.getHostAddress() + ", portTCP=" + portTCP + ", IPcode=" + IPcode + "]";
- }
-
-
-
-
-
-
-
-
-
-
-
-}
diff --git a/Application/Clavardage/src/view/Interface.java b/Application/Clavardage/src/view/Interface.java
deleted file mode 100644
index 6ab128d..0000000
--- a/Application/Clavardage/src/view/Interface.java
+++ /dev/null
@@ -1,285 +0,0 @@
-package view;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.io.IOException;
-
-import controller.Controller;
-
-public class Interface extends JFrame implements ActionListener, WindowListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L; //JFrame stuff
-
- public Controller controller;
-
- public JLabel Pseudolabel;
- public JLabel ChangePseudolabel;
- public JTextField ChangePseudotextField;
-
- public JTextArea MessagetextArea;
- public JTextField MessagetextField;
- public JScrollPane scrollpane;
-
- public JButton RemoteUserButton;
- public JComboBox RemoteUserbox;
- public JButton CloseConversationButton;
-
- //Specifies the look and feel to use. Valid values:
- //null (use the default), "Metal", "System", "Motif", "GTK+"
- final static String LOOKANDFEEL = "System";
-
- public Interface(Controller controller) {
- this.controller = controller;
- this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- this.addWindowListener(new java.awt.event.WindowAdapter() {
- @Override
- public void windowClosing(java.awt.event.WindowEvent e) {
- System.out.println("Window closing");
- }
- });
-
- }
-
- public Component createComponents() {
-
- //Pseudo setup
- JPanel changePseudoPanel = new JPanel(new GridLayout(1, 0));
- ChangePseudolabel = new JLabel("Change nickname : ");
- changePseudoPanel.add(ChangePseudolabel);
- ChangePseudotextField = new JTextField();
- ChangePseudotextField.setColumns(10);
- ChangePseudotextField.addActionListener(this);
- changePseudoPanel.add(ChangePseudotextField);
-
- Pseudolabel = new JLabel("Nickname : "+controller.getMyUser().getPseudo());
- Pseudolabel.setLabelFor(ChangePseudotextField);
-
-
-
- //Remote user list setup
- RemoteUserButton = new JButton("Start session");
- RemoteUserButton.addActionListener(this);
-
-
- // Remote user list
- //Converts the Userlist to a Pseudotab for treatment in actionPerformed
- String[] pseudotab = controller.askUpdateActiveUsers();
- RemoteUserbox = new JComboBox(pseudotab);
- RemoteUserbox.setEditable(true);
- RemoteUserbox.addActionListener(this);
- RemoteUserbox.setVisible(false);
-
- // Close session
- CloseConversationButton = new JButton("Close session");
- CloseConversationButton.addActionListener(this);
- CloseConversationButton.setVisible(false);
-
- JPanel userListsPanel = new JPanel(new GridLayout(1, 0));
-
- userListsPanel.add(RemoteUserButton);
- userListsPanel.add(RemoteUserbox);
- userListsPanel.add(CloseConversationButton);
-
-
- //Messages setup
- MessagetextField = new JTextField();
- MessagetextField.setColumns(10);
- MessagetextField.addActionListener(this);
- MessagetextArea = new JTextArea("Chat");
- scrollpane = new JScrollPane();
- scrollpane.getViewport().add(MessagetextArea);
- scrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
- scrollpane.setPreferredSize(new Dimension(600,60));
- MessagetextField.setVisible(false);
- MessagetextArea.setVisible(false);
- scrollpane.setVisible(false);
- // Create a placeholder on JTextField
- MessagetextField.addFocusListener(new FocusListener() {
- @Override
- public void focusGained(FocusEvent e) {
- if (MessagetextField.getText().equals("Your message")) {
- MessagetextField.setText("");
- MessagetextField.setForeground(Color.BLACK);
- }
- }
- @Override
- public void focusLost(FocusEvent e) {
- if (MessagetextField.getText().isEmpty()) {
- MessagetextField.setForeground(Color.GRAY);
- MessagetextField.setText("Your message");
- }
- }
- });
-
-
- /*
- * 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 header = new JPanel(new GridLayout(0, 1));
- header.add(Pseudolabel);
- header.add(changePseudoPanel);
- header.add(userListsPanel);
-
- JPanel pane = new JPanel(new BorderLayout());
- pane.add(header,BorderLayout.NORTH);
- pane.add(scrollpane,BorderLayout.CENTER);
- pane.add(MessagetextField,BorderLayout.SOUTH);
- pane.setBorder(BorderFactory.createEmptyBorder(
- 30, //top
- 30, //left
- 10, //bottom
- 30) //right
- );
-
- return pane;
- }
-
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() == ChangePseudotextField) { //Changing pseudo
- String Textinput = ChangePseudotextField.getText();
- Pseudolabel.setText("Your current username is: " + Textinput);
-
- try {
- controller.changePseudo();
- } catch (IOException e1) {
- System.out.println("Error in change pseudo\n");
- e1.printStackTrace();
- }
- }else if(e.getSource() == MessagetextField){ //Messages
- String Textinput = MessagetextField.getText();
- MessagetextArea.setText(MessagetextArea.getText() + "\n" + controller.getMyUser().getPseudo() + " : " + Textinput );
- MessagetextField.setText("");
- controller.askToSend(Textinput); // ask to send to controller
-
- }else if(e.getSource() == RemoteUserButton) { //Shows remote user list
- RemoteUserbox.setVisible(true);
- }else if(e.getSource() == CloseConversationButton) {
- controller.askCloseSession();
- MessagetextArea.setVisible(false);
- scrollpane.setVisible(false);
- MessagetextField.setVisible(false);
- CloseConversationButton.setVisible(false);
- }else if(e.getSource() == RemoteUserbox){ // Choice in remote user list
-
- //JComboBox cb = (JComboBox)e.getSource(); //Casts obscurs pour récupérer le numéro du user dans la liste
- int selectedUsernb = RemoteUserbox.getSelectedIndex();
- //String.valueOf(((String) cb.getSelectedItem()).charAt(1)));
-
- // start or switch chat => get history
- String history = controller.askOpenSession(selectedUsernb);
- // display it
- MessagetextArea.setText(history);
- MessagetextField.setVisible(true);
- scrollpane.setVisible(true);
- MessagetextArea.setVisible(true);
- CloseConversationButton.setVisible(true);
- }
- }
-
- 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.
- */
- public static Interface createAndShowGUI(Controller controller) {
- //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("Clavardage App");
- frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- Interface app = new Interface(controller);
- Component contents = app.createComponents();
- frame.getContentPane().add(contents, BorderLayout.CENTER);
- frame.setPreferredSize(new Dimension(400,300));
-
- //Ends all running background tasks upon closing the window
- frame.addWindowListener(new java.awt.event.WindowAdapter() {
- @Override
- public void windowClosing(java.awt.event.WindowEvent windowEvent) {
- System.out.println("("+controller.getMyUser().getPseudo()+") Window has been closed");
- controller.askForClose();
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- });
-
- //Display the window.
- frame.pack();
- frame.setVisible(true);
-
- return app;
- }
-
- public void windowOpened(WindowEvent e) {} //Had to implement it for WindowListener
- public void windowActivated(WindowEvent e) {}
- public void windowIconified(WindowEvent e) {}
- public void windowDeiconified(WindowEvent e) {}
- public void windowDeactivated(WindowEvent e) {}
- public void windowClosed(WindowEvent e) {}
- public void windowClosing(WindowEvent e) {}
-
-
- public void notifyNewMessage(String msg) {
- MessagetextArea.setText(MessagetextArea.getText() + "\n" + msg);
-
- }
-
- public void updateActiveUsers() {
- DefaultComboBoxModel model = new DefaultComboBoxModel<>( controller.askUpdateActiveUsers() );
- RemoteUserbox.setModel( model );
- }
- /*
- public static void main(String[] args) throws IOException {
- //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();
- }
- });
- }*/
-}
\ No newline at end of file
diff --git a/Application/Clavardage/src/websocket/Appel.java b/Application/Clavardage/src/websocket/Appel.java
deleted file mode 100644
index f4b6eeb..0000000
--- a/Application/Clavardage/src/websocket/Appel.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package websocket;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import javax.websocket.ContainerProvider;
-import javax.websocket.DeploymentException;
-import javax.websocket.Session;
-import javax.websocket.WebSocketContainer;
-
-
-public class Appel {
-
- private WebSocketContainer container;
- private Client client;
-
- public void test() {
- this.container= ContainerProvider.getWebSocketContainer();
- this.client=new Client();
-
- Session session=null;
- try {
- session=this.container.connectToServer(this.client, new URI ("ws://localhost:8082/WebSocket2/hello"));
- } catch (DeploymentException | IOException | URISyntaxException e) {
- e.printStackTrace();
- System.out.println("pb avec le connect");
- }
- try {
- this.client.onOpen(session, null);
- this.client.sendMessage("hello from client");
- } catch (IOException e) {
- System.out.println("pb avec le sendMessage");
- e.printStackTrace();
- }
- }
-
-
-}
diff --git a/Application/Clavardage/src/websocket/Centralized.java b/Application/Clavardage/src/websocket/Centralized.java
deleted file mode 100644
index 8add15a..0000000
--- a/Application/Clavardage/src/websocket/Centralized.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package websocket;
-
-public class Centralized {
-
-}
diff --git a/Application/Clavardage/src/websocket/Client.java b/Application/Clavardage/src/websocket/Client.java
deleted file mode 100644
index da2eb1a..0000000
--- a/Application/Clavardage/src/websocket/Client.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package websocket;
-
-import java.io.IOException;
-
-import javax.websocket.*;
-
-public class Client extends Endpoint{
- private Session session;
-
- @Override
- public void onOpen (Session session, EndpointConfig config) {
- this.session=session;
- this.session.addMessageHandler(new MessageHandler.Whole() {
- @Override
- public void onMessage (String msg) {
- System.out.println("msg recu:"+msg);
- };}
- );
- }
-
- public void sendMessage(String msg) throws IOException {
- this.session.getBasicRemote().sendText(msg);
- }
-
-}
-