This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 public class Room {
2     String name;
3     HashSet participants;
4     public Room(String n) {
5         name=n;
6         participants=new HashSet();
7     }
8     
9     synchronized void addParticipant(ChatThread cs) {
10         participants.add(cs);
11         cs.room=this;
12     }
13
14     synchronized void sendToRoom(ChatThread caller, byte [] message) {
15         HashMapIterator hmi=participants.iterator();
16         while(hmi.hasNext()) {
17             ChatThread cs=(ChatThread) hmi.next();
18             if (cs!=caller)
19                 cs.sock.write(message);
20         }
21     }
22 }