KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > rero > client > InternetRelayChatClient


1 package rero.client;
2
3 import rero.net.SocketSystem;
4 import rero.ircfw.ChatFramework;
5
6 import java.util.*;
7 import java.io.*;
8
9 import rero.net.SocketInformation;
10
11 import rero.net.SocketEvent;
12 import rero.net.interfaces.SocketStatusListener;
13
14 import rero.ircfw.interfaces.ChatListener;
15 import rero.ircfw.interfaces.FrameworkConstants;
16
17 import rero.script.*;
18 import sleep.runtime.*;
19
20 import rero.dcc.*;
21
22 import rero.util.*;
23
24 import rero.client.user.*; // import features
25
import rero.client.server.*;
26 import rero.client.notify.*;
27 import rero.client.dcc.*;
28 import rero.client.listeners.*; // misc. built in client events. fun fun.
29
import rero.client.output.*;
30 import rero.client.data.*;
31 import rero.client.script.*;
32
33 import rero.gui.*;
34 import rero.config.*;
35
36 public class InternetRelayChatClient
37 {
38    protected WeakHashMap data = new WeakHashMap(); // Client central data repository.
39

40    //
41
// Frameworks and Such
42
//
43
protected ChatFramework ircfw = new ChatFramework();
44    protected SocketSystem sock = new SocketSystem();
45    protected ScriptCore script = new ScriptCore();
46
47    protected Capabilities actions;
48
49    public void init(UICapabilities gui)
50    {
51        ircfw.storeDataStructures(data);
52         sock.storeDataStructures(data);
53       script.storeDataStructures(data);
54
55       //
56
// import systems into eachother.
57
//
58
script.announceFramework(ircfw); // this has to be done early on to get the bridges to be created.
59

60       sock.addSocketDataListener(ircfw.getProtocolHandler()); /* socket events are fired in a first in first out fashion.
61                                                               /* so the framework will be the last thing to touch the socket
62                                                               /* event... */

63
64       actions = new Capabilities(ircfw, sock.getSocket(), script, gui, data);
65    }
66
67    public void post()
68    {
69       //
70
// do other fun stuff... i.e. script loading and such
71
//
72
((ScriptManager)getCapabilities().getDataStructure(DataStructures.ScriptManager)).loadScripts();
73    }
74
75    public Capabilities getCapabilities()
76    {
77       return actions;
78    }
79
80    public WeakHashMap getData()
81    {
82       return data;
83    }
84 }
85
Popular Tags