KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > zirc > msg > MSGJoin


1 package zirc.msg ;
2
3 import zirc.base.* ;
4 import zirc.gui.* ;
5
6 //zIrc, irc client.
7
// Copyright (C) 2004 CoolBytes(Stephane claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com
8
//
9
// This program is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU General Public License
11
// as published by the Free Software Foundation; either version 2
12
// of the License, or (at your option) any later version.
13
//
14
// This program is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
// GNU General Public License for more details.
18

19 /**
20  * <p>Title: MSGjoin</p>
21  * <p>Description: </p>
22  * <p>Copyright: Copyright (c) 2004</p>
23  * <p>Company: CoolBytes(Stephane Claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com</p>
24  * @version 1.0
25  */

26
27 //:_zuzu!origin@81.13.160.173 JOIN #fucker
28
//:_zuzu!origin@C88E62C1.B689DC1.AC2867A0.IP JOIN :#accueil
29

30 public class MSGJoin extends AbstractMessage
31 {
32   protected String JavaDoc user ;
33   protected String JavaDoc chan ;
34
35   public MSGJoin(IRCconnexion _IRCchan, String JavaDoc _name, String JavaDoc _chan, String JavaDoc _line)
36   {
37     super(_IRCchan, _line) ;
38     chan = _chan.replaceFirst(":", "") ;
39
40     //
41
//extraire le nom de User
42
//
43
int ind = _name.indexOf("!") ;
44
45     if (ind > -1)
46     {
47       user = _name.substring(1, ind) ;
48     }
49     else
50     {
51       user = "" ;
52     }
53
54   }
55
56 //juste rajoute le vert et le paragraph
57
protected void setColor(StringBuffer JavaDoc _htmlMsg)
58   {
59     _htmlMsg.insert(0, "<font color=" + vectColors[3] + ">") ;
60     _htmlMsg.append("</font>") ;
61   }
62
63 //parser le message
64
public String JavaDoc parseMessagePourAffichage(String JavaDoc _txtAffiche)
65   {
66     return user + " a rejoint " + chan ;
67   }
68
69   public void reagit()
70   {
71     //
72
//si c'est nous
73
//
74
if (ircChan.GetUser_nickName().equalsIgnoreCase(user))
75     {
76       frm = ircChan.createChatFrame(chan) ;
77     }
78     else
79     {
80       //si qqn d'autre, chercher la fen concernée
81
ChatFrame cht = ircChan.GetFenetreDuChan(chan) ;
82       if (cht != null)
83       {
84         //ajouter le type dans la liste des users.
85
cht.addNewUserInChan(user) ;
86
87         //le message sera affiché dans la chatframe trouvée
88
this.frm = cht ;
89       }
90
91     }
92   }
93
94   protected boolean informeUser()
95   {
96     return false ;
97   }
98
99 }
100
Popular Tags