diff options
author | Dor Bivas <dor1_b@walla.com> | 2014-01-18 18:22:42 +0200 |
---|---|---|
committer | Dor Bivas <dor1_b@walla.com> | 2014-01-18 18:22:42 +0200 |
commit | 02e6012ca5983d52441560ecd737267bdaaecf93 (patch) | |
tree | a78db764a560071a31fe92047b03040bd2d5fab5 /src/Client/ChatClient.java | |
parent | bab1f5e92dcc4e77ab1a9fa95a91b816d385b457 (diff) |
client: fix QUOTE, isConnected
* Add attribute isConnected.
* Handling of /QUOTE: there is the extra space.
Diffstat (limited to 'src/Client/ChatClient.java')
-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 |