KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > zirc > dcc2 > DCCin


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

21 /**
22  * <p>Title: DCC</p>
23  * <p>Description: classe qui reagit aux requetes dcc (depuis connectthread)</p>
24  * <p>Copyright: Copyright (c) 2004</p>
25  * <p>Company: CoolBytes(Stephane Claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com</p>
26  * @version 1.0
27  */

28
29
30 public class DCCin
31 {
32   private String JavaDoc line ;
33   MainFrame frm;
34
35   public static void main(String JavaDoc[] args)
36   {
37    // test r = new test(" ") ;
38
}
39
40   public DCCin(MainFrame _frm,IRCconnexion _IRCchan,String JavaDoc _line)
41   {
42     frm=_frm;
43     line = _line ;
44     ArrayList elements = new ArrayList() ;
45     StringTokenizer str=new StringTokenizer(line," ");
46     while(str.hasMoreElements())//DCC SEND Tropix-default(2004-10-14)-OS.zip 3473917498 1031 523948
47
{
48
49       elements.add(str.nextElement());
50     }
51     String JavaDoc sender=line.substring(line.indexOf(":")+1,line.indexOf("!"));
52     System.err.println(sender);
53     String JavaDoc CMD=elements.get(elements.size()-5).toString();
54     System.err.println(CMD);
55     if(CMD.equalsIgnoreCase("SEND"))
56     {
57       DCCincomingThread dcct = new DCCincomingThread((elements.get(elements.size() - 3)).toString(),
58           Integer.parseInt(elements.get(elements.size() - 2).toString()), elements.get(elements.size() - 4).toString(),
59           Integer.parseInt(elements.get(elements.size() - 1).toString().trim()), frm, _IRCchan, sender, 0) ;
60     }
61
62   }
63
64   public void sendRequest()
65   {
66
67   }
68
69   private void parse(String JavaDoc line)
70   { //:azuu2!~mircfr@D4DF17FB.E2CAE448.1E6C9F19.IP PRIVMSG azuu :DCC SEND readme.txt 3588064607 12608 2036
71

72   }
73 }
74
75 //dcc resume char null debut et fin
76
//
77
/*If User2 chooses to resume a file transfer of an existing file, the following
78 negotiation takes place:
79
80 User2 sends:
81
82 //PRIVMSG User1 :DCC RESUME filename port position
83
84 filename = the filename sent by User1.
85 port = the port number sent by User1.
86 position = the current size of the file that User2 has.
87
88 User1 then responds:
89
90 //PRIVMSG User2 :DCC ACCEPT filename port position
91
92 This is simply replying with the same information that User2 sent as
93 acknowledgement.
94
95 */

96
Popular Tags