| 1 package sellwin.domain; 2 3 7 8 import java.io.*; 9 import java.util.*; 10 11 15 public class ChatPacket implements Serializable { 16 public static final int SEND_MSG = 0; 19 public static final int QUERY_USERS = 1; 20 public static final int LOGON = 2; 21 public int action; 22 23 public ArrayList sendToList; 25 26 public ArrayList onlineUsers; 28 29 public String message; 30 public String sender; 31 32 public ChatPacket() { 33 } 34 35 public void print() { 36 if (action == 0) { 37 System.out.println("message: " + action + ":" + message + " from " + sender); 38 System.out.println("list of recipients..."); 39 for (int j=0;j<sendToList.size();j++) { 40 System.out.println("user:" + (String )sendToList.get(j)); 41 } 42 } else { 43 System.out.println("list of online users...."); 44 for (int i=0;i<onlineUsers.size();i++) { 45 System.out.println("user:" + (String )onlineUsers.get(i)); 46 } 47 } 48 } 49 50 public void setAction(int action) { 51 this.action = action; 52 } 53 public int getAction() { return action; } 54 55 public void setToList(ArrayList toList) { 56 this.sendToList = toList; 57 } 58 public ArrayList getToList() { return sendToList; } 59 60 61 public void setOnlineUsers(ArrayList users) { 62 this.onlineUsers = users; 63 } 64 public ArrayList getOnlineUsers() { return onlineUsers; } 65 66 public void setMessage(String message) { 67 this.message = message; 68 } 69 public String getMessage() { return message; } 70 71 public void setSender(String sender) { 72 this.sender = sender; 73 } 74 75 public String getSender() { return sender; } 76 } 77 | Popular Tags |