]> code.citadel.org Git - citadel.git/commitdiff
Fixed bug in passwordWindow.java.
authorChilly <chilly@uncensored.citadel.org>
Wed, 28 Jul 1999 17:39:43 +0000 (17:39 +0000)
committerChilly <chilly@uncensored.citadel.org>
Wed, 28 Jul 1999 17:39:43 +0000 (17:39 +0000)
Cosmetic/ui behavior fixes.

Added "who is online" window.

shaggy/citReply.java
shaggy/citadel.java
shaggy/enterPanel.java
shaggy/loginPanel.java
shaggy/logoffPanel.java
shaggy/messagePanel.java
shaggy/pageWindow.java
shaggy/passwordWindow.java

index a63f9592d023f87e9e21dcade7c0cbbf537009fc..01646946b0353026bae0719f8c137216c109c15e 100644 (file)
@@ -25,7 +25,8 @@ public class citReply {
     res_code = ERROR;
     expressmsg = false;
 
-    parseLine();
+    if( line != null )
+      parseLine();
   }
 
   public void parseLine() {
index 33ba5b7a4f83bba4b1791ff8ed6410f41876861c..fb44cfdd9320e0cfadd3fe77fde3cf43249c2eed 100644 (file)
@@ -12,6 +12,7 @@ public class citadel {
   citPanel                     cp;
 
   boolean                      floors;
+  whoWindow                    wo;
 
   public static citadel        me;
 
@@ -28,11 +29,15 @@ public class citadel {
     me = this;
     this.applet = false;
     theUser = null;
+    wo = null;
   }
 
   public void lostNetwork( String reason ) {
     theNet = null;
-    cp.logoff( "lost network connection: " + reason );
+    if( cp == null )
+      System.out.println( "lost network connection:" + reason );
+    else
+      cp.logoff( "lost network connection: " + reason );
   }
 
   public boolean openConnection( ) {
@@ -132,7 +137,10 @@ public class citadel {
   }
 
   public void who_online() {
-    System.out.println( "Who, pray tell, is online?" );
+    if( wo == null )
+      wo = new whoWindow();
+    else
+      wo.show();
   }
 
   public void page_user() {
index 36241e3880098ab31e9052161f6ea3d68a4f94ab..652426fc9b181e379959c76fb746171572df3bff 100644 (file)
@@ -40,10 +40,15 @@ public class enterPanel extends Panel {
     if( room.equalsIgnoreCase( "Mail" ) ) {
       who.enable();
       who.setText( r );
+      if( r == null )
+       who.requestFocus();
+      else
+       msg.requestFocus();
       mail = true;
     } else {
       who.disable();
       who.setText( "DISABLED" );
+      msg.requestFocus();
       mail = false;
     }
 
index 7fdd56409e5e5588f495e73f3222c34ca3ec901f..1ae46aa9ecfad7b66a9aa641210c04a17ab0b027 100644 (file)
@@ -80,9 +80,10 @@ public class loginPanel extends Panel {
   }
 
   public void refresh() {
-    text.setText( citadel.me.getSystemMessage( "hello" ) );
+    text.setText( "" );
     user.setText( "" );
     pass.setText( "" );
+    text.setText( citadel.me.getSystemMessage( "hello" ) );
   }
 }
 
index 40501eb290b08685f49e51d8feebc42126f7d61f..c3c836299f38cb849078ac822d42237463f4ca17 100644 (file)
@@ -25,7 +25,7 @@ public class logoffPanel extends Panel {
     Panel      p = new Panel();
 
     if( !applet ) {
-      p.add( host = new TextField() );
+      p.add( host = new TextField(20) );
       host.setText( citadel.me.host );
     }
 
@@ -38,7 +38,7 @@ public class logoffPanel extends Panel {
   }
 
   public boolean action ( Event e, Object o ) {
-    if( e.target == connect ) {
+    if( (e.target == connect) || (e.target == host) ) {
       if( !applet )
        citadel.me.host = host.getText();
 
index 2159fd7c6c0affa00dee0362d57c73f81d9010cd..2a70f1ccdd47254927fc2202fff2d1047930ffc7 100644 (file)
@@ -90,6 +90,9 @@ public class messagePanel extends Panel {
     mail_num = atoi( r.getArg( 9 ) ); 
     floor = atoi( r.getArg( 10 ) );
 
+    msgInfo.setText( "" );
+    theMsg.setText( "" );
+
     if( info != 0 ) new displayInfo( name );
     getMsgsPtrs();
   }
@@ -143,17 +146,10 @@ public class messagePanel extends Panel {
       return;
     }
 
-    int        n = atoi( num );
-    if( n > highest_read ) {
-      highest_read = n;
-      citadel.me.getReply( "SLRP " + num );
-    }
-
     Vector     msg = r.listing;
     String     s, from="", time="", room="", node="", rcpt="";
     do {
       s = (String)msg.firstElement();
-      System.out.println( s );
       msg.removeElementAt( 0 );
       from = begin( from, s, "from=" );
       time = begin( time, s, "time=" );
@@ -174,6 +170,12 @@ public class messagePanel extends Panel {
    
     msgInfo.setText( sum );
     theMsg.setText( r.getData() ); /* this relies on the fact that we've removed the header lines above.  probably a messy way to deal with references. */
+
+    int        n = atoi( num );
+    if( n > highest_read ) {
+      highest_read = n;
+      citadel.me.getReply( "SLRP " + num );
+    }
   }
 
   public String makeDate( String time ) {
index c86632f5dfe18ba2bda0576f58fd02bcbd6583e7..841b1efb7c6931978411c4b50657b492109b0e28 100644 (file)
@@ -6,8 +6,9 @@ import java.awt.*;
 public class pageWindow extends Frame {
   String       user;
   Choice       who;
-  TextField    msg;
+  TextComponent        msg;
   Button       send, cancel;
+  boolean      multi_line;
 
   public pageWindow( String user ) {
     this.user = user;
@@ -23,7 +24,14 @@ public class pageWindow extends Frame {
 
     NamedPanel np = new NamedPanel( "Message" );
     np.setLayout( new BorderLayout() );
-    np.add( "Center", msg = new TextField() );
+
+    multi_line = citadel.me.serverInfo.page_level == 1;
+    if( multi_line )
+      msg = new        TextArea();
+    else 
+      msg = new TextField();
+
+    np.add( "Center", msg );
 
     add( "Center", np );
 
@@ -32,18 +40,22 @@ public class pageWindow extends Frame {
     p.add( cancel = new Button( "Cancel" ) );
     add( "South", p );
 
-    citReply   r = citadel.me.getReply( "RWHO" );
-    int        i=0, which=0;
-    String     s;
-    while( (s=r.getLine( i++ )) != null ) {
-      String u = getUser(s);
-      if( u.equalsIgnoreCase( user ) ) which = i-1;
-      who.addItem( u );
-    }
+    if( user != null )
+      who.addItem( user );
+    else {
+      citReply r = citadel.me.getReply( "RWHO" );
+      int      i=0, which=0;
+      String   s;
+      while( (s=r.getLine( i++ )) != null ) {
+       String u = getUser(s);
+       if( u.equalsIgnoreCase( user ) ) which = i-1;
+       who.addItem( u );
+      }
 
-    who.select( which );
+      who.select( which );
+    }
 
-    resize( 300, 150 );
+    resize( 300, multi_line?300:150 );
     show();
   }
 
@@ -60,11 +72,20 @@ public class pageWindow extends Frame {
   }
 
   public boolean action( Event e, Object o ) {
-    if( (e.target == msg) || (e.target == send) ) {
+    if( (e.target == send) || (!multi_line && (e.target == msg)) ) {
       String user = who.getSelectedItem();
       String m = msg.getText();
-      if( m.length() > 0 )
-        citadel.me.getReply( "SEXP " + user + "|" + m );
+      if( m.length() > 0 ) {
+       if( multi_line ) {
+         citReply      r = citadel.me.getReply( "SEXP " + user + "|-" );
+         if( r.sendListing() ) {
+           citadel.me.theNet.println( m );
+           citadel.me.theNet.println( "" );
+           citadel.me.theNet.println( "000" );
+         }
+       } else
+         citadel.me.getReply( "SEXP " + user + "|" + m );
+      }
       dispose();
     } else if( e.target == cancel )
       dispose();
index c24def3bae56fdfa8094abc5261e326c248f9021..ed332049652243f76fa97da7164d2fbe0d0bb1e2 100644 (file)
@@ -39,7 +39,8 @@ public class passwordWindow extends Frame {
       String   s = text.getText();
       citReply r = citadel.me.getReply( "GOTO " + room + " " + s );
       if( r.ok() ) {
-       citadel.me.enterRoom( r );
+       citadel.me.cp.mp.visited( room );
+       citadel.me.cp.enterRoom( r );
        dispose();
       } else {
        dispose();