service { const html Login =

Welcome to The Talk Room

Enter your user name:

Enter your password: ; const html incorrect =

I'm sorry <[username]>, permission denied!

; const html Update =

The Talk Room Service


Messages so far:

<[msg0]>

<[msg1]>

<[msg2]>


Your new message:


Quit now ; const html ByeBye =

Thanks for visiting, <[username]>.

There have been <[conns]> connections so far.

You wrote <[msgs]> messages this time. ; string msg0,msg1,msg2; int connections; session Talk() { string username,password,msg,quit; int written; bool correct; connections = connections+1; correct = false; written = 0; while (!correct) { show Login receive [username = username, password = password]; if ((username == "Ebrahim" && password == "group5") || (username == "Abbas" && password == "password") || (username == "guest" && password == "guest")) correct = true; if (!correct) show plug incorrect [username = username]; } quit = "no"; while (quit!="yes") { show plug Update[msg0 = msg0, msg1 = msg1, msg2 = msg2] receive[msg = msg, quit = quit]; if (msg!="") { written = written+1; msg0 = msg1; msg1 = msg2; msg2 = username + "> " + msg; } } exit plug ByeBye[username = username, conns = connections, msgs = written]; } }