From 692b07b3106fce31acaaf50f2544671ef7379747 Mon Sep 17 00:00:00 2001 From: Chilly Date: Thu, 29 Jul 1999 20:03:09 +0000 Subject: [PATCH] changed prompting mechanism, more ui stuff --- shaggy/STATUS | 13 ++++++++---- shaggy/citadel.java | 44 +++++++++++++++++++++++++++++++-------- shaggy/enterPanel.java | 3 ++- shaggy/expressWindow.java | 3 +++ shaggy/mainPanel.java | 2 +- shaggy/messagePanel.java | 8 +++++-- 6 files changed, 56 insertions(+), 17 deletions(-) diff --git a/shaggy/STATUS b/shaggy/STATUS index 25d501777..0be01304d 100644 --- a/shaggy/STATUS +++ b/shaggy/STATUS @@ -6,11 +6,14 @@ Basic: - can log off (shows goodbye, and in application lets you connect to a different server) -- can recieve express messages (GEXP style, though don't get for multiple - messages yet) +- can recieve express messages (GEXP style, will get all messages that + are there. - can send and "reply" to express messages, uses either single or multi depending on server support. - who is online (double clicking on list will send express msg to user) +- supports the IDEN command +* can't change password or other config stuff + "main" - Splits rooms up into new and no-new @@ -19,8 +22,10 @@ Basic: - Go to next room with messages - go to any old room by double-clicking from list - * can't get to hidden or guessable-named rooms -- can go to password protected rooms (untested) +- can get to hidden or guessable-named rooms +- can go to password protected rooms (tested) +- can zap rooms + * can't list zapped rooms "message" - read new, all, or last-5 message in a room diff --git a/shaggy/citadel.java b/shaggy/citadel.java index 60fcdff4d..172be7e61 100644 --- a/shaggy/citadel.java +++ b/shaggy/citadel.java @@ -3,7 +3,12 @@ * the "main" object */ +import java.util.*; +import java.net.InetAddress; + public class citadel { + public static String VERSION="0.0"; + String host; boolean applet; net theNet; @@ -65,7 +70,7 @@ public class citadel { if( theNet.connect(host) ) { System.out.println( "Connected to server." ); - getReply( "IDEN 0|7|0.0|Shaggy|err.ahh.umm.com" ); + getReply( "IDEN 0|7|" + VERSION + "|Shaggy " + VERSION + " (" + getArch() + ")|" + getHostName() ); citReply rep = theNet.getReply( "INFO" ); if( rep.listingFollows() ) serverInfo = new server( rep ); @@ -78,6 +83,24 @@ public class citadel { return false; } + public String getArch() { + try { + Properties p = System.getProperties(); + return p.get( "os.name" ) + "/" + p.get( "os.arch" ); + } catch( SecurityException se ) { + return ""; + } + } + + public String getHostName() { + try { + InetAddress me = InetAddress.getLocalHost(); + return me.getHostName(); + } catch( Exception e ) { + return "dunno"; + } + } + public String getBlurb() { if( serverInfo != null ) return serverInfo.blurb; return ""; @@ -98,6 +121,10 @@ public class citadel { cp.mainMenu(); } + public boolean floors() { + return floors; + } + public citReply getReply( String s ) { return getReply( s, (String)null ); } @@ -108,29 +135,28 @@ public class citadel { return theNet.getReply( s,d ); } - public void enterRoom( String room ) { - enterRoom( room, null ); - } - public void gotoRoom( ) { gotoRoom( null, false ); } public void gotoRoom( String name, boolean flag ) { - /* TODO: prompt for room name */ - System.out.println( "This is where I would ask you for the room's name" ); + new promptWindow( new gotoPrompt( name ) ); + } + + public void enterRoom( String room ) { + enterRoom( room, null ); } public void enterRoom( String room, String pass ) { String cmd = "GOTO " + room; if( pass != null ) - cmd = cmd + " " + pass; + cmd = cmd + "|" + pass; citReply r=getReply( cmd ); if( r.ok() ) { rooms.visited( room ); cp.enterRoom( r ); } else if( r.res_code == 540 ) /* ERROR+PASSWORD_REQUIRED */ - new passwordWindow( room ); + new promptWindow( new roomPassPrompt( room ) ); } public void showMsgPane() { diff --git a/shaggy/enterPanel.java b/shaggy/enterPanel.java index fffae3fd8..05dc14746 100644 --- a/shaggy/enterPanel.java +++ b/shaggy/enterPanel.java @@ -54,7 +54,8 @@ public class enterPanel extends Panel { msg.setText( "" ); - np.setLabel( room + " (" + citadel.me.rooms.getRoomsFloorName( room )+")" ); + np.setLabel( room + (citadel.me.floors() ? + " (" + citadel.me.rooms.getRoomsFloorName( room )+")" : "" ) ); this.room = room; this.recip = r; diff --git a/shaggy/expressWindow.java b/shaggy/expressWindow.java index aea6949a2..934a37815 100644 --- a/shaggy/expressWindow.java +++ b/shaggy/expressWindow.java @@ -28,6 +28,9 @@ public class expressWindow extends Frame { 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(); } diff --git a/shaggy/mainPanel.java b/shaggy/mainPanel.java index 96ad77a61..499d66438 100644 --- a/shaggy/mainPanel.java +++ b/shaggy/mainPanel.java @@ -43,7 +43,7 @@ public class mainPanel extends Panel { } public boolean action( Event e, Object o ) { - if( (e.target == newL) || (e.target == oldL) || (e.target == goto_room)) { + if( (e.target == newL) || (e.target == oldL) ) { String room = getRoom(); if( room != null ) citadel.me.enterRoom( room ); diff --git a/shaggy/messagePanel.java b/shaggy/messagePanel.java index 0f77429c1..7e4746728 100644 --- a/shaggy/messagePanel.java +++ b/shaggy/messagePanel.java @@ -8,7 +8,7 @@ public class messagePanel extends Panel { Choice reading; Button who_is_online, room_info; Button next_room, goto_room, page_user; - Button next_msg, prev_msg, enter_msg, back; + Button next_msg, prev_msg, enter_msg, zap_room, back; TextField msgInfo; TextArea theMsg; NamedPanel np; @@ -37,6 +37,7 @@ public class messagePanel extends Panel { vp.add( next_room = new Button( "Next Room" ) ); vp.add( goto_room = new Button( "Goto Room" ) ); vp.add( room_info = new Button( "Room Info" ) ); + vp.add( zap_room = new Button( "Zap Room" ) ); vp.add( who_is_online = new Button( "Who is Online" ) ); vp.add( page_user = new Button( "Page User" ) ); vp.add( back = new Button( "Back" ) ); @@ -74,6 +75,8 @@ public class messagePanel extends Panel { citadel.me.nextNewRoom(); } else if( e.target == goto_room ) { citadel.me.gotoRoom(); + } else if( e.target == zap_room ) { + new promptWindow( new zapPrompt( name ) ); } else if( e.target == back ) { citadel.me.mainMenu(); } @@ -82,7 +85,8 @@ public class messagePanel extends Panel { public void refresh( citReply r ) { name = r.getArg( 0 ); - np.setLabel( name + " (" + citadel.me.rooms.getRoomsFloorName( name )+")" ); + np.setLabel( name + (citadel.me.floors() ? + " (" + citadel.me.rooms.getRoomsFloorName( name )+")" : "" ) ); total = citadel.atoi( r.getArg( 1 ) ); unread = citadel.atoi( r.getArg( 2 ) ); info = citadel.atoi( r.getArg( 3 ) ); -- 2.39.2