summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDor Bivas <dor1_b@walla.com>2014-01-18 18:19:36 +0200
committerDor Bivas <dor1_b@walla.com>2014-01-18 18:19:36 +0200
commitbab1f5e92dcc4e77ab1a9fa95a91b816d385b457 (patch)
treef59504d54573e2f0aa7c0d238fdc28071fe228fb
parent4ba8e7836f0f25a05f53a9a3754baaa5b7084059 (diff)
server: print privmsg to all clients
* Connection.getClieont * Privmsg handler uses it to print the message to all connections * Unrelated: remove connection from list on shutdown.
-rw-r--r--src/Server/CommandsTable.java2
-rw-r--r--src/Server/Connection.java8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/Server/CommandsTable.java b/src/Server/CommandsTable.java
index af423ea..f0152e2 100644
--- a/src/Server/CommandsTable.java
+++ b/src/Server/CommandsTable.java
@@ -80,7 +80,7 @@ class CommandPrivmsg extends Command
{
Connection con = iter.next();
ports += con.toString();
- this.println(client, "PRIVMSG #fixme-chan :" + line);
+ this.println(con.getClient(), "PRIVMSG #fixme-chan :" + line);
}
System.err.println("printed message to ports: " + ports);
}
diff --git a/src/Server/Connection.java b/src/Server/Connection.java
index 92869f1..cdb02b8 100644
--- a/src/Server/Connection.java
+++ b/src/Server/Connection.java
@@ -48,8 +48,16 @@ public class Connection extends Thread
this.soc = soc;
}
+ public Client getClient()
+ {
+ return this.client;
+ }
+
public void shutdown()
{
+
+ ChatServer.server.connectionRemove(this);
+
try
{
if (!soc.isClosed())