summaryrefslogtreecommitdiff
path: root/src/Server/Client.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server/Client.java')
-rw-r--r--src/Server/Client.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Server/Client.java b/src/Server/Client.java
index f7d015b..4ab36dd 100644
--- a/src/Server/Client.java
+++ b/src/Server/Client.java
@@ -28,10 +28,15 @@ public class Client
{
return this.nick;
}
- /** changing the nick name */
- public void setNick(String newNick)
+ /** set nick name if it does not exist. */
+ public boolean setNick(String newNick)
{
+ if (!ChatServer.server.addNick(newNick))
+ {
+ return false;
+ }
this.nick = newNick;
+ return true;
}
/** returning the host name */
public String getHostname()