]> code.citadel.org Git - citadel.git/commitdiff
added paging support, who is online, various bug fixed/graphical enhancements
authorChilly <chilly@uncensored.citadel.org>
Thu, 5 Aug 1999 16:19:14 +0000 (16:19 +0000)
committerChilly <chilly@uncensored.citadel.org>
Thu, 5 Aug 1999 16:19:14 +0000 (16:19 +0000)
shaggy/STATUS
shaggy/citadel.java
shaggy/enterPanel.java
shaggy/expressWindow.java
shaggy/loginPanel.java
shaggy/logoffPanel.java
shaggy/mainPanel.java
shaggy/messagePanel.java
shaggy/net.java

index 99d3a6b3e414b13e605430ca80faa886e8bb73dd..246e88df678e7c26e3ec2dd711018ce60f202b4c 100644 (file)
@@ -6,11 +6,11 @@ Basic:
 - can log off (shows goodbye, and in application lets you connect to a
   different server)
 
-* can't recieve express messages (GEXP style, will get all messages that
+- can recieve express messages (GEXP style, will get all messages that
   are there.
-* can't send and "reply" to express messages, uses either single or multi
+- can send and "reply" to express messages, uses either single or multi
   depending on server support.
-* no who is online
+- no who is online
 - supports the IDEN command
 - Automaticcaly goes to mail room if you have new messages
 * can't change password or other config stuff
@@ -33,8 +33,7 @@ Basic:
 - forward and  reverse
 - enter messages in room (only type 0)
 - handles Mail room
-* doesn't say anything about having mail or going there first, just lists
-  Mail in the "new" list.
+- checks for mail and opens mail room automatically if you have any new
 * No reply button when in mail room.
 - can see "next" and "prev" message.  (goes through the MSGS list which it
   gets when you first enter the room) no way to jump around (yet?).
@@ -46,4 +45,4 @@ Basic:
   better personally, but hey, that's me.
 * can't view room info
 
-everything else isn't done.
+everything else isn't done.
\ No newline at end of file
index 931a5a258997923c17e6672f4b4d196625c6bb04..644a0907217305963593262a6b3c48f86a92c592 100644 (file)
@@ -1,3 +1,5 @@
+import javax.swing.JFrame;
+import java.util.*;
 
 public class citadel {
     public final static String NAME="Shaggy", VERSION="0.1";
@@ -5,6 +7,7 @@ public class citadel {
 
     String             server;
     int                        port;
+    Vector             windows;
 
     citGui             cg;
     net                        theNet;
@@ -33,6 +36,7 @@ public class citadel {
        theNet = new net();
        serverInfo = null;
        rf = null;
+       windows = new Vector();
     }
 
     public void showHostBrowser() {
@@ -70,7 +74,13 @@ public class citadel {
     }
 
     public void expressMsg() {
-       System.out.println( "got an express message!" );
+       networkEvent( "GEXP", new CallBack() {
+           public void run( citReply r ) {
+               if( !r.error() )
+                   new expressWindow(r);
+               if( atoi( r.getArg( 0 ) ) != 0 )
+                   expressMsg();
+           } } );
     }
 
     public void gotoRoom( String name ) {
@@ -98,6 +108,10 @@ public class citadel {
        networkEvent( cmd, null, cb );
     }
 
+    public void networkEvent( String cmd, String data ) {
+       networkEvent( cmd, data, null );
+    }
+
     public void networkEvent( String cmd, String data, CallBack cb ) {
        theNet.append( new MsgCmd( cmd, data, cb ) );
     }
@@ -172,6 +186,11 @@ public class citadel {
        if( rf != null )
            rf.dispose();
        rf = null;
+       for( Enumeration e = windows.elements(); e.hasMoreElements(); ) {
+           JFrame      f = (JFrame)e.nextElement();
+           f.dispose();
+       }
+
        cg.showLogoffPanel();
        networkEvent( "QUIT", new CallBack() {
            public void run( citReply r ) {
@@ -190,6 +209,14 @@ public class citadel {
            } } );
     }
 
+    public void registerWindow( JFrame win ) {
+       windows.addElement( win );
+    }
+
+    public void removeWindow( JFrame win ) {
+       windows.removeElement( win );
+    }
+
     public boolean floors() {
        return true;    // FIXME
     }
index f175a9117157bb6bc690324bc78dd0867d04624f..a5caded27bfb409277ffaf53b2519b78a7986cfc 100644 (file)
@@ -2,8 +2,6 @@ import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
 
-/* Quick quick quick hack */
-
 public class enterPanel extends JPanel{
     roomFrame  rf;
     roomInfo   ri;
@@ -15,16 +13,43 @@ public class enterPanel extends JPanel{
        this.rf = rf;
        setLayout( new BorderLayout() );
 
-       add( "North", to = new JTextField() );
+       JPanel  p = new JPanel();
+       p.setBorder( BorderFactory.createTitledBorder(
+                    BorderFactory.createEtchedBorder(), "Recipient" ) );
+       p.setLayout( new BorderLayout() );
+
+       p.add( "Center", to = new JTextField() );
+
+       JButton b = new JButton( "Select" );
+       b.addActionListener( new ActionListener() {
+           public void actionPerformed( ActionEvent e ) {
+               System.out.println( "User list bialog!" );
+           } } );
+
+       p.add( "East", b );
+
+       add( "North", p );
+
        to.addActionListener( new ActionListener() {
            public void actionPerformed( ActionEvent e ) {
                msg.requestFocus();
            } } );
 
-       add( "Center", msg = new JTextArea() );
+       p = new JPanel();
+       p.setBorder( BorderFactory.createTitledBorder(
+                    BorderFactory.createEtchedBorder(), "Message Text" ) );
+       p.setLayout( new BorderLayout() );
 
-       JPanel  p = new JPanel();
-       JButton b;
+       p.add( "Center", new JScrollPane( msg = new JTextArea(), 
+                 JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+                 JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ) );
+
+       msg.setLineWrap( true );
+       msg.setWrapStyleWord( true );
+
+       add( "Center", p );
+
+       p = new JPanel();
 
        p.add( b = new JButton( "Send" ) );
        b.addActionListener( new ActionListener() {
index 934a378151a106173848f835cb0be652ee824943..9600500b447cdaaa9b9e1cb144487ffc03039f3b 100644 (file)
@@ -1,52 +1,61 @@
-/* expressWindow.java
- * for showing express messages...
- */
-
+import javax.swing.*;
 import java.awt.*;
-
-public class expressWindow extends Frame {
-  String       user;
-  TextArea     msg;
-  Button       reply, ok;
-
-  public expressWindow( citReply r ) {
-    user = r.getArg( 3 );
-    
-    setTitle( user + " : express message" );
-
-    setLayout( new BorderLayout() );
-    NamedPanel np = new NamedPanel( "Message" );
-
-    np.setLayout( new BorderLayout() );
-    np.add( "Center", msg = new TextArea() );
-    msg.append( r.getData() );
-
-    add( "Center", np );
-
-    Panel p = new Panel();
-    p.add( reply = new Button( "Reply" ) );
-    p.add( ok = new Button( "OK" ) );
-    add( "South", p );
-
-    int                more = citadel.atoi( r.getArg( 0 ) );
-    if( more != 0 ) new expressWindow( citadel.me.getReply( "GEXP" ) );
-
-    resize( 300, 300 );
-    show();
-  }
-
-  public boolean handleEvent( Event e ) {
-    if( e.id == Event.WINDOW_DESTROY )
-      dispose();
-    return super.handleEvent( e );
-  }
-
-  public boolean action( Event e, Object o ) {
-    if( e.target == reply ) {
-      dispose();
-      citadel.me.page_user( user );
-    } else if( e.target == ok )
-      dispose();
-    return super.action( e, o );
-  }
+import java.awt.event.*;
+
+public class expressWindow extends JFrame {
+    String     who;
+
+    public expressWindow( citReply r ) {
+       who = r.getArg( 3 );
+       setTitle( who + " : express message" );
+
+       JPanel  p = new JPanel();
+       p.setLayout( new BorderLayout() );
+       p.setBorder( BorderFactory.createTitledBorder( 
+                    BorderFactory.createEtchedBorder(), "Message" ) );
+
+       JTextArea       t = new JTextArea( r.getData() );
+       t.setLineWrap( true );
+       t.setWrapStyleWord( true );
+
+       p.add( "Center", new JScrollPane( t ) );
+
+       Container       c = getContentPane();
+       c.setLayout( new BorderLayout() );
+       c.add( "Center", p );
+
+       p = new JPanel();
+
+       JButton b;
+       p.add( b = new JButton( "Reply" ) );
+       b.addActionListener( new ActionListener() {
+           public void actionPerformed( ActionEvent e ) {
+               new pageUserWindow( who );
+               closeWin();
+           } } );
+
+       p.add( b = new JButton( "Close" ) );
+       b.addActionListener( new ActionListener() {
+           public void actionPerformed( ActionEvent e ) {
+               closeWin();
+           } } );
+
+       c.add( "South", p );
+
+       addWindowListener( new WindowAdapter() {
+           public void windowClosing( WindowEvent e ) {
+               closeWin();
+           }
+       } );
+
+       citadel.me.registerWindow( this );
+       pack();
+       show();
+    }
+
+    public void closeWin() {
+       citadel.me.removeWindow( this );
+       dispose();
+       System.out.println( "expressWindow:closeWin" );
+    }
 }
index 6952081c2ca6131b8bd8607fe765548530353d53..42047f082fe90928f938d9bf1393499c0dd8d895 100644 (file)
@@ -17,6 +17,8 @@ public class loginPanel extends JPanel {
     p.setBorder( BorderFactory.createTitledBorder( 
                  BorderFactory.createEtchedBorder(), "Welcome Message" ) );
     p.add( "Center", message = new JTextArea() );
+    message.setLineWrap( true );
+    message.setWrapStyleWord( true );
     add( "Center", p );
 
     p = new JPanel();
index 70177e3a6a378468a52c4029a603fa2a7226f0f2..31227b2216498f842c3d4c819e0dd14f501500fa 100644 (file)
@@ -15,6 +15,9 @@ public class logoffPanel extends JPanel {
     p.setBorder( BorderFactory.createTitledBorder( 
                  BorderFactory.createEtchedBorder(), "Goodbye Message" ) );
     p.add( "Center", message = new JTextArea() );
+    message.setLineWrap( true );
+    message.setWrapStyleWord( true );
+
     add( "Center", p );
 
     p = new JPanel();
index 381e06da12dd36dd0f89dcda4006307ca5b2c071..23a7816214ae3a7fa6d7957e181fce758ce6cdc5 100644 (file)
@@ -37,11 +37,13 @@ public class mainPanel extends JPanel {
        vp.add( b = new JButton( "Page User" ) );
        b.addActionListener( new ActionListener() {
            public void actionPerformed( ActionEvent e ) {
+               new pageUserWindow();
            }});
 
        vp.add( b = new JButton( "Who Online" ) );
        b.addActionListener( new ActionListener() {
            public void actionPerformed( ActionEvent e ) {
+               new whoOnlineWindow();
            }});
 
        vp.add( b = new JButton( "Options" ) );
@@ -49,11 +51,15 @@ public class mainPanel extends JPanel {
            public void actionPerformed( ActionEvent e ) {
            }});
 
+       b.setEnabled( false );
+
        vp.add( b = new JButton( "Server Info" ) );
        b.addActionListener( new ActionListener() {
            public void actionPerformed( ActionEvent e ) {
            }});
 
+       b.setEnabled( false );
+
        vp.add( b = new JButton( "Logoff" ) );
        b.addActionListener( new ActionListener() {
            public void actionPerformed( ActionEvent e ) {
index 4731706bbba08a84827302c3718a8cbde91177a5..15cd450381c3b66f9c55d91a3cf443d1abd379e3 100644 (file)
@@ -48,6 +48,8 @@ public class messagePanel extends JPanel {
                System.out.println( "Zap room" );
            } } );
 
+       b.setEnabled( false );
+
 
        jcb = new JComboBox();
        jcb.addItem( "Read New" );
@@ -89,8 +91,13 @@ public class messagePanel extends JPanel {
 
        p.add( "North", blurb = new JTextField() );
        blurb.setEditable( false );
-       p.add( "Center", new JScrollPane( message = new JTextArea() )  );
+       p.add( "Center", 
+              new JScrollPane( message = new JTextArea(),
+                               JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+                               JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ) );
        message.setEditable( false );
+       message.setLineWrap( true );
+       message.setWrapStyleWord( true );
        add( "Center", p );
     }
 
index 22f9ea9b295dfbaf6e5b01524472d49528746d70..192a4b283f25d1f0162251aa236aca6e5efbbc55 100644 (file)
@@ -1,3 +1,4 @@
+
 import javax.swing.*;
 import java.io.*;
 import java.net.*;
@@ -70,7 +71,7 @@ public class net implements Runnable {
     public void run() {
        String  server = citadel.me.server;
        int             port = citadel.me.port;
-       boolean         proxy = false;
+       boolean         proxy = true;
 
        done = false;
        try {
@@ -104,6 +105,20 @@ public class net implements Runnable {
        getReply( "IDEN 0|7|" + citadel.VERSION + "|" + citadel.NAME + " " +
                  citadel.VERSION + " (" + getArch() + ")|" + getHostName() );
 
+       Thread  t = new Thread() {
+           public void run() {
+               while( !citadel.me.theNet.done ) {
+                   try {
+                       Thread.sleep( 30000 );
+                   } catch( Exception e ) {}
+
+                   System.out.println( "Idle event" );
+                   citadel.me.networkEvent( "NOOP" );
+               }
+           } };
+
+       t.start();
+
        MsgCmd  m;
        while( ((m = (MsgCmd)theQueue.get()) != null) && !done ) {
            citReply    r = getReply( m.cmd, m.data );
@@ -118,6 +133,9 @@ public class net implements Runnable {
        if( !done )
            citadel.me.lostNetwork( "Connection closed." );
 
+       try {
+           t.stop();
+       } catch( Exception e ) {}
     }
 
     public void done() {