1 package zirc.msg ; 2 3 import java.util.* ; 4 5 import zirc.base.* ; 6 import zirc.gui.* ; 7 8 21 28 29 30 public class MSGquit extends AbstractMessage 31 { 32 33 private String user ; 34 private ArrayList tmp ; 35 private ChanUser chanUser ; 36 private IRCconnexion IRCchan ; 37 private String msg ; 38 39 public MSGquit(IRCconnexion _IRCchan, String _name, String _line) 40 { 41 IRCchan = _IRCchan ; 42 int ind = _name.indexOf("!") ; 46 47 if (ind > -1) 48 { 49 user = _name.substring(1, ind) ; 50 } 51 else 52 { 53 user = "" ; 54 } 55 chanUser = new ChanUser(user, ChanUser.NORM) ; 56 57 msg = _line.substring(_line.lastIndexOf(":"), _line.length()) ; 59 } 60 61 protected void setColor(StringBuffer _htmlMsg) 63 { 64 _htmlMsg.insert(0, "<font color=" + vectColors[4] + ">") ; _htmlMsg.append("</font>") ; 66 } 67 68 public void reagit() 69 { 70 try 71 { 72 tmp = IRCchan.getAllChatFrames() ; 73 for (int i = 0 ; i < tmp.size() ; i++) 74 { 75 int index = Arrays.binarySearch(((ChatFrame)(tmp.get(i))).getListModel().toArray(), chanUser) ; 76 if (index > 0) 77 { 78 StringBuffer txt = new StringBuffer (chanUser.getNameSansRank() + " s'est deconnecte" + msg) ; 79 ((ChatFrame)(tmp.get(i))).removeUserFromChan(chanUser.getNameAvecRank()) ; 80 try 81 { 82 txt = super.toHtml(txt.toString()) ; 83 setColor(txt) ; 84 ((ChatFrame)(tmp.get(i))).displayTxt(txt, txt.length(), false) ; 85 } 86 catch (Exception ex) 87 { 88 } 89 } 90 } 91 } 92 catch (NullPointerException ex) 93 {ex.printStackTrace() ; 94 } 95 } 96 97 } 98
| Popular Tags
|