KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > zirc > msg > MSGnotice


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: MSGnotice</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
28 //
29
//notice standard
30
//
31
public class MSGnotice extends AbstractMessage
32 {
33   public MSGnotice(IRCconnexion _IRCchan, AbstractChatFrame _frm, String JavaDoc _txt)
34   {
35     super(_IRCchan, _frm, _txt) ;
36
37   }
38
39 //juste rajoute le brun et la balise de paragraphe
40
protected void setColor(StringBuffer JavaDoc _htmlMsg)
41   {
42     _htmlMsg.insert(0, "<font color=" + vectColors[5] + ">") ;
43     _htmlMsg.append("</font>") ;
44   }
45
46   public String JavaDoc parseMessagePourAffichage(String JavaDoc _txtAffiche)
47   {
48     String JavaDoc rech = "!" ;
49     String JavaDoc ret = "" ;
50     int pos = _txtAffiche.indexOf(rech) ;
51
52     //cas 1: c'est un nickname qui fait la notice
53
if (pos > -1)
54     {
55       ret = "-" + _txtAffiche.substring(1, pos) + "- " ;
56     }
57     else
58     {
59       //cas 2 c'est le serveur
60
rech = " " ;
61       pos = _txtAffiche.indexOf(rech) ;
62       if (pos > -1)
63       {
64         ret = _txtAffiche.substring(1, pos + 1) ;
65       }
66
67     }
68
69     //chopper ce qu il y a apres le nickname
70
rech = ircChan.GetUser_nickName() ;
71     pos = _txtAffiche.indexOf(rech) ;
72     if (pos > -1)
73     {
74       ret += _txtAffiche.substring(pos + rech.length() + 1) ;
75     }
76
77     return ret ;
78
79   }
80 }
81
Popular Tags