KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > zirc > msg > MSGnick


1 package zirc.msg ;
2
3 import zirc.base.* ;
4 import zirc.threads.* ;
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: MSGnick</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 public class MSGnick extends AbstractMessage
29 {
30   protected String JavaDoc oldNick ;
31   protected String JavaDoc newNick ;
32
33   public MSGnick(IRCconnexion _IRCchan, String JavaDoc _oldname, String JavaDoc _newName)
34   {
35     super(_IRCchan, "") ;
36     newNick = _newName.substring(1) ;
37
38     //
39
//extraire le nom de User
40
//
41
int ind = _oldname.indexOf("!") ;
42
43     if (ind > -1)
44     {
45       oldNick = _oldname.substring(1, ind) ;
46     }
47     else
48     {
49       oldNick = "" ;
50     }
51   }
52
53   public void affiche()
54   {
55     //ne rien faire
56
}
57
58   public void reagit()
59   {
60     //
61
//si c'est nous
62
//
63
if (ircChan.GetUser_nickName().equalsIgnoreCase(oldNick))
64     {
65       ircChan.setUser_NickName(newNick) ;
66     }
67
68     //lancer le thread de mise a jour de nick
69
ircChan.ajouteTache(new ChangeUserNickThread(ircChan, oldNick, newNick)) ;
70   }
71 }
72
Popular Tags