JavaJoshChat IRC Client Design

 

 

IRC Client Design

The diagrams below represent classes used to implement IRC client objects, with associated threads, queues, and windows.

Before anything can be implemented, we have to establish a master input and output thread that communicates with a the IRC server. The following diagram illustrates this:

wpe1.jpg (22581 bytes) 

The next diagram shows the status window implemented, and this design can be cloned for the other types of windows, chat, dcc chat, dcc send, channels, etc.

There is only one IRC Server Connection Object for each IRC network connection that the user establishes. It may be that such a connection object will be needed for each of the other class objects, for chat windows and DCC windows, etc., but I am not sure, because I am not totally familiar with the IRC specs.

wpe3.jpg (34547 bytes)

Note the EnQueue from the Status Input Thread to the Server Output Queue. This would be for internally handled responses to the IRC server, such as PING and PONG.

Note that the Server Output Queue is part of the IRC Server Connection Object. This is because all the classes that implement the various objects of the IRC client use this queue as a common buffer for sending messages to the IRC server.

 

We are dealing with two classes here:

  1. IRC Server Connection Class
  2. IRC Server Status Class

These two classes are the main classes needed for a minimal IRC client connection to an IRC server. The first dotted box around the IRC server input thread and input queue, and the output thread and output queue represents the IRC Server Connection Class Object. This class implements the threads and queues for each connection to an IRC server that the user establishes.

The second dotted box around the status input thread, status output thread, and the status window represents the Class that implements the single instance of the IRC Server Status object. Only one such instance is need for each IRC server connection established.

You could use the IRC Server Status Class as a model for chat windows, dcc windows, and channels. All of these too would communicate with the Input and Output threads of the IRC server connection object, via the input and output queues.

 

Now for all of IRC Client classes:

  1. Server Connection Class
  2. Server Status Class
  3. Message Class
  4. Channel Class
  5. DCC Chat Class
  6. DCC Send Class
  7. DCC Get Class

Each queue in the design of the client must have a generic layout.

QUEUE is a bag, a buffer...a clipboard. Or you can think of it as a barrel..... there is FIFO and LIFO.... first in first out(FIFO), or last in first out (LIFO)...... You want a FIFO queue... the first element in is the first one to be dequeued. Two ends to a Q... the in and the out. You define the data type that goes into the Q when setting it up... You want to define a generic data structure for your queues --- think of it as a record in a database.. Make up fields......

Here is a basic data structure for the queue element design:

NAME TYPE DESCRIPTION
Type Int Type of queue element... (0=system, 1=msg chat, 2=dcc chat, etc.)
Destiny Char[50] Channel or Nick message is destine for (when appropriate, for outgoing data)
From Char[50] Channel or Nick message was generated from (when appropriate, for incoming data)
Data Char[1024] Data of the message (text most of the time)

 

 

Now for the other diagrams for the remaining classes:

Message Class

wpe4.jpg (34640 bytes) 

Psuedo Code:

Class MsgClass {

    Queue input;
    Queue output;
    Thread Tin;
    Thread Tout;
    Window Win;

}

Wow, I don’t think I need to do anymore, cause they all look the same from here on out, just different names!

©1997 KG Computer Services & Exposure Internet Services