1 package rero.ircfw; 2 3 import java.util.TreeMap ; 4 import java.util.HashMap ; 5 import java.util.Set ; 6 7 import rero.ircfw.interfaces.FrameworkConstants; 8 9 import java.util.Iterator ; 10 import java.util.Comparator ; 11 12 public class User implements Comparable , FrameworkConstants 13 { 14 protected String nickname = ""; 15 16 public void setNick(String n) { nickname = n; } 17 public String getNick() { return nickname; } 18 19 public int compareTo(Object b) 20 { 21 User bb; 22 bb = (User)b; 23 24 if (bb == null) 25 return -1; 26 27 return (getNick().toUpperCase().compareTo(bb.getNick().toUpperCase())); 28 } 29 30 public User(String nick) 31 { 32 nickname = nick; 33 } 34 35 protected HashMap channels = new HashMap (); 36 37 38 public HashMap getChannelData() { return channels; } 39 public Set getChannels() { return channels.keySet(); } 40 41 public int getModeFor(Channel ch) 42 { 43 return ((Integer )channels.get(ch)).intValue(); 44 } 45 46 public void setModeFor(Channel ch, int modes) 47 { 48 channels.put(ch, new Integer (modes)); 49 } 50 51 protected String address = ""; 52 53 public void setAddress(String a) { address = a; } 54 public String getAddress() { return address; } 55 56 public String getFullAddress() 57 { 58 return getNick() + "!" + getAddress(); 59 } 60 61 protected long idle = System.currentTimeMillis(); 62 63 public void touch() { idle = System.currentTimeMillis(); } 64 65 66 public int getIdleTime() { return (int)((System.currentTimeMillis() - idle) / 1000); } 67 68 public boolean isIdle() 69 { 70 return (System.currentTimeMillis() - idle) > (1000 * 60 * 5); } 72 73 public String toString() 74 { 75 return getNick(); 76 } 77 } 78 | Popular Tags |