Cosmetic/ui behavior fixes.
Added "who is online" window.
res_code = ERROR;
expressmsg = false;
- parseLine();
+ if( line != null )
+ parseLine();
}
public void parseLine() {
citPanel cp;
boolean floors;
+ whoWindow wo;
public static citadel me;
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( ) {
}
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() {
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;
}
}
public void refresh() {
- text.setText( citadel.me.getSystemMessage( "hello" ) );
+ text.setText( "" );
user.setText( "" );
pass.setText( "" );
+ text.setText( citadel.me.getSystemMessage( "hello" ) );
}
}
Panel p = new Panel();
if( !applet ) {
- p.add( host = new TextField() );
+ p.add( host = new TextField(20) );
host.setText( citadel.me.host );
}
}
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();
mail_num = atoi( r.getArg( 9 ) );
floor = atoi( r.getArg( 10 ) );
+ msgInfo.setText( "" );
+ theMsg.setText( "" );
+
if( info != 0 ) new displayInfo( name );
getMsgsPtrs();
}
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=" );
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 ) {
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;
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 );
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();
}
}
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();
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();