diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Client/ChatClient.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Client/ChatClient.java b/src/Client/ChatClient.java index 6099474..bcc5612 100644 --- a/src/Client/ChatClient.java +++ b/src/Client/ChatClient.java @@ -20,6 +20,7 @@ public class ChatClient private ChatClientWriter writer; private UserInterface ui; private Socket soc; + private boolean isConnected = false; ChatClient() { this.soc = null; @@ -40,22 +41,34 @@ public class ChatClient { this.nick = nick; } - /** changing the real name */ + /** changing the real name + * @param realname the name to set*/ public void setRealname (String realname) { this.realname = realname; } + /** mark client as connected */ + public void setConnected() + { + this.isConnected = true; + } + + /** send a line to server */ public void runSendline (String line) { + if (!this.isConnected) + return; + writer.sendLine(line); } + /** */ public void PRIVMSG (String line) { - if ((line.length() >= 6) && (line.substring(0,6)).equals(new String("/QUOTE"))) + if ((line.length() >= 7) && (line.substring(0,7)).equals(new String("/QUOTE "))) { - runSendline(line.substring(6, line.length())); + runSendline(line.substring(7, line.length())); } else |