KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ChangeUserGradeThread


1 /*
2 ACTUALLY NO USED
3 */

4
5
6 /*package zirc.threads ;
7
8 import java.util.* ;
9 import javax.swing.* ;
10 import zirc.base.* ;
11 import zirc.gui.* ;
12
13 //zIrc, irc client.
14 // Copyright (C) 2004 CoolBytes(Stephane claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com
15 //
16 // This program is free software; you can redistribute it and/or
17 // modify it under the terms of the GNU General Public License
18 // as published by the Free Software Foundation; either version 2
19 // of the License, or (at your option) any later version.
20 //
21 // This program is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25
26 /**
27  * <p>Title: ChangeUserGradeThread</p>
28  * <p>Description: thread qui change le grade d'un user suite a un NICK</p>
29  * <p>Copyright: Copyright (c) 2004</p>
30  * <p>Company: CoolBytes(Stephane Claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com</p>
31  * @version 1.0
32  */

33
34
35 /*public class ChangeUserGradeThread extends PseudoThread
36 {
37   private IRCconnexion IRCchan ;
38   private String channel ;
39   private String nick ;
40   private int oldRank ;
41   private int newRank ;
42
43   public ChangeUserGradeThread(IRCconnexion _IRCchan, String _channel, int _newRank, String _nick)
44   {
45     super() ;
46     IRCchan = _IRCchan ;
47     newRank = _newRank ;
48     nick = _nick ;
49     channel = _channel ;
50   }
51
52   public void go()
53   {
54     ArrayList Frm = IRCchan.getAllChatFrames() ;
55     DefaultListModel lm ;
56     int ind = -1 ;
57
58     for (int i = 0 ; i < Frm.size() ; i++)
59     {
60       if (((ChatFrame)(Frm.get(i))).getChan().equals(channel))
61       {
62         ChatFrame chatFrame = ((ChatFrame)(Frm.get(i))) ;
63         lm = chatFrame.getListModel() ;
64
65         //trouver l'ancien rang
66         ind = Arrays.binarySearch(lm.toArray(), new ChanUser(nick, ChanUser.OP)) ;
67         if (ind < 0)
68         {
69           ind = Arrays.binarySearch(lm.toArray(), new ChanUser(nick, ChanUser.HALFOP)) ;
70         }
71         if (ind < 0)
72         {
73           ind = Arrays.binarySearch(lm.toArray(), new ChanUser(nick, ChanUser.VOICE)) ;
74         }
75         if (ind < 0)
76         {
77           ind = Arrays.binarySearch(lm.toArray(), new ChanUser(nick, ChanUser.NORM)) ;
78         }
79
80         if (ind >= 0)
81         {
82           lm.removeElementAt(ind) ;
83           chatFrame.addNewUserInChan(new ChanUser(nick, newRank)) ;
84         }
85       }
86     }
87   }
88 }*/

89
Popular Tags